summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:05:59 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:05:59 +0000
commit5e520b1b65c79cd828057cb628b9367acb266880 (patch)
tree645361ececb1a50c2fe0260beca5c1169d0e197b /sca-java-1.x/branches
parent00c625535fe93a57d605c8988147b77207d43fad (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835117 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches')
-rw-r--r--sca-java-1.x/branches/sca-android/demos/pom.xml44
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/pom.xml252
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/assembly/bin.xml38
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/assembly/src.xml37
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-common.xml44
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-dependencies.xml41
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-filtered-dependencies.xml92
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-samples.xml54
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/src-common.xml42
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/src-modules.xml78
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/CHANGES431
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/DISCLAIMER7
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/README19
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/RELEASE_NOTES83
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/INSTALL27
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/LICENSE2366
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/NOTICE95
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/BUILDING55
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/LICENSE397
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/NOTICE39
-rwxr-xr-xsca-java-1.x/branches/sca-android/distribution/features/etc/generate-all-maven-files.sh26
-rwxr-xr-xsca-java-1.x/branches/sca-android/distribution/features/etc/generate-filtered-dependencies.sh69
-rwxr-xr-xsca-java-1.x/branches/sca-android/distribution/features/etc/generate-maven-files.sh25
-rwxr-xr-xsca-java-1.x/branches/sca-android/distribution/features/etc/generate-pom.sh26
-rwxr-xr-xsca-java-1.x/branches/sca-android/distribution/features/etc/generate-src-modules.sh65
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/pom.xml38
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/pom.xml122
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/assembly/repository.xml43
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/components/src-modules.xml79
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/CHANGES431
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/DISCLAIMER7
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/README19
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/RELEASE_NOTES83
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/INSTALL27
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/LICENSE2366
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/NOTICE95
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/BUILDING55
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/LICENSE397
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/NOTICE39
-rw-r--r--sca-java-1.x/branches/sca-android/distribution/pom.xml36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/README28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/pom.xml60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListService.java9
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceByYear.java8
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceImpl.java69
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyLogger.java17
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyService.java9
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceByDate.java10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceImpl.java113
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalService.java6
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceImpl.java74
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/SCAComponentService.java9
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceInRecursiveTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/Iteration1Composite.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/Iteration3Composite.composite68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/MySimpleService.composite59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/pom.xml63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/java/itest/MyClientImpl.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/java/itest/MyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/resources/MyClient.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/test/java/itest/MyClientTestCase.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/pom.xml36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/pom.xml63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/java/itest/MyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/java/itest/MyServiceImpl.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/resources/MyService.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/test/java/itest/MyServiceTestCase.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/pom.xml210
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl87
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/deploy.xml35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel84
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/log4j.properties36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/pom.xml176
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorld.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorldTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/deploy.xml31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.bpel66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.wsdl82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/log4j.properties36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld/pom.xml162
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/log4j.properties36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/bpel/pom.xml37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/pom.xml106
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/scenario1.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/scenario1a.composite47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/scenario10.composite62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/scenario10a.composite61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/service3.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/scenario11.composite59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/scenario11a.composite64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/service3.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/scenario12.composite58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/scenario12a.composite64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/scenario13.composite58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/scenario13a.composite64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/scenario2.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/scenario2a.composite47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/scenario3.composite44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/scenario3a.composite48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/scenario4.composite44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/scenario4a.composite48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenario5.composite46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenario5a.composite47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenarios.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenario6.composite47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenario6a.composite47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenarios.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenario7.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenario7a.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenarios.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenario8.composite44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenario8a.composite50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenarios.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/scenario9.composite60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/scenario9a.composite61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java805
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java176
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java210
-rw-r--r--sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java203
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/pom.xml59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.java96
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/resources/example.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/pom.xml81
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java114
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefconversational/ConversationalService.java68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefconversational/ConversationalServiceImpl.java111
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java86
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceConversationalTest.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceTest.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceConversationalTestCase.java109
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java145
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-api/pom.xml50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java206
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java123
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-api/src/main/resources/CallBackApiTest.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-basic/pom.xml50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java135
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/resources/CallBackBasicTest.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-complex-type/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java142
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-id/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java147
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-id/src/main/resources/CallBackIdClient.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-separatethread/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java172
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java197
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java190
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java163
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java98
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/pom.xml47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/AddService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/CalculatorClient.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/Calculator.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/component-type/src/test/java/calculator/CalculatorTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/build-jar.xml39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/pom.xml203
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.java74
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.xml31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/pom.xml60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java373
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.java231
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCaseFIXME.java381
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-classloader/pom.xml51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/pom.xml67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/resources/hello.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java91
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/pom.xml67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/pom.xml31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/pom.xml31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/pom.xml73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java126
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/pom.xml73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java127
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/pom.xml102
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/main/resources/store.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java129
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/pom.xml73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java137
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-import-export/pom.xml56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/pom.xml51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/hello/Hello.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/hello/HelloImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionCycleTestCaseFIXME.java121
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionMultipleTestCaseFIXME.java131
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java145
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-export/META-INF/sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-export/hello.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-import/META-INF/sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-import/helloworld_one.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-two/META-INF/sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-two/helloworld_two.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/AddService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/CalculatorClient.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/DivideService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/MultiplyService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/SubtractService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/resources/ContributionTest.composite24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/resources/calculator/Calculator.composite51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/main/resources/calculator/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java218
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/itest/contribution/src/test/resources/repository/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/pom.xml60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java76
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java76
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java322
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java311
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java318
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java124
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java119
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java118
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java122
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java94
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/Conversational/conversational.composite169
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl383
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java198
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java209
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java193
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java193
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java205
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java192
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/Record.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/TestResult.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.java56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Alpha.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Beta.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.java25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Gamma.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java111
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AlphaImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BetaImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java85
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java321
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java310
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java317
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java123
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java117
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java117
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java123
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java93
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/GammaImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/ConversationAge.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/ConversationUniqueId.composite53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversationId.composite27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversationLifetime.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversational.composite99
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java203
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationUniqueIdTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java103
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java84
-rw-r--r--sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java649
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/pom.xml169
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFiveTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.java149
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioOneTestCase.java371
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioSixTestCase.java228
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioThreeTestCase.java130
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioTwoTestCase.java139
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/TestCorbaHost.java56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/TestCorbaHostModuleActivator.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStruct.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHelper.java97
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHolder.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/Color.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ColorHelper.java72
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ColorHolder.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStruct.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStructHelper.java112
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStructHolder.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnion.java112
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnionHelper.java106
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnionHolder.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/LongSequenceHelper.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/LongSequenceHolder.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStruct.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStructHelper.java110
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStructHolder.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnion.java177
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnionHelper.java157
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnionHolder.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOne.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneHelper.java104
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneHolder.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneOperations.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSix.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixHelper.java104
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixHolder.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixOperations.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java106
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringArrayHelper.java95
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringArrayHolder.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringSequenceHelper.java81
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringSequenceHolder.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHelper.java83
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHolder.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedException.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHelper.java98
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHolder.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColor.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColorHelper.java105
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColorHolder.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioOneImplBase.java91
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioOneStub.java84
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioSixImplBase.java105
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioSixStub.java119
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java93
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.java99
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFive.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveComponent.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveImpl.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFour.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourComponent.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourException.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourStruct.java40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioOneComponent.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioOneServant.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioSixServant.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioTwoServant.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TAnnotatedStruct.java40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TColor.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TInnerStruct.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TInnerUnion.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TRichStruct.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TRichUnion.java95
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOne.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOneComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOneServant.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSix.java37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSixComponent.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSixServant.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThree.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeComponent.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeServant.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwo.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoComponent.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoServant.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioFive.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioFour.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioOne.composite111
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioSix.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioThree.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioTwo.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/itest_scenario.idl110
-rw-r--r--sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/scenariofour.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/pom.xml126
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java181
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm112
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm103
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/generate.xsd61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/wsdl/Dummy.txt4
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Annotation.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Annotation.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Attribute.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Attribute.xsd39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Import.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Import.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Include.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Include.xsd36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Interop.xsd138
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Notation.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Notation.xsd35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/Person.xsd30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/datagraph.xsd88
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd88
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd221
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/config.pngbin0 -> 31222 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/config.svg117
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/databinding.pngbin0 -> 14106 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/databinding.svg242
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/interop.pngbin0 -> 23179 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/interop.svg352
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/interop/pom.xml223
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm113
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm103
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm103
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/interop/src/main/resources/generate/generate.xml159
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm78
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/pom.xml239
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean1.java63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean10.java25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean11.java25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean2.java56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean3.java56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean31.java56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsLocalService.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsServiceClient.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloLocalServiceSimple.java37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceSimple.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceSimpleClient.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesLocalService.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesLocalService.java78
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsLocalServiceClientImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsServiceClientImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsServiceImpl.java69
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsTransformer.java125
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloLocalServiceSimpleClientImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceSimpleClientImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceSimpleImpl.java86
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesLocalServiceClientImpl.java138
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java151
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesLocalServiceClientImpl.java157
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java208
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java144
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl127
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/generics-service.composite69
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/helloservice.composite65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/primitivesservice.composite66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/standard-types-service.composite66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DatabindingTestCase.java339
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsDatabindingTestCase.java484
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesDatabindingTestCase.java776
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesDatabindingTestCase.java1438
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/pom.xml194
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloService.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceClient.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java84
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java81
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceClientImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceImpl.java86
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java139
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java151
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java159
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java207
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java142
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/hello-service.wsdl371
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/helloservice.composite80
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/primitives-service.wsdl927
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/primitivesservice.composite80
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/standard-types-service.composite80
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/standard-types-service.wsdl1155
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/DatabindingTestCase.java342
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/PrimitivesDatabindingTestCase.java848
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/StandardTypesDatabindingTestCase.java1450
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxbgen/pom.xml262
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml172
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/jaxbgen/src/main/resources/greeter.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/pom.xml47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/readme.html157
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/sdogen/pom.xml251
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/sdogen/src/main/resources/generate/generate.xml170
-rw-r--r--sca-java-1.x/branches/sca-android/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/pom.xml100
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddServiceImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/CalculatorService.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java74
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/SubtractService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/SubtractServiceImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionA/Calculator.composite44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionDependent/Calculator.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionPrimary/Calculator.composite57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java279
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/pom.xml243
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java136
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/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-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl148
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java102
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/pom.xml234
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java31
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/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-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java119
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl141
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl148
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java93
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/pom.xml59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.java23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/resources/example.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl126
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java115
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.java116
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/main/resources/ExceptionTest.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/extended-api/pom.xml51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/extended-api/src/main/resources/BasicService.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/extended-api/src/main/resources/MathService.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java83
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java81
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/main/resources/InterfacesTest.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java126
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-client/pom.xml126
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/resources/default.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/resources/wsdl/interopdoc.wsdl195
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java144
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/pom.xml124
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/java/org/apache/tuscany/test/interop/client/InteropTestDocLit.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/resources/default.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/resources/wsdl/interoptestdoclit.wsdl155
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java133
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-service/pom.xml134
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/resources/wsdl/interopdoc.wsdl180
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/webapp/META-INF/sca/default.scdl42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/webapp/WEB-INF/web.xml51
-rwxr-xr-xsca-java-1.x/branches/sca-android/itest/interop-soap-service/t.bat34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-args/pom.xml92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-args/src/main/resources/jndi.properties38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-args/src/main/resources/selectors/selectors.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-args/src/test/java/org/apache/tuscany/sca/binding/jms/ArgsTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/pom.xml94
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClientImpl.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSService.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceCallback.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/jndi.properties39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/simple/client.composite44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/simple/tempq.composite50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/CallbackTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/TempCallbackQTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-definitions/pom.xml93
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/definitions.xml29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/definitions/definitions.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/jndi.properties38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-definitions/src/test/java/org/apache/tuscany/sca/binding/jms/DefinitionsTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-selectors/pom.xml93
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl1.java40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl2.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl3.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/resources/jndi.properties38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/resources/selectors/selectors.composite68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms-selectors/src/test/java/org/apache/tuscany/sca/binding/jms/SelectorsTestCase.java75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/pom.xml97
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/defaults/client.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/defaults/service.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/dynamic/client.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/exceptions/client.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/exceptions/service.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/external/client.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/external/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/jndi.properties39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/nonSCAclient/service.composite50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/oneway/OneWayClient.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/oneway/OneWayService.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/properties/properties.composite55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/client.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/mpclient.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/uriclient.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java141
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/large-sdo-ws/pom.xml141
-rw-r--r--sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.java112
-rw-r--r--sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/trnInq.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd146
-rw-r--r--sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.java87
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/pom.xml126
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/AddService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/AddServiceImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/CalculatorServiceImpl.java74
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/SubtractService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/SubtractServiceImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeA/Calculator.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeB/Calculator.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeB/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeC/Calculator.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeC/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/binding/sca/BindingScaEndpointResolverFactoryImpl.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/binding/sca/BindingScaEndpointResolverImpl.java72
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/calculator/LateReferenceResolutionTestCase.java97
-rw-r--r--sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/calculator/TestRegistryImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/oneway/build.xml127
-rw-r--r--sca-java-1.x/branches/sca-android/itest/oneway/pom.xml59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java233
-rw-r--r--sca-java-1.x/branches/sca-android/itest/operation-overloading/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java113
-rw-r--r--sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java99
-rw-r--r--sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/resources/OperationOverload.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java84
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/build-bundles.xml39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/pom.xml211
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/OSGiBundleImpl.java121
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/Customer.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/Customer2V2.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/CustomerV2.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/customer-sca-contribution.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/retailer-sca-contribution.xml29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/shipper-sca-contribution.xml27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/supplychain-sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/warehouse-sca-contribution.xml28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/RetailerV2.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/ShipperV2.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/WarehouseV2.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer.mf13
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer2.mf13
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Retailer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/RetailerJar.mf1
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/SupplyChain.mf13
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Warehouse.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/supplychain.composite67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/build-bundles.xml39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/pom.xml212
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/OSGiBundleImpl.java121
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/Customer.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/Customer2V1.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/CustomerV1.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/RetailerV1.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/ShipperV1.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/WarehouseV1.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer.mf13
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer2.mf13
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Retailer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/RetailerJar.mf1
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/SupplyChain.mf13
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Warehouse.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/supplychain.composite66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/pom.xml92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/main/java/org/apache/tuscany/sca/contribution/osgi/OSGiTestUtil.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/MixedContributionTestCase.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/NestedBundleTestCase.java182
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/OSGiResolverTestCase.java257
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/SCAResolverTestCase.java240
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/resources/osgi/felix/felix.config.properties44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-contribution/pom.xml52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/build-bundles.xml48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/pom.xml1220
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/CallbackCallback.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/CallbackClient.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/JavaCallbackClientImpl.java141
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/OSGiCallbackClientImpl.java181
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/CallbackService.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/JavaCallbackServiceImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/OSGiCallbackServiceImpl.java95
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalCallback.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClient.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientActivator.java105
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientServiceFactory.java135
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatefulImpl.java254
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatelessImpl.java253
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClient.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientActivator.java66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalService.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceActivator.java76
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceFactory.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatefulImpl.java121
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatelessImpl.java127
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/Greetings.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/HelloWorld.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/JavaGreetingsComponent.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/JavaHelloWorldComponent.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/OSGiGreetingsImpl.java112
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/OSGiHelloWorldImpl.java81
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/HelloWorldService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/HelloWorldServiceComponent.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/client/HelloWorldClient.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/client/HelloWorldClientComponent.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorld.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorldService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteComponentImpl.java86
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteFactoryImpl.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteImpl.java119
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/StockQuote.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java163
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java88
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java106
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java100
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java98
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java78
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java78
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java78
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/CallbackClient.componentType31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/CallbackService.componentType27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test1.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test2.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test3.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalClient.componentType37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalReferenceClient.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalService.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/conversation-test.composite162
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Customer.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Retailer.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Shipper.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Warehouse.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Customer.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Retailer.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Shipper.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Warehouse.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/factory-ds-test.composite130
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/factory-test.composite116
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/helloworld/Greetings.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/helloworld/HelloWorld.componentType31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Customer.componentType31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Retailer.componentType35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Shipper.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Warehouse.componentType31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Customer.componentType31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Retailer.componentType35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Shipper.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Warehouse.componentType31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/interfaces-ds-test.composite57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/interfaces-test.composite57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackClient.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackService.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalClient.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalReferenceClient.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalService.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Customer.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Retailer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.xml41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer1.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer2.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper1.xml34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper2.xml34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Customer.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Retailer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.xml43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.xml39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.xml34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/passbyref/Greetings.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ManagedStockQuoteFactory.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuote.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuoteFactory.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.mf12
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.xml27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.mf12
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.xml27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldClient.mf14
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldClient.xml33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldService.mf13
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldService.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Customer.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Retailer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Warehouse.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.xml41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer1.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer2.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper1.xml34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper2.xml34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse1.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse2.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Customer1.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Customer2.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Retailer1.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Retailer2.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Shipper1.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Shipper2.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse1.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse2.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer1.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer2.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV1.xml41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV2.xml41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V1.xml34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V2.xml34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V1.xml33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V2.xml33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V1.xml35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V2.xml35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V1.xml35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V2.xml35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V1.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V2.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V1.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V2.xml32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Customer.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Retailer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Warehouse.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.xml41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer1.xml33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer2.xml33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper.mf10
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper1.xml35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper2.xml34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse.mf11
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse1.xml33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse2.xml33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/ws/HelloWorld.mf12
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/passbyref/Greetings.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/passbyref/passbyref-test.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/StockQuote.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/StockQuoteFactory.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/StockQuote.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/StockQuoteFactory.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/properties-ds-test.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/properties2-ds-test.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/properties-test.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/properties2-test.composite50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/HelloWorldClient.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/HelloWorldService.componentType25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/META-INF/sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/helloworld.wsdl88
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/helloworldsdo.composite47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Customer.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Retailer.componentType33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Shipper.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Warehouse.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Customer.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Retailer.componentType33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Shipper.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Warehouse.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/services-ds-test.composite90
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/services-test.composite89
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/stockquote/StockQuote.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Customer1.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Customer2.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Retailer1.componentType33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Retailer2.componentType33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Shipper1.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Shipper2.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Warehouse1.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Warehouse2.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Customer1.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Customer2.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Retailer1.componentType33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Retailer2.componentType33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Shipper1.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Shipper2.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Warehouse1.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Warehouse2.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/version-ds-test.composite184
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/version-test.composite170
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Customer.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Retailer.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Shipper.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Warehouse.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Customer.componentType34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Retailer.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Shipper.componentType29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Warehouse.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test1.composite136
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test2.composite151
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/wiring-test1.composite127
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/wiring-test2.composite151
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/HelloWorld.componentType31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/ws-helloworld.composite51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback1TestCase.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback2TestCase.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback3TestCase.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/CallbackTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/conversation/ConversationTestCase.java325
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/passbyref/PassByRefTestCase.java130
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/sdo/SdoTestCase.java95
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/ws/HelloWorldTestCase.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/SupplyChainTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/VersionedSupplyChainTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/test/OSGiTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/resources/osgi/felix/felix.config.properties45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/pom.xml99
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/EquinoxTestRuntime.java92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/FelixTestRuntime.java163
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/OSGiTestRuntime.java163
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/OSGiRuntimeLoader.java86
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/TuscanyLoader.java136
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyNonOSGiTestHarness.java109
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyTestHarness.java243
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorImplementationPoliciesTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorRmiTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorScriptTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsClientTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsServiceTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceJmsTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceSecureTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/NonOSGiSamplesTestCase.java85
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiSupplyChainTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiTuscanyRuntimeTestCase.java137
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySampleExtensionsTestCase.java93
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySamplesUsingOldDomainTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/META-INF/MANIFEST.MF14
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/felix/felix.config.properties45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/pom.xml39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/build-bundles.xml31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/pom.xml124
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/client/SupplyChainClient.java115
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/Customer.java37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChain.mf12
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChainClient.mf21
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/supplychain.composite48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/Customer.wsdl135
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/supplychain.composite55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-osgi-installer/pom.xml671
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java405
-rw-r--r--sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-versioned/pom.xml644
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/pom.xml113
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldClientImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/definitions.xml47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/helloworld.composite58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/jndi.properties39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/test/java/org/apache/tuscany/sca/itest/BasicAuthTestCase.java114
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/pom.xml75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/java/helloworld/HelloWorldImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/java/helloworld/HelloWorldService.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/resources/definitions.xml29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/resources/helloworld.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/itest/PolicySecurityJSR250TestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security/pom.xml68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security/src/main/resources/definitions.xml33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security/src/main/resources/helloworld.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy-security/src/test/java/org/apache/tuscany/sca/itest/PolicyIdentityTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/pom.xml68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/AddService.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/AddServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/CalculatorClient.java69
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java76
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/DivideService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/DivideServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/PolicyQNames.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/SubtractServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java84
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/Calculator.composite66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/definitions.xml147
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/Policy.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/TestPolicyProcessor.java82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/pom.xml59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/pom.xml59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/BusinessException.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleClient.java23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleClientImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleService.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleServiceImpl.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/example.composite50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/wsdl/ExampleService.wsdl133
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/wsdl/ExampleServiceTypes.xsd45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/test/java/com/example/ExampleTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/pom.xml91
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java88
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java131
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java143
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java151
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java134
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java188
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java78
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java109
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/package-info.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/ConstructorPropertyInjection.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/Outer.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/OuterPropertyTest.composite42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/PropertyTest.composite255
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/customer.xsd30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/fileProperty.txt21
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/manyValuesFileProperty.txt23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/mySimpleService.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/rcProps.txt22
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/rcprops.xsd55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java99
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java164
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java468
-rw-r--r--sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-multi-level/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/pom.xml87
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/Target.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/Composer.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerClient.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerClientImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerServer.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Client.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Inner.composite26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Outer.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/bindingoverride/InnerComposite.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/bindingoverride/OuterComposite.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/definitions.xml39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/bindingoverride/BindingOverrideTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java74
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/recursive/ComposerClientTestCase.java68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/recursive/ComposerTestServer.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/circular/include/DemoClass.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/CompositeClient.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/Source.java24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/SourceCallback.java24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/SourceImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/Target.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/TargetImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/A.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/B.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/I.java23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/Target.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/TargetClientImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/TargetServiceImpl.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/ComponentAImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/ComponentCImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/ComponentEImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/ComponentFImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/Service1.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/Aggregator.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/AggregatorImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/InnerSourceImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/OuterSourceImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/Source.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/Target.java23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetOne.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetTwo.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/AComposite.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/BComposite.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/CComposite.composite44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Composite1.composite42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Composite2.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Composite3.composite48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Demo1Composite.composite27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Demo2Composite.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Inner.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/InnerComposite.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/InnerComposite2.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Outer.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/OuterComposite.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/foo.pngbin0 -> 571816 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o1.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o2.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o3.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o4.composite37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/definitions.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/test1/InnerComposite.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/test1/OuterComposite.composite27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/circular/include/CircularIncludeTestCase.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/CompositeTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java113
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/foo/O2TestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/foo/O4TestCase.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/policy/PolicyTestCase.java68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/C.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/CImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/NestedTestCase.java96
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/X.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/XImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/Y.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/YImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test/InnerTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test/OuterTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/pom.xml53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java126
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/resources/AutoWiredReferencesTest.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/resources/InnerReferencesTest.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/main/resources/ManualWiredReferencesTest.composite63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java91
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java94
-rw-r--r--sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java93
-rw-r--r--sca-java-1.x/branches/sca-android/itest/scopes/pom.xml47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/scopes/src/main/resources/scopes.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java93
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/pom.xml66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalService.java81
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceCallback.java37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceImpl.java141
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClient.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClientImpl.java115
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClient.java55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClientImpl.java132
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessService.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceCallback.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceImpl.java82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/utils/ServiceReferenceUtils.java127
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/resources/ServiceReferenceSerializationTest.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/main/resources/nestedcomposite.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/serialization/src/test/java/org/apache/tuscany/sca/itest/servicereference/SerializeServiceReferenceTestCase.java145
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/resources/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/main/resources/ServicesTest.composite70
-rw-r--r--sca-java-1.x/branches/sca-android/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java105
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/pom.xml80
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/META-INF/sca/SpringDelegationHelloWorld-context.xml37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/pom.xml91
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.java143
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.java133
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/accounts.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/definitions.xml99
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/log4j.properties29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.java119
-rw-r--r--sca-java-1.x/branches/sca-android/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/pom.xml166
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/account/Customer.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/account/CustomerImpl.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/calculator/AddService.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/calculator/AddServiceHome.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/jms/HelloWorldService.java26
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/jms/HelloWorldServiceImpl.java27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddServiceImplWithServiceName.java46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/CalculatorClient.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/CalculatorServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/DivideServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/MultiplyServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/PropertyService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/PropertyServiceImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractServiceImplWithServiceName.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/AddService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/AddServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/CalculatorClient.java45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/CalculatorServiceImpl.java75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/DivideServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/MultiplyServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/SubtractServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestImpl.java50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestInterface.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestWithPropertyImpl.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/HelloWorld.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/HelloWorldProxy.java41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/TestHelloWorldBean.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/interfacejava/xml/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/java/interfacejava/xml/CalculatorServiceImpl.java75
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ComponentReferenceTargetNotFound/Calculator.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateComponentName/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationPropertyName/Calculator.composite55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationPropertyName/dummyImplementation.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationReferenceName/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationReferenceName/dummyImplementation.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicatePropertyName/Calculator.composite51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateReferenceName/Calculator.composite50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/MultipleBindingsForService/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoComponentImplementation/Calculator.composite52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoCompositeNamespace/Calculator.composite48
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoMatchingBinding/Calculator.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PromotedReferenceNotFound/Calculator.composite51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PromotedServiceNotFound/Calculator.composite51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/Calculator.composite55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/CalculatorNullMustSupply.composite53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/CalculatorOverrideManyAttribute.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyNotFound/Calculator.composite50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleComponentInterface/Calculator.composite51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleInterface/Calculator.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleMultiplicity/Calculator.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceNotFound/Calculator.composite50
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceWithoutTargets/Calculator.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ServiceNotFoundForComponentService/Calculator.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/UnresolvedComponentImplementation/Calculator.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/XsdValidation/Calculator.composite51
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/ContributionReadException/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/PolicyImplValidationException/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/PolicyServiceValidationException/Calculator.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedBindingElement/Calculator.composite55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedImplementationElement/Calculator.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedInterfaceElement/Calculator.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/InvalidWsdlElementAttr/Calculator.composite58
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/MustUseWsdlBinding/Calculator.composite59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworld.wsdl92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworldwsjms.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/helloworld.wsdl92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/helloworldwsclient.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworld.wsdl92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworldwsjms.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingejb/UnknownEJBSessionType/account.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingejb/UnknownEJBVersion/account.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessActivationSpec/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessDestinationType/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessHeaders/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResourceAdapter/service.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseActivationSpec/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseConnectionFactory/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseDestinationType/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidCorrelationScheme/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidJMSDeliveryMode/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidJMSPriority/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidResponseDestinationType/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingActivationSpecName/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingConnectionFactoryName/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingResponseActivationSpec/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingResponseConnectionFactory/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MustStartWithSchema/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnexpectedElement/service.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnexpectedResponseElement/service.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnknownTokenInURI/service.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/java/AttributePackageMissing/Calculator.composite55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/namespace/AttributeNameSpaceMissing/Calculator.composite55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/resource/AttributeURIMissing/Calculator.composite55
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/resource/AttributeURIMissing/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/xml/AttributeCompositeMissing/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/xml/AttributeCompositeMissing/sca-contribution.xml24
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/AttributeUnrecognizedNamespace/helloworld.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/AttributeWithoutNamespace/helloworld.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/deploy.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.bpel66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.wsdl82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/deploy.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.bpel66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/deploy.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.bpel66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.wsdl82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/deploy.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.bpel68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.wsdl82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/deploy.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.bpel66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.wsdl82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/deploy.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.bpel66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/java/ClassNotFoundException/Calculator.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/java/ContributionResolveException/Calculator.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/OSGiTestService.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/osgitest.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/osgitest.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/osgitest.composite36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/resource/CouldNotResolveLocation/resource.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/resource/LocationAttributeMissing/resource.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/ContributionResolveException/SpringHelloWorld.composite27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/LocationAttributeMissing/SpringHelloWorld.composite27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld-context.xml0
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/TestHelloWorldBean.componentType27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/widget/CouldNotResolveLocation/widget.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/widget/LocationAttributeMissing/widget.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/xquery/CouldNotLocateFile/HelloWorld.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/xquery/LocationAttributeMissing/HelloWorld.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ClassNotFoundException/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ClassNotFoundException/CalculatorServiceImpl.componentType27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ContributionResolveException/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ContributionResolveException/CalculatorServiceImpl.componentType27
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/Calculator.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/helloworld-interface.wsdl67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/helloworld-service.wsdl49
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworld.wsdl92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworldwsjms.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/ClassNotFoundException/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/ClassNotFoundException/definitions.xml78
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/RequiredAttributeRolesMissing/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/RequiredAttributeRolesMissing/definitions.xml78
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/definitions.xml63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/definitions.xml76
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/IntentNotSpecified/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/IntentNotSpecified/definitions.xml175
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/MayProvideIntentNotFound/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/MayProvideIntentNotFound/definitions.xml63
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/RequiredAttributeMissing/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/RequiredAttributeMissing/definitions.xml70
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/definitions.xml242
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/Calculator.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/definitions.xml68
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/ContributionReadException.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/PolicyImplValidationException.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/PolicyServiceValidationException.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedBindingElement.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedImplementationElement.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedInterfaceElement.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessActivationSpecTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessDestinationTypeTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessHeadersTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResourceAdapterTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseActivationSpecTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseConnectionFactoryTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseDestinationTypeTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidCorrelationSchemeTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidJMSDeliveryModeTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidJMSPriorityTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidResponseDestinationTypeTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingActivationSpecNameTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingConnectionFactoryNameTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingResponseActivationSpecTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingResponseConnectionFactoryTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MustStartWithSchemaTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnknownTokenInURITestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/InvalidWsdlElementAttrTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/MustUseWsdlBindingTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlBindingDoesNotMatchTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlPortTypeDoesNotMatchTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlServiceDoesNotMatchTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java77
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java66
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java73
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/java/AttributePackageMissingTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/namespace/AttributeNameSpaceMissingTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/resource/AttributeURIMissingTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/xml/AttributeCompositeMissingTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/domain/CustomCompositeBuilder.java222
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java111
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacejava/xml/ClassNotFoundTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacejava/xml/ContributionResolveExceptionTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacewsdl/xml/WsdlInterfaceDoesNotMatchTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wires/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java34
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java36
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wires/src/main/resources/WireTest.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-android/itest/ws-void-args-return/pom.xml61
-rw-r--r--sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/Bean.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/TestClient.java23
-rw-r--r--sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.java53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/resources/voidtest.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/pom.xml135
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldCallback.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldClientImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldServiceImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/auto-wsdl.composite44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/manual-wsdl.composite46
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldCallback.wsdl98
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldService.wsdl95
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/AutoWSDLTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/ManualWSDLTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/pom.xml135
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java92
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java93
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java98
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/SDOWSDLTest.composite344
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/WSDLTest.composite371
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl453
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/Hello.xsd20
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java169
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java146
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl2java/pom.xml188
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/AccountService.wsdl479
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/EchoService.wsdl64
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/EchoService.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl167
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/pom.xml202
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java95
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java91
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java98
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java47
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/AnObject.java62
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/MoreComplexObject.java53
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/SomeService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/SomeServiceImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/SDOWSDLTest.composite321
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/WSDLTest.composite350
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/some.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl453
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl131
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java173
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java150
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/SomeComponentTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/AnObject.java100
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingMoreComplexObject.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingMoreComplexObjectResponse.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingString.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingStringResponse.java79
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/MoreComplexObject.java126
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/ObjectFactory.java141
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/SomeService.java65
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/SomeServiceService.java81
-rw-r--r--sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/package-info.java21
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/pom.xml141
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java905
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java143
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java95
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java373
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java229
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java83
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java1219
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java109
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java97
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java140
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java83
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java273
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java256
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java266
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor21
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor21
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver20
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java148
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java145
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java207
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java88
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java108
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java161
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java97
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestAttributeProcessor.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestPolicyProcessor.java73
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestReadWriteUnkonwnElement.java60
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java213
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java147
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java160
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java91
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType34
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorExtended.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType31
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/NestedCalculator.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite128
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite129
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml97
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml175
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/LICENSE244
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/NOTICE12
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/pom.xml49
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-all.xsd33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd139
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd23
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd26
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-contributions.xsd45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-core.xsd348
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-definitions.xsd25
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd23
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd25
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd24
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd24
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-web.xsd24
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd23
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd23
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-policy.xsd77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca.xsd24
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-data-helper.xsd44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-das.xsd46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-data-xml.xsd45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/pom.xml76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java124
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java155
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java132
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java88
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java83
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java110
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java72
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java95
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java31
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultEndpointFactory.java32
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java167
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointFactory.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java27
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java49
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java66
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java74
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java27
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java67
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/AutomaticBinding.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilderExtension.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java34
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java80
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java1337
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java1149
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java146
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java165
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java99
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java223
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java118
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java110
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java224
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java96
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java194
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java127
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java38
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java752
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java273
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java132
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java213
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java264
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java88
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java114
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java121
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java82
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java174
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java93
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java113
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java115
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java153
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java93
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java105
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java96
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointFactoryImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java154
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java75
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java133
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java107
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java96
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EndpointFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/assembly-validation-messages.properties62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/assembly-validation-messages_it.properties30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java209
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java128
-rw-r--r--sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java229
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/pom.xml77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java133
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java108
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/resources/Calculator.composite59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/pom.xml93
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java73
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java116
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RemoteBindingHelper.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java236
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java154
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java223
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java113
-rw-r--r--sca-java-1.x/branches/sca-android/modules/binding-sca/src/test/resources/Calculator.composite52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/pom.xml76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java156
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java123
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java399
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java584
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java120
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java701
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java190
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties28
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java114
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.java86
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java126
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java58
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java81
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/repository/sample-calculator.jarbin0 -> 29164 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/test.composite22
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/test.ext0
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/pom.xml77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java58
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java161
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java158
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java385
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.java58
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java143
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java157
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.java110
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.java62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java148
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties22
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java262
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java103
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java105
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/pom.xml70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java131
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java217
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java72
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor20
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties23
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java141
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/pom.xml69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java86
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Constants.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java116
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java73
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java32
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultExport.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultImport.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java130
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java47
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java54
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java103
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java67
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java154
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultExportImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultImportImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java58
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java539
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java66
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java129
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java388
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java327
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java242
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultUnknownElementProcessor.java272
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java313
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.java95
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java99
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java256
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXAttributeProcessor.java224
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java143
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessor.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessorExtensionPoint.java29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java51
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java388
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java107
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultDelegatingModelResolver.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java80
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportModelResolver.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java66
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java114
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java201
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java103
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java125
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java58
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java94
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java128
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java137
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java118
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java38
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/contribution-validation-messages.properties31
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/pom.xml108
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java102
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java210
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java110
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java75
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java75
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java114
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java279
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java257
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java100
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java195
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java264
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java268
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCaseFIXME.java229
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/pom.xml116
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/doc/Context Model.emx673
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java38
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java114
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java180
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java34
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java112
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java124
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java60
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java362
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java91
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java38
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProvider.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderException.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderExtensionPoint.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java93
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java83
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java104
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java119
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java138
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java101
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java96
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java67
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java58
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ContextFactoryExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/test/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPointTestCase.java208
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/pom.xml107
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java154
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java1101
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java186
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.java167
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java101
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java139
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java111
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java155
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java163
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java378
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java605
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java320
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java403
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java105
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java133
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java216
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.java29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java66
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java265
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java89
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java54
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java47
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java268
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java47
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java151
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java74
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java113
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java190
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java110
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java516
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java103
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java109
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java194
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java248
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java236
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java87
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java245
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java72
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java54
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java200
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java290
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java83
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java86
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java66
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java159
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java32
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java195
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java198
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java235
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.java76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.java169
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java98
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java165
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java93
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java74
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/FailingWork.java50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyFailingRunnable.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnable.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnerListener.java154
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/Jsr237WorkSchedulerTestCase.java240
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TestWorkListener.java156
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManagerTestCase.java243
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TimeDelayWork.java87
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest22
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/LICENSE244
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/pom.xml108
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java104
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java74
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.java29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java268
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java306
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java38
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java95
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java51
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java81
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java78
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java133
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java163
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java452
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java94
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java103
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java182
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java89
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java401
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java113
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java945
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java97
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java79
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java262
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java139
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java79
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java329
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java165
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/LRUCache.java88
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java296
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java72
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java141
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java156
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java310
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java67
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java403
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java347
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java279
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java67
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java67
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java60
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java246
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java81
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java112
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java256
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java54
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java86
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java60
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java100
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java482
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java857
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java75
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java287
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java51
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java355
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java531
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding25
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer26
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java58
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java86
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java124
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java103
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java125
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java122
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java109
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java192
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java108
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java93
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java144
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java86
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java101
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java199
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd136
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml22
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/pom.xml82
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java197
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java257
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/definitions-xml-validation-messages.properties22
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java190
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java75
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml255
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/pom.xml70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.java82
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java34
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java309
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java87
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/pom.xml122
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverFactoryImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverImpl.java112
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml26
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/AddService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/AddServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/DivideServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/SubtractServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java212
-rw-r--r--sca-java-1.x/branches/sca-android/modules/endpoint/src/test/resources/Calculator.composite52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/NOTICE5
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/pom.xml50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java184
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultModuleActivatorExtensionPoint.java92
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java184
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java60
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivatorExtensionPoint.java53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/UtilityExtensionPoint.java54
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ContextClassLoaderServiceDiscoverer.java248
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscoverer.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java170
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.UtilityExtensionPoint18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ContextClassLoaderServiceDiscovererTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/pom.xml132
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java226
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java125
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java291
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java120
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java339
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java235
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java389
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java385
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java275
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java34
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java56
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java189
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java104
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java47
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java117
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java96
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java47
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/test.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/test.txt16
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/pom.xml81
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/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-android/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-android/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-android/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-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java67
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java325
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java55
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java51
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java47
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java34
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java106
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java404
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java199
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java204
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java183
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java126
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.java56
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java74
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java103
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java84
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java449
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java39
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java120
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.java77
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java51
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java32
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java185
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/pom.xml112
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java315
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/resources/impl-javaxml-validation-messages.properties23
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/AddService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/DivideService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java224
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite66
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml100
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml133
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/pom.xml84
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java60
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java198
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java75
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java89
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java141
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java53
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java224
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java86
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java168
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java85
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java126
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java192
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java51
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java80
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java83
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java82
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java70
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java132
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java34
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java615
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java40
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java577
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java292
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java208
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java49
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java137
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java184
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java169
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java192
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java157
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java167
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java152
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java201
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java94
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java144
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java117
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java129
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java310
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java562
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java148
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java145
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.java95
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java99
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java418
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java212
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java221
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java119
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java113
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java183
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java158
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/pom.xml103
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java85
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java149
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.java51
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.java62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.java49
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java119
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java392
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/resources/TestComposite.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/resources/TestNode.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/pom.xml93
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java54
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java109
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java104
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java97
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java196
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java119
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java587
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java81
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/pom.xml83
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java193
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/resources/interface-javaxml-validation-messages.properties22
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java100
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-android/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-android/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-android/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-android/modules/interface-java/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/pom.xml82
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java99
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java87
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java32
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java82
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java111
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java258
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java173
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java83
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java159
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java308
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java121
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java98
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java107
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java108
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java119
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java62
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java95
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java81
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java115
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java34
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java203
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java219
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java128
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java303
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java296
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java339
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java114
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java82
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java143
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java100
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java190
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java152
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.InterfaceContractMapper18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java380
-rw-r--r--sca-java-1.x/branches/sca-android/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/monitor/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/monitor/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/monitor/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/monitor/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java49
-rw-r--r--sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java102
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/pom.xml61
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java54
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java42
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java203
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java201
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/pom.xml154
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2FactoryImpl.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2Impl.java63
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java824
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java392
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBuilder.java258
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory17
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory17
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/hello/HelloWorld.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/hello/HelloWorldImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/Node2ImplTestCase.java119
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java119
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/test/resources/HelloWorld.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-impl/src/test/resources/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/pom.xml72
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/Contribution.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java179
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.java55
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java168
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java230
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java535
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.java44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java130
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/pom.xml76
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java248
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java75
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java417
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java487
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.java45
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor24
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties44
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java280
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java74
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml255
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/NOTICE5
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.java29
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java30
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java116
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.java71
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java89
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.java33
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java38
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java155
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.java43
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java89
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java88
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java151
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.java93
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java60
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java149
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java418
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java38
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java87
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.java91
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java64
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java38
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java111
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory18
-rw-r--r--sca-java-1.x/branches/sca-android/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/pom.xml149
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/META-INF/README1
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/pom.xml54
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java109
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/Constants.java34
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java41
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java67
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java68
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java66
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java65
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java50
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java39
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java38
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java35
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java69
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java59
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java46
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java52
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java36
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java51
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java37
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java57
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java49
-rw-r--r--sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java48
-rw-r--r--sca-java-1.x/branches/sca-android/pom.xml469
-rw-r--r--sca-java-1.x/branches/sca-android/samples/README306
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/README74
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/build.xml51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/pom.xml78
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java29
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java33
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java104
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java128
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java48
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java71
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java58
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java71
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java78
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java41
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java37
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java43
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java78
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java48
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java26
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java29
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java33
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java43
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java54
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java78
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java52
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor21
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd36
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/Echo.java29
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/resources/EchoBinding.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/resources/definitions.xml39
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/README104
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/binding-echo.pngbin0 -> 7846 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/binding-echo.svg174
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/build.xml75
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/java/echo/Echo.java29
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoBindingClient.java51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/resources/EchoBinding.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/README87
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/calculator.pngbin0 -> 20552 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/calculator.svg329
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/resources/Calculator.composite54
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/resources/CalculatorTest.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/README97
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/calculator.pngbin0 -> 20552 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/calculator.svg329
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/AddService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/AddServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorClient.java48
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/DivideServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/main/resources/Calculator.composite49
-rw-r--r--sca-java-1.x/branches/sca-android/samples/calculator/src/test/java/calculator/CalculatorTestCase.java56
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/README143
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/build.xml75
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/databinding-echo.pngbin0 -> 23907 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/databinding-echo.svg408
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/pom.xml82
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java74
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Echo.java32
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java45
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Interface1.java32
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Interface2.java36
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/resources/EchoDataBinding.composite58
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-android/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/README116
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/implementation-composite.pngbin0 -> 47415 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/implementation-composite.svg658
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/pom.xml72
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/java/composite/CompositeClient.java41
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/java/composite/Source.java24
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/java/composite/SourceCallback.java24
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/java/composite/SourceImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/java/composite/Target.java30
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/java/composite/TargetImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite2.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/resources/OuterComposite.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/README83
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/build.xml51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/pom.xml77
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUD.java54
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java50
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java37
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java90
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java117
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java79
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java75
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/test/resources/crud.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud/README113
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud/build.xml75
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud/implementation-crud.pngbin0 -> 4227 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud/implementation-crud.svg135
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java59
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud/src/main/resources/crud.composite30
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/README70
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/build.xml51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/pom.xml77
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java65
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java155
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java174
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java68
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java106
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java45
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory19
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java26
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java37
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType26
-rw-r--r--sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/samples/pom.xml62
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/README101
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/pom.xml65
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/simple-bigbank.pngbin0 -> 10202 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/simple-bigbank.svg200
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java43
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java26
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java26
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java54
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java43
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java43
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/Account.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/BigBank.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/StockQuote.composite31
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/README97
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/pom.xml65
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/simple-callback.pngbin0 -> 137 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/simple-callback.svg150
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyClient.java27
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java27
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java38
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/src/main/resources/simplecallback.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/README101
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/pom.xml65
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/Customer.java33
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/Retailer.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/Shipper.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java40
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/Warehouse.java28
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/main/resources/supplychain.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/supplychain.pngbin0 -> 3898 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/samples/supplychain/supplychain.svg228
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/META-INF/MANIFEST.MF6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/build.properties10
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/feature.xml61
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/META-INF/MANIFEST.MF6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/build.properties10
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/feature.xml63
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/META-INF/MANIFEST.MF6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/build.properties10
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/feature.xml67
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/META-INF/MANIFEST.MF6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/build.properties10
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/feature.xml67
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/META-INF/MANIFEST.MF6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/build.properties10
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/feature.xml67
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/META-INF/MANIFEST.MF6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/build.properties10
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/feature.xml67
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/META-INF/MANIFEST.MF32
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/NOTICE12
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/build.properties23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/exsd/runtimeClasspathContainerInitializer.exsd106
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/icons/t.gifbin0 -> 877 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/icons/tuscany.gifbin0 -> 5603 bytes
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseClasspathContainer.java253
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseClasspathContainerInitializer.java77
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseLibraryEntryPage.java74
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreClasspathContainer.java39
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreClasspathContainerInitializer.java38
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreLibraryEntryPage.java36
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainer.java40
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainerInitializer.java39
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainerInitializerExtensionPoint.java74
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/DomainManagerLauncherUtil.java255
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/NodeLauncherUtil.java244
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchConfigurationDelegate.java75
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchConfigurationTabGroup.java48
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchDomainManagerAction.java79
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchNodeFilter.java29
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchNodeShortcut.java88
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/log/LogUtil.java39
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewComponentTypeWizard.java53
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewComponentTypeWizardPage.java98
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewCompositeWizard.java53
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewCompositeWizardPage.java105
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/plugin.xml149
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/pom.xml123
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/src/main/assembly/jar.xml81
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-all.xsd34
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-ejb.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-jms.xsd135
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-sca.xsd23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-webservice.xsd26
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-contribution.xsd38
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-core.xsd350
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-definitions.xsd25
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-bpel.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-composite.xsd23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-cpp.xsd53
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-ejb.xsd25
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-java.xsd24
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-spring.xsd24
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-cpp.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-java.xsd23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-wsdl.xsd23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-policy.xsd76
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca.xsd22
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-atom.xsd41
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-dwr.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-http.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-jsonrpc.xsd40
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-notification.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rmi.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rss.xsd41
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-node.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-notification.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-osgi.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-resource.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-script.xsd43
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-widget.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-xquery.xsd42
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca.xsd45
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/META-INF/MANIFEST.MF32
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/NOTICE12
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/build.properties23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/org/apache/tuscany/sca/plugin/ejava/classpath/EJavaClasspathContainer.java39
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/org/apache/tuscany/sca/plugin/ejava/classpath/EJavaClasspathContainerInitializer.java38
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/plugin.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/pom.xml129
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/META-INF/MANIFEST.MF32
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/NOTICE12
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/build.properties23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/org/apache/tuscany/sca/plugin/manager/classpath/ManagerClasspathContainer.java39
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/org/apache/tuscany/sca/plugin/manager/classpath/ManagerClasspathContainerInitializer.java38
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/plugin.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/pom.xml129
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/META-INF/MANIFEST.MF32
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/NOTICE12
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/build.properties23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/org/apache/tuscany/sca/plugin/process/classpath/ProcessClasspathContainer.java39
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/org/apache/tuscany/sca/plugin/process/classpath/ProcessClasspathContainerInitializer.java38
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/plugin.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/pom.xml129
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/META-INF/MANIFEST.MF32
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/NOTICE12
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/build.properties23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/org/apache/tuscany/sca/plugin/web20/classpath/Web20ClasspathContainer.java39
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/org/apache/tuscany/sca/plugin/web20/classpath/Web20ClasspathContainerInitializer.java38
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/plugin.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/pom.xml129
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/META-INF/MANIFEST.MF32
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/NOTICE12
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/build.properties23
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/org/apache/tuscany/sca/plugin/webservice/classpath/WebServiceClasspathContainer.java39
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/org/apache/tuscany/sca/plugin/webservice/classpath/WebServiceClasspathContainerInitializer.java38
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/plugin.xml30
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/pom.xml129
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/NOTICE6
-rwxr-xr-xsca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/etc/generate-p2.sh29
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/pom.xml145
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/site.xml90
-rw-r--r--sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/src/main/assembly/updatesite.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java534
-rw-r--r--sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/pom.xml108
-rw-r--r--sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/src/main/java/org/apache/tuscany/sca/tools/incremental/build/plugin/IncrementalBuildMojo.java415
-rw-r--r--sca-java-1.x/branches/sca-android/tools/maven/pom.xml55
-rw-r--r--sca-java-1.x/branches/sca-android/tools/pom.xml47
-rw-r--r--sca-java-1.x/branches/sca-android/tutorials/pom.xml44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/pom.xml49
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/CService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/CServiceImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/component.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/nonuniquename.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/serviceelement.composite42
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/servicewithbinding.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/servicewithinterface.composite32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/zerocomponents.composite26
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/zeroimplelements.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java150
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/pom.xml49
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/AService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/BService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/AServiceImpl.java53
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/BServiceImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/AServiceImpl.componentType30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/BServiceImpl.componentType28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/typefile.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/test/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/CompomnentTypeFileTestCase.java111
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/assembly/pom.xml69
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/AService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/B1Service.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/B2Service.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/AServiceImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/B1ServiceImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/B2ServiceImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/resources/conversation.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/ConversationAnnotationTestCase.java91
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/pom.xml53
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/AService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/B2Service.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/BService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/CService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/AServiceImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/B2ServiceImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/BServiceImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/CServiceImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java50
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java179
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java66
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/AJass.config3
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/conversation.composite46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/singleprincipal.composite38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/ConversationAttributesAnnotationTestCase.java93
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/AService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr1Impl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr2Impl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr3Impl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr4Impl.java39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err1/AServiceErr1.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err2/AServiceErr2.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err3/AServiceErr3.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err4/AServiceErr4.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/proper/AService.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/DestroyAnnotationTestCase.java159
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/AService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/BService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/impl/AServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/impl/BServiceImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/resources/endsconversation.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/EndsConversationTestCase.java112
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/AService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr1Impl.java43
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr2Impl.java43
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr3Impl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr4Impl.java43
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceImpl.java53
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err1/AServiceErr1.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err2/AServiceErr2.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err3/AServiceErr3.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err4/AServiceErr4.composite28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/proper/AService.composite33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/InitAnnotationTestCase.java167
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/AService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/BService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/impl/AServiceImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/impl/BServiceImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/resources/oneway.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/OneWayAnnotationTestCase.java78
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/pom.xml69
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java82
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java240
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java116
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java87
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java87
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java87
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java88
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java88
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java88
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/resources/property.composite143
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java299
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java55
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java215
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java141
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/BServiceImpl.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/resources/ab.composite51
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java229
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/AService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/BService.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/CService.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/DService.java43
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/FService.java43
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/GService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/HService.java36
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/IService.java48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/JService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/KService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/LService.java41
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/MService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/NService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/OService.java41
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/AServiceImpl.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/BServiceImpl.java112
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/CServiceImpl.java114
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/DServiceImpl.java116
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/FServiceImpl.java116
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/GServiceImpl.java75
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/HServiceImpl.java86
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/IServiceImpl.java131
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/JServiceImpl.java78
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/KServiceImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/LServiceImpl.java83
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/MServiceImpl.java81
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/NServiceImpl.java85
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/OServiceImpl.java83
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/resources/scope.composite110
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/ScopeAnnotationTestCase.java477
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/AService.java34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/BService.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/CService.java31
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService1.java28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService2.java28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService3.java28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/EService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/FService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/GService1.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/GService2.java26
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/HService.java50
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/IService.java54
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/AObject.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/AServiceImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/BServiceImpl.java111
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/CServiceImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/DServiceImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/EServiceImpl.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/FServiceImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/FServiceImpl2.java26
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/GServiceImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/HServiceImpl.java105
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/IServiceImpl.java107
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/resources/service.composite82
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/ServiceAnnotationTestCase.java335
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/AComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/BCallback.java26
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/BComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/impl/AComponentImpl.java104
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/impl/BComponentImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/resources/callablereference.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/CallableReferenceTestCase.java118
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/AComponent.java42
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BComponent.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/CService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java124
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java121
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/BComponentImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/DComponentImpl.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite47
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java190
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/AComponent.java34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/BComponent.java39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/impl/AComponentImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/impl/BComponentImpl.java78
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/resources/conversation.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ConversationTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java26
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DException.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java128
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java50
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/resources/exception.composite44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java131
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java27
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java102
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java109
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/AComponent.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/BCallback.java26
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/BComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/CComponent.java27
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/AComponentImpl.java119
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/BComponentImpl.java74
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/CComponentImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/TestObject.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/resources/servicereference.composite39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/ServiceReferenceTestCase.java106
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/AService.java30
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/AServiceCallback.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/BService.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/BServiceCallback.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CService.java39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/Utilities.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/AServiceCallback.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/BService.java41
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/impl/AServiceImpl.java67
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/impl/BServiceImpl.java60
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/AServiceCallback.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/BService.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/CustomCallback.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/AServiceImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/BServiceImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/CustomCallbackImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/AServiceCallback.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/BService.java41
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/impl/AServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/impl/BServiceImpl.java60
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/AServiceImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/BServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/CServiceImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/AServiceCallback.java31
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/BService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/BServiceCallback.java31
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/CService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/AServiceImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/BServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/CServiceImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/CService.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/impl/BServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/impl/CServiceImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/AServiceCallback.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/AServiceCallback2.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/BService.java39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/BService2.java39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/impl/AServiceImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/impl/BServiceImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/BServiceCallback.java31
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/CService.java39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl2.java81
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl3.java74
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/CServiceImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-accessing.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-custom.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-id.composite34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-local.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-mixed.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-multi.composite35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless-callbackfieldnull.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless-callbackid.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless.composite41
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CallbackTestCase.java377
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/AService.java39
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/BService.java41
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java54
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/AServiceImpl.java69
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/BServiceImpl.java65
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java56
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/resources/conversation-id.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ConversationIDTestCase.java118
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/AService.java56
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/AServiceCallback.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/BService.java47
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/BServiceBusinessException.java53
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/CService.java34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/DService.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/AServiceImpl.java197
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/BServiceImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/CServiceImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/DServiceImpl.java78
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/resources/lifetime.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/LifetimeTestCase.java216
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/AService.java28
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/BService.java34
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/CService.java32
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/AServiceImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/BServiceImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/CServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/resources/parameters.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/ConversationParametersTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/conversation/pom.xml63
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/java-api/pom.xml70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/processcomments.rb198
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/utilities/pom.xml48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/utilities/src/main/java/org/apache/tuscany/sca/vtest/utilities/ServiceFinder.java104
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/AService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/BService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/CService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/DService.java45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/AServiceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/BServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/CServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/DServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/resources/nowsdl.composite61
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/NoWsdlDefaultBindingTestCase.java112
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/AService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/BService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/CService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/DService.java45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/AServiceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/BServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/CServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/DServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/resources/nowsdlmultisoapbindings.composite135
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/GeneratedWSDLTestCase.java162
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/NoWsdlMultiSoapBindingsTestCase.java213
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/pom.xml69
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/AService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP11.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP12.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/CService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/DService.java45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/AServiceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAP11Impl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAP12Impl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAPImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/CServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/DServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/resources/nowsdlpromoted.composite246
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/NoWsdlPromoted1TestCase.java85
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/NoWsdlPromoted2TestCase.java118
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/AService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP11.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP12.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/CService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/DService.java45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/AServiceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAP11Impl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAP12Impl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAPImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/CServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/DServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/resources/nowsdlsoapversion.composite205
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/GeneratedWSDLTestCase.java438
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/NoWsdlNoSoapVersionTestCase.java84
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/NoWsdlSoapVersionTestCase.java121
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/pom.xml68
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/AClientService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/AService.java29
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/impl/AClientServiceImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/impl/AServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/aservice.wsdl139
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/endpoint-uri-resolution.composite103
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/endpointreference.composite40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlbinding.composite45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlendpoint.composite37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlport.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlservice.composite43
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/EndpointReferenceTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/EndpointUriResolutionTestCase.java209
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlBindingTestCase.java68
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlEndpointTestCase.java66
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlPortTestCase.java66
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlServiceTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/AService.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/BService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/BService2.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/CService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/DService.java45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/AServiceImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/BService2Impl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/BServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/CServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/DServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/bservice.wsdl228
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/cservice.wsdl173
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/wsdlelement.binding.composite114
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/WsdlElementBindingTestCase.java190
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/pom.xml68
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/AService.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/BService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/BService2.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/CService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/DService.java45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/AServiceImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/BService2Impl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/BServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/CServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/DServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/bservice.wsdl238
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/cservice.wsdl173
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/wsdlelement.port.composite115
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/WsdlElementPortTestCase.java188
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/AService.java50
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/BService.java35
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/BService2.java33
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/CService.java37
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/DService.java45
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/AServiceImpl.java88
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/BService2Impl.java40
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/BServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/CServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/DServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/bservice.wsdl225
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/cservice.wsdl173
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/wsdlelement.service.composite145
-rw-r--r--sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/WsdlElementServiceTestCase.java235
4273 files changed, 322005 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-android/demos/pom.xml b/sca-java-1.x/branches/sca-android/demos/pom.xml
new file mode 100644
index 0000000000..e716ddb987
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/demos/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-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-demos</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Demos</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/pom.xml b/sca-java-1.x/branches/sca-android/distribution/features/core/pom.xml
new file mode 100644
index 0000000000..f96bd7c430
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/pom.xml
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-distribution-features</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-distribution-core</artifactId>
+ <name>Apache Tuscany SCA Core Distribution</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+
+ <!-- Assembly model -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Contribution model -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Core runtime -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Databindings -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Policy definitions -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Domain support -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-endpoint</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Core Extensibility -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Implementation types -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Interface models -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Node runtime -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-launcher</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Monitoring -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-monitor</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Policy models -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <!-- SCA API -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+
+ <!-- Default build profile that can be used to build the distro packages -->
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <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-1.4-SNAPSHOT</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- Profile that can be used to build the modules included in the distro -->
+ <profile>
+ <id>modules</id>
+ <modules>
+ <module>../../../modules/assembly</module>
+ <module>../../../modules/assembly-xml</module>
+ <module>../../../modules/assembly-xsd</module>
+ <module>../../../modules/binding-sca</module>
+ <module>../../../modules/binding-sca-xml</module>
+ <module>../../../modules/contribution</module>
+ <module>../../../modules/contribution-impl</module>
+ <module>../../../modules/contribution-java</module>
+ <module>../../../modules/contribution-namespace</module>
+ <module>../../../modules/contribution-xml</module>
+ <module>../../../modules/core</module>
+ <module>../../../modules/core-databinding</module>
+ <module>../../../modules/core-spi</module>
+ <module>../../../modules/databinding</module>
+ <module>../../../modules/databinding-jaxb</module>
+ <module>../../../modules/definitions</module>
+ <module>../../../modules/definitions-xml</module>
+ <module>../../../modules/endpoint</module>
+ <module>../../../modules/extensibility</module>
+ <module>../../../modules/host-http</module>
+ <module>../../../modules/implementation-java</module>
+ <module>../../../modules/implementation-java-runtime</module>
+ <module>../../../modules/implementation-java-xml</module>
+ <module>../../../modules/implementation-node</module>
+ <module>../../../modules/implementation-node-runtime</module>
+ <module>../../../modules/interface</module>
+ <module>../../../modules/interface-java</module>
+ <module>../../../modules/interface-java-jaxws</module>
+ <module>../../../modules/interface-java-xml</module>
+ <module>../../../modules/monitor</module>
+ <module>../../../modules/node-api</module>
+ <module>../../../modules/node-impl</module>
+ <module>../../../modules/node-launcher</module>
+ <module>../../../modules/policy</module>
+ <module>../../../modules/policy-xml</module>
+ <module>../../../modules/sca-api</module>
+ <module>../../../modules/xsd</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/assembly/bin.xml b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/assembly/bin.xml
new file mode 100644
index 0000000000..200cc91080
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/assembly/bin.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.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>tuscany-sca-1.4-SNAPSHOT</baseDirectory>
+ <formats>
+ <!--
+ <format>dir</format>
+ <format>tar.gz</format>
+ -->
+ <format>zip</format>
+ </formats>
+
+ <componentDescriptors>
+ <componentDescriptor>src/main/components/bin-common.xml</componentDescriptor>
+ <componentDescriptor>src/main/components/bin-dependencies.xml</componentDescriptor>
+ <componentDescriptor>src/main/components/bin-samples.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/assembly/src.xml b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/assembly/src.xml
new file mode 100644
index 0000000000..6fe3e2dae1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/assembly/src.xml
@@ -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.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>src</id>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>tuscany-sca-1.4-SNAPSHOT-src</baseDirectory>
+ <formats>
+ <!--
+ <format>dir</format>
+ <format>tar.gz</format>
+ -->
+ <format>zip</format>
+ </formats>
+
+ <componentDescriptors>
+ <componentDescriptor>src/main/components/src-common.xml</componentDescriptor>
+ <componentDescriptor>src/main/components/src-modules.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-common.xml b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-common.xml
new file mode 100644
index 0000000000..c69e8e3699
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-common.xml
@@ -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.
+-->
+<component>
+ <fileSets>
+
+ <!-- Add the text files to the top-level directroy -->
+ <fileSet>
+ <directory>src/main/release</directory>
+ <outputDirectory></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></outputDirectory>
+ <includes>
+ <include>INSTALL</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+</component>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-dependencies.xml b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-dependencies.xml
new file mode 100644
index 0000000000..a1bde3932b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-dependencies.xml
@@ -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.
+-->
+<component>
+ <dependencySets>
+
+ <!-- Add all the Tuscany modules to the modules directory -->
+ <dependencySet>
+ <outputDirectory>modules</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:*</include>
+ </includes>
+ </dependencySet>
+
+ <!-- Add all the dependent jars to the lib directory -->
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.tuscany.sca:*</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+
+</component>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-filtered-dependencies.xml b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-filtered-dependencies.xml
new file mode 100644
index 0000000000..d009672310
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-filtered-dependencies.xml
@@ -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.
+-->
+<component>
+ <dependencySets>
+
+ <!-- Add all the Tuscany modules to the modules directory -->
+ <dependencySet>
+ <outputDirectory>modules</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:*</include>
+ </includes>
+ <excludes>
+ <exclude>org.apache.tuscany.sca:tuscany-assembly</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-assembly-xml</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-assembly-xsd</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-binding-sca</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-binding-sca-xml</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-contribution</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-contribution-impl</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-contribution-java</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-contribution-namespace</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-contribution-xml</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-core</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-core-databinding</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-core-spi</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-databinding</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-databinding-jaxb</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-definitions</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-definitions-xml</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-endpoint</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-extensibility</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-host-http</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-implementation-java</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-implementation-java-runtime</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-implementation-java-xml</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-implementation-node</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-implementation-node-runtime</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-interface</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-interface-java</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-interface-java-jaxws</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-interface-java-xml</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-monitor</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-node-api</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-node-impl</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-node-launcher</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-policy</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-policy-xml</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-sca-api</exclude>
+ <exclude>org.apache.tuscany.sca:tuscany-xsd</exclude>
+ </excludes>
+ </dependencySet>
+
+ <!-- Add all the dependent jars to the lib directory -->
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>asm:asm-all</exclude>
+ <exclude>cglib:cglib-nodep</exclude>
+ <exclude>com.sun:tools</exclude>
+ <exclude>com.sun.xml.bind:jaxb-impl</exclude>
+ <exclude>javax.activation:activation</exclude>
+ <exclude>javax.annotation:jsr250-api</exclude>
+ <exclude>javax.jws:jsr181-api</exclude>
+ <exclude>javax.xml.bind:jaxb-api</exclude>
+ <exclude>javax.xml.stream:stax-api</exclude>
+ <exclude>javax.xml.ws:jaxws-api</exclude>
+ <exclude>org.apache.geronimo.specs:geronimo-commonj_1.1_spec</exclude>
+ <exclude>org.apache.ws.commons.schema:XmlSchema</exclude>
+ <exclude>org.codehaus.woodstox:wstx-asl</exclude>
+ <exclude>org.apache.tuscany.sca:*</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-samples.xml b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-samples.xml
new file mode 100644
index 0000000000..fbe46a296c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/bin-samples.xml
@@ -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.
+-->
+<component>
+ <fileSets>
+
+ <!-- Add samples to the samples directory -->
+ <fileSet>
+ <directory>../../../samples</directory>
+ <outputDirectory>samples</outputDirectory>
+ <includes>
+ <include>calculator/**/*</include>
+ <include>calculator-lean/**/*</include>
+ <include>binding-echo/**/*</include>
+ <include>binding-echo-extension/**/*</include>
+ <include>databinding-echo/**/*</include>
+ <include>implementation-composite/**/*</include>
+ <include>implementation-crud/**/*</include>
+ <include>implementation-crud-extension/**/*</include>
+ <include>implementation-pojo-extension/**/*</include>
+ <include>loanapplication/**/*</include>
+ <include>simple-bigbank/**/*</include>
+ <include>simple-callback/**/*</include>
+ <include>supplychain/**/*</include>
+ </includes>
+ <excludes>
+ <!-- General file/folders to exclude -->
+ <exclude>**/.*</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>**/*.log</exclude>
+
+ <!-- Sample specific files/folders to exclude -->
+ <exclude>pom.xml</exclude>
+ <exclude>**/target</exclude>
+ <exclude>**/target/**/*</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/src-common.xml b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/src-common.xml
new file mode 100644
index 0000000000..002df33fc7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/src-common.xml
@@ -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.
+-->
+<component>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/release</directory>
+ <outputDirectory></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></outputDirectory>
+ <includes>
+ <include>BUILDING</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+</component>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/src-modules.xml b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/src-modules.xml
new file mode 100644
index 0000000000..5b12e0b784
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/components/src-modules.xml
@@ -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.
+-->
+<component>
+ <fileSets>
+
+ <!-- Add module sources to the modules directory -->
+ <fileSet>
+ <directory>../../../modules</directory>
+ <outputDirectory>modules</outputDirectory>
+ <includes>
+ <include>assembly/**/*</include>
+ <include>assembly-xml/**/*</include>
+ <include>assembly-xsd/**/*</include>
+ <include>binding-sca/**/*</include>
+ <include>binding-sca-xml/**/*</include>
+ <include>contribution/**/*</include>
+ <include>contribution-impl/**/*</include>
+ <include>contribution-java/**/*</include>
+ <include>contribution-namespace/**/*</include>
+ <include>contribution-xml/**/*</include>
+ <include>core/**/*</include>
+ <include>core-databinding/**/*</include>
+ <include>core-spi/**/*</include>
+ <include>databinding/**/*</include>
+ <include>databinding-jaxb/**/*</include>
+ <include>definitions/**/*</include>
+ <include>definitions-xml/**/*</include>
+ <include>endpoint/**/*</include>
+ <include>extensibility/**/*</include>
+ <include>host-http/**/*</include>
+ <include>implementation-java/**/*</include>
+ <include>implementation-java-runtime/**/*</include>
+ <include>implementation-java-xml/**/*</include>
+ <include>implementation-node/**/*</include>
+ <include>implementation-node-runtime/**/*</include>
+ <include>interface/**/*</include>
+ <include>interface-java/**/*</include>
+ <include>interface-java-jaxws/**/*</include>
+ <include>interface-java-xml/**/*</include>
+ <include>monitor/**/*</include>
+ <include>node-api/**/*</include>
+ <include>node-impl/**/*</include>
+ <include>node-launcher/**/*</include>
+ <include>policy/**/*</include>
+ <include>policy-xml/**/*</include>
+ <include>sca-api/**/*</include>
+ <include>xsd/**/*</include>
+ </includes>
+ <excludes>
+ <!-- General file/folders to exclude -->
+ <exclude>**/.*</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>**/*.log</exclude>
+
+ <!-- Specific files/folders to exclude -->
+ <exclude>pom.xml</exclude>
+ <exclude>**/target</exclude>
+ <exclude>**/target/**/*</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/CHANGES b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/CHANGES
new file mode 100644
index 0000000000..3de7358ec6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/CHANGES
@@ -0,0 +1,431 @@
+Changes With Apache Tuscany SCA 1.2 (incubating) April 2008
+===========================================================
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-2027
+ * TUSCANY-1999
+ * TUSCANY-2037
+ * TUSCANY-2034
+ * TUSCANY-2038
+ * TUSCANY-2043
+ * TUSCANY-2046
+ * TUSCANY-2047
+ * TUSCANY-2028
+ * TUSCANY-1873
+ * TUSCANY-2049
+ * TUSCANY-2035
+ * TUSCANY-1206
+ * TUSCANY-2036
+ * TUSCANY-1771
+ * TUSCANY-2013
+ * TUSCANY-1926
+ * TUSCANY-1917
+ * TUSCANY-1949
+ * TUSCANY-1941
+ * TUSCANY-2045
+ * TUSCANY-2057
+ * TUSCANY-2055
+ * TUSCANY-2056
+ * TUSCANY-2072
+ * TUSCANY-2047
+ * TUSCANY-2073
+ * TUSCANY-1977
+ * TUSCANY-2075
+ * TUSCANY-1894
+ * TUSCANY-2079
+ * TUSCANY-2078
+ * TUSCANY-2080
+ * TUSCANY-2068
+ * TUSCANY-1950
+ * TUSCANY-2077
+ * TUSCANY-2056
+ * TUSCANY-2088
+ * TUSCANY-2086
+ * TUSCANY-2094
+ * TUSCANY-2106
+
+ Features and/or Enhancements
+
+ * Core
+ - Interceptor Enhancements
+ - Phase-based interceptor ordering to allow contribution of new interceptors and also define the order in witch they should be invoked
+ - Pass-by-reference SPI to allow interceptors to indicate if they support pass-by-reference
+ - PolicyProvider SPIs to allow extensions to plugin policy interceptors
+ - Support for JAXWS annotations and mapping of faults to Java exceptions according to JAXWS specification
+ - Improvement of contribution service to allow it to be used outside of the runtime environment
+ - Support for Contribution Import/Export resource
+ - Enhanced Distributed Domain story using Workspace
+ - Implementation of a SCA domain allowing a system administrator to manage contributions, composites and sca nodes that run these composites
+ - Set of core services providing management capabilities
+ - Administration web interface
+ - This is a work in progress and you can see it in action in samples/calculator-distributed. Other samples that use distributed operation are yet to move over to the workspace.
+ - Enhanced support for SCA Policy spec
+ - Ability to apply external policy definitions to a SCA composition
+ - Ability to spread policy definitions to multiple definitions.xml files available across the sca domain
+ - Bug fixes
+ - Improvements of http binding to support servlet components
+ - Enable Tuscany to run inside an OSGi runtime
+
+ * Web 2.0 Extensions
+ - Enhancements to implementation.widget (support for properties)
+ - New atom binding based on Apache Abdera
+ - Refactoring of rss-rome binding
+ * Other Extensions
+ - Binding JMS
+ - greatly simplified the use of the JMS binding, support locating JMS resources from JNDI, and better compliance with the SCA JMS binding spec
+ - see the doc page for more details: http://incubator.apache.org/tuscany/sca-java-bindingjms.html
+ - Enhancements to Binding RMI
+ - Support shared RMI registry and use 999x as the ports in test case to avoid 1099 conflict
+ - Enhancements to Groovy extension
+ - Support for 'native' groovy classes
+ - Enhancements to OSGi bundle contributions
+ - Support Bundle URLs to be added as contributions
+
+ * Tools
+ - Eclipse plugin providing a Tuscany runtime Library and Tuscany launcher in Eclipse environment
+ - An updatesite is also available to facilitate the plugin installation using the Eclipse update manager
+
+ * Samples/Tutorial/Demos
+ - calculator-distributed migrated to use new Tuscany Distributed Workspace
+ - sample-calculator-ws-secure-webapp
+ - sample-helloworld-jms-webapp
+ - new jms samples
+ - improve bigbank demo to include support for policies
+ - tutorial store changes
+ - use of import/export
+ - development of contribution without requiring dependencies on the Tuscany runtime
+ - usage of new sca domain infrastructure
+
+ * Testing
+ - Web Container Testing Framework integrated with (Tomcat, Jetty, Geronimo and Websphere)
+
+
+Changes With Apache Tuscany SCA 1.1 (incubating) January 2008
+===============================================================
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-1939
+ * TUSCANY-1914
+ * TUSCANY-1854
+ * TUSCANY-1931
+ * TUSCANY-1547
+ * TUSCANY-1909
+ * TUSCANY-1919
+ * TUSCANY-1930
+ * TUSCANY-1806
+ * TUSCANY-1804
+ * TUSCANY-1916
+ * TUSCANY-1913
+ * TUSCANY-1834
+ * TUSCANY-1857
+ * TUSCANY-1687
+ * TUSCANY-1801
+ * TUSCANY-1742
+ * TUSCANY-1762
+ * TUSCANY-1945
+ * TUSCANY-1595
+ * TUSCANY-1594
+ * TUSCANY-1849
+ * TUSCANY-1836
+ * TUSCANY-1934
+ * TUSCANY-1902
+ * TUSCANY-1608
+ * TUSCANY-1943
+ * TUSCANY-1896
+ * TUSCANY-1626
+ * TUSCANY-1797
+ * TUSCANY-1601
+ * TUSCANY-1415
+
+- Better JMS support
+ * binding.jms supporting point to point text based messaging only
+ * New SOAP/JMS sample (helloworld-ws-reference/service-jms)
+
+- Improvements in PolicyFramework Support
+ * Support for policy specifications on operation elements in a composite definition
+ * Separate sample (calculator-implementation-policies) to demonstrate use of Implementation Policies
+ (uses logging and JAAS Authentication)
+
+- Modeling of client side java script components
+ * See implementation.widget
+
+- Evolving support for doman API suggested by assembly spec including a standalone node and nodes running
+ connected together in a domain. This is still experimental.
+
+- Class loading and OSGI improvements
+ * Enable Tuscany to be run in a multi-classloader environment including inside OSGi. By default,
+ Tuscany continues to run using a single CLASSPATH-based classloader.
+ * Contributions no longer need to be in the CLASSPATH. All import/export dependencies across contributions should be
+ explicitly specified (as described in the spec).
+
+- JAXB based POJO transformations
+
+Changes With Apache Tuscany SCA 1.0.1 (incubating) November 2007
+================================================================
+
+The Tuscany SCA Java 1.0.1 is mainly a bug-fix release. It also comes with some improvements as listed below.
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-1848
+ * TUSCANY-1857
+ * TUSCANY-1859
+ * TUSCANY-1801
+ * TUSCANY-1823
+ * TUSCANY-1839
+ * TUSCANY-1814
+ * TUSCANY-1818
+ * TUSCANY-1834
+ * TUSCANY-1637
+ * TUSCANY-1826
+ * TUSCANY-1823
+ * TUSCANY-1819
+ * TUSCANY-1821
+ * TUSCANY-1822
+ * TUSCANY-1806
+ * TUSCANY-1808
+ * TUSCANY-1756
+ * TUSCANY-1757
+
+- Fix build issues with Maven 2.0.7 and JDK 6
+
+- Reduce memory consumption for WSDLs that import large XSDs
+
+- Add more logging statements for better servicibility
+
+- Add an extension point to allow extensions to plug-in extension schemas.
+
+- Add a demo application to showcase XML integration story
+
+- Improve in databinding framework
+ * Add support for JSON Databindings and other refactoring
+ * Set databinding for introspected data type and enhance the checking of wrapper style
+ * Improve the tree-based XMLStreamReader and convert Bean & DOM to use this approach
+ * Add a tree-iterator based XMLStreamReader base impl
+ * Add default element info to java interface
+ * Rename Interface.setDefaultDataBinding to resetDataBinding
+
+- Limit the method injection to setters and allow the setter annotation to override field annotation
+
+- Evolving support in Intent and Policy handling
+ * Add support for policies in implementation
+ * Fix the algorithm for macthing policySets defined on bindings for the wire
+ * Add policy intent for implementation.java
+ * Extend java implementation type to recognize and apply policies, adding util support for this in Policy module
+ * Add policy module for logging
+
+- Evolving development in the SCA Domain/Node
+
+- Update NOTICE files with missing dependencies
+
+
+Changes With Apache Tuscany SCA 1.0 (incubating) September 2007
+===============================================================
+
+- Tuscany Java SCA now implements V1.0 of the core SCA
+ specifications
+ SCA Assembly Model V1.0
+ SCA Java Common Annotations and APIs V1.0
+ SCA Java Component Implementation V1.0
+ SCA Web Services Binding V1.0
+ Including callbacks, conversations and callable references
+
+
+- Support for ws-security configurable in the web services binding
+ thro Tuscany SCA policy intents and policysets using the policy framework
+ introduced in the last release.
+
+ Note : This release supports specifications of policies around axis2
+ config params - see helloworld-ws-service-secure sample. The policy
+ intents that have been tested are authentication, integrity and
+ confidentiality.
+ There is no sample or test that exercises confidentiality since there
+ are some unresolved licensing issue around bouncycastle libraries.
+ However, users who are not encumbered by the bouncycastle license
+ restrictions can try the 'confidentiality' intent. See FAQ -
+ http://incubator.apache.org/tuscany/tuscany-sca-java-faq.html
+
+ This release does not include support for WS-Policy
+ attachments in Tuscany Policysets for ws-security.
+
+
+- An XQuery component implementation type
+ implementation-xquery
+
+
+- A Databinding for converting data to and from nodes for XQuery
+ processing
+ databinding-saxon
+
+
+- OSGI support has been extended to allow Tuscany contributions
+ packaged as OSGI bundles hence taking advantage of OSGI's bundle
+ loading an dependency management capabilities
+
+
+- A BPEL component implementation type experimental implementation
+based on SCA BPEL Client and Implementation V1.0. At the moment only
+supports BPEL process as services.
+ implementation-bpel
+
+
+- The distributed runtime implementation has been separated out
+ into
+ *) domain
+ *) node
+ It is now wrapped by a SCADomain interface as is the standalone
+ runtime.
+
+ Note: This release does not include support for WebApp host deployment
+ for a distributed SCA Domain
+
+
+
+- The web service binding will now generate WSDL automatically
+ based on the service interface if no WSDL is provided
+
+
+- A new "store" sample and associated document show how a
+ simple store front application can be constructed
+ samples/store
+
+- The following features of this release are still experimental:
+ - BPEL implementation type, integrating with Apache ODE
+ - OSGI implementation type, integrating with Apache Felix
+ - XQuery implementation type
+
+
+
+Changes With Apache Tuscany SCA 0.99 (incubating) August 2007
+=============================================================
+
+The following are the significant additions to release 0.99
+over and above all of what was offered in release 0.91.
+
+- A version of the default sca binding that works between
+ components runing in separate Java virtual machines
+ binding-sca-axis
+
+- A simple node implementation and a service discovery
+ function for running sca applications distributed
+ across more than one node
+ distributed
+ distributed-impl
+
+- integration with OSGi runtimes is now supported with
+ a new implementation-osgi component type
+
+- PUB/SUB interactions are now supported by using new
+ notification binding and implementation types, and
+ samples demonstrating the feature.
+
+- The Tuscany runtime now has a policy framework supporting
+ the SCA policy specification
+
+- the endpoint URIs used by SCA bindings has been rationalized
+ and now follows the SCA Assembly specification
+
+- binding-ajax has been renamed to binding-dwr
+
+Changes With Apache Tuscany SCA 0.91 (incubating) July 2007
+===========================================================
+
+The following are the significant additions to release 0.91
+over and above all of what was offered in release 0.90.
+
+
+- Enhancements to support multiple contributions to the SCA Domain
+
+- The inclusion of a alternative simplified extensions-helper
+SPI layer to faciliate rapid development of extensions
+
+- More Implementation Extenstions
+ Spring
+ WebResource
+
+- More Binding Extensions
+ AJAX
+ EJB
+ RSS/ATOM Feeds
+
+- Demos that demonstrate the use of a mix of extensions
+ alert-aggregator-webapp
+ bigbank-account
+ bigbank-calculator
+ bigbank-stockquote
+
+
+- Samples
+ Samples to demostrate use of Spring, Resource, AJAX extensions
+
+Changes With Apache Tuscany SCA 0.90 (incubating) June 2007
+===========================================================
+
+- 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-android/distribution/features/core/src/main/release/DISCLAIMER b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/DISCLAIMER
new file mode 100644
index 0000000000..a65af91c5a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/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-android/distribution/features/core/src/main/release/README b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/README
new file mode 100644
index 0000000000..4d83dcfde9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/README
@@ -0,0 +1,19 @@
+Apache Tuscany SCA 1.2 (incubating) April 2008 README
+=====================================================
+
+Welcome to the Tuscany SCA 1.2 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-android/distribution/features/core/src/main/release/RELEASE_NOTES b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/RELEASE_NOTES
new file mode 100644
index 0000000000..a04ef5c553
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/RELEASE_NOTES
@@ -0,0 +1,83 @@
+Apache Tuscany SCA 1.2 (incubating) April 2008 Release Notes
+============================================================
+
+Apache Tuscany provides a runtime based on the Service Component
+Architecture. SCA is a set of specifications aimed at simplifying SOA
+Application Development which are being standardized at OASIS as part
+of Open Composite Services Architecture (Open CSA) - http://www.oasis-opencsa.org/.
+
+Overview
+--------
+
+ The Apache Tuscany SCA 1.2 release includes implementations of the
+ main SCA specifications including:
+
+ SCA Assembly Model V1.0
+ SCA Policy Framework V1.0
+ SCA Java Common Annotations and APIs V1.0
+ SCA Java Component Implementation V1.0
+ SCA Spring Component Implementation V1.0
+ SCA BPEL Client and Implementation V1.0
+ SCA Web Services Binding V1.0
+ SCA EJB Session Bean Binding V1.0
+
+ It also includes implementations of many features not yet defined
+ by SCA specifications, including:
+
+ - SCA bindings for Direct Web Remoting, RSS and ATOM Feeds,
+ HTTP resources, JSON-RPC, PUB/SUB Notifications, and RMI.
+ - SCA implementation types for OSGI, XQuery, BPEL, Widget and various
+ dynamic languages including Groovy, Javascript, Python and Ruby
+ - Databindings for Service Data Objects (SDO), JAXB, XmlBeans,
+ Axis2's AXIOM, JSON, SAXON, DOM, SAX and StAX
+
+ The Tuscany SCA Runtime can be configured as a single node SCA domain or
+ as an SCA domain distributed across multiple nodes.
+ In addition Tuscany SCA supports the following host-deployment options: -
+ - running standalone
+ - running with distributed nodes across multiple JVMs
+ - running with embedded Jetty or Tomcat
+ - running as part of a standard web application
+
+ The Wepapp samples included in this release have been tried and tested on
+ - Tomcat 5.5.20 and Tomcat 6.0.14
+ - Jetty 6.1.3
+ - Geronimo 2.0.2 Tomcat6 jee5
+ - WebSphere 6.1 fix pack 9
+
+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 list archives:
+
+ 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
+
+To join the project's mailing lists follow the instructions at:
+
+ http://incubator.apache.org/tuscany/mailing-lists.html
+
+To find out more about OASIS Open CSA go to:
+
+ http://www.oasis-opencsa.org.
+
+Apache Tuscany welcomes your help. Any contribution, including code,
+testing, improving the documentation, or bug reporting is always
+appreciated.
+
+Thank you for using Apache Tuscany!
+
+- The Tuscany Team.
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/INSTALL b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/INSTALL
new file mode 100644
index 0000000000..2da53a2b44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/INSTALL
@@ -0,0 +1,27 @@
+Installing the Apache Tuscany SCA 1.2 (incubating) April 2008 Release binary distribution
+=========================================================================================
+
+Unzip Tuscany binary distribution archive and you get the following:
+
+tuscany-sca-1.1-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
+ README - readme for the release
+ RELEASE_NOTES - description of this release
+ CHANGES - A note of the major changes in this release
+
+ /demos - Demo applications showcasing the use of Apache Tuscany
+
+ /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
+
+ /tutorial - The store tutorial, see the README in that directory
+
+
+
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/LICENSE b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/LICENSE
new file mode 100644
index 0000000000..5e1f585d46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/LICENSE
@@ -0,0 +1,2366 @@
+
+ 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.
+
+===============================================================================
+
+The following components come under Apache Software License 1.1
+
+ commons-discovery-0.2.jar
+ commons-primitives-1.0.jar
+
+The following components come under Apache Software License 2.0
+
+ abdera-core-0.3.0-incubating.jar
+ abdera-i18n-0.3.0-incubating.jar
+ abdera-parser-0.3.0-incubating.jar
+ activeio-2.0-r118.jar
+ activeio-core-3.0.0-incubator.jar
+ apache-activemq-4.1.1.jar
+ addressing-1.3.mar
+ annogen-0.1.0.jar
+ annotations-api-6.0.14.jar
+ aopalliance-1.0.jar
+ axiom-api-1.2.5.jar
+ axiom-dom-1.2.5.jar
+ axiom-impl-1.2.5.jar
+ axis2-adb-1.3.jar
+ axis2-codegen-1.3.jar
+ axis2-java2wsdl-1.3.jar
+ axis2-kernel-1.3.jar
+ axis2-mtompolicy-1.3.jar
+ bsf-all-3.0-beta2.jar
+ catalina-6.0.14.jar
+ cglib-nodep-2.1_3.jar
+ commons-collections-3.1.jar
+ commons-codec-1.3.jar
+ commons-fileupload-1.1.1.jar
+ commons-httpclient-3.0.1.jar
+ commons-io-1.2.jar
+ commons-jexl-1.1.jar
+ commons-lang-2.1.jar
+ commons-logging-1.1.jar
+ coyote-6.0.14.jar
+ derby-10.1.3.1.jar
+ geronimo-activation_1.1_spec-1.0-M1.jar
+ geronimo-common-1.2-beta.jar
+ geronimo-commonj_1.1_spec-1.0.jar
+ geronimo-connector-1.2-beta.jar
+ geronimo-core-1.2-beta.jar
+ geronimo-deployment-1.2-beta.jar
+ geronimo-ejb_3.0_spec-1.0.jar
+ geronimo-interceptor-1.2-beta.jar
+ geronimo-j2ee-1.2-beta.jar
+ geronimo-j2ee-connector_1.5_spec-1.1.jar
+ geronimo-j2ee-jacc_1.0_spec-1.1.jar
+ geronimo-j2ee-management_1.0_spec-1.1.jar
+ geronimo-javamail_1.4_spec-1.0-M1.jar
+ geronimo-jms_1.1_spec-1.1.jar
+ geronimo-jpa_3.0_spec-1.0.jar
+ geronimo-jta_1.0.1B_spec-1.0.jar
+ geronimo-kernel-1.2-beta.jar
+ geronimo-management-1.2-beta.jar
+ geronimo-naming-1.2-beta.jar
+ geronimo-security-1.2-beta.jar
+ geronimo-spec-j2ee-connector-1.5-rc4.jar
+ geronimo-spec-jta-1.0.1B-rc4.jar
+ geronimo-system-1.2-beta.jar
+ geronimo-transaction-1.2-beta.jar
+ geronimo-util-1.2-beta.jar
+ httpcore-4.0-alpha5.jar
+ httpcore-nio-4.0-alpha5.jar
+ httpcore-niossl-4.0-alpha5.jar
+ jettison-1.0-RC2.jar
+ jetty-6.1.7.jar
+ jetty-util-6.1.7.jar
+ json-rpc-1.0.jar
+ juli-6.0.14.jar
+ log4j-1.2.12.jar
+ logkit-1.0.1.jar
+ neethi-2.0.2.jar
+ ode-bpel-api-1.1.jar
+ ode-bpel-compiler-1.1.jar
+ ode-bpel-dao-1.1.jar
+ ode-bpel-epr-1.1.jar
+ ode-bpel-obj-1.1.jar
+ ode-bpel-runtime-1.1.jar
+ ode-bpel-schemas-1.1.jar
+ ode-bpel-store-1.1.jar
+ ode-dao-jpa-1.1.jar
+ ode-dao-jpa-ojpa-derby-1.1.zip
+ ode-jacob-1.1.jar
+ ode-jacob-ap-1.1.jar
+ ode-scheduler-simple-1.1.jar
+ ode-utils-1.1.jar
+ openjpa-all-0.9.7-incubating.jar
+ openjpa-persistence-0.9.7-incubating.jar
+ org.apache.felix.bundlerepository-1.0.2.jar
+ org.apache.felix.framework-1.0.3.jar
+ org.apache.felix.main-1.0.3.jar
+ org.apache.felix.shell-1.0.0.jar
+ org.apache.felix.shell.tui-1.0.0.jar
+ rampart-core-1.3.jar
+ rampart-policy-1.3.jar
+ rampart-trust-1.3.jar
+ regexp-1.3.jar
+ spring-beans-2.0.6.jar
+ spring-context-2.0.6.jar
+ spring-core-2.0.6.jar
+ tranql-connector-1.1.jar
+ tuscany-sdo-api-r2.1-1.0-incubating.jar
+ tuscany-sdo-impl-1.0-incubating.jar
+ tuscany-sdo-lib-1.0-incubating.jar
+ tuscany-sdo-tools-1.0-incubating.jar
+ woden-1.0-incubating-M7b.jar
+ wss4j-1.5.3.jar
+ wstx-asl-3.2.1.jar
+ xalan-2.7.0.jar
+ xbean-naming-2.7.jar
+ xercesImpl-2.8.1.jar
+ xml-apis-1.3.03.jar
+ xmlbeans-2.3.0.jar
+ xml-resolver-1.1.jar
+ xmlsec-1.4.0.jar
+ XmlSchema-1.3.2.jar
+
+===============================================================================
+axion-1.0-M3-dev.jar
+
+Copyright (c) 2002-2003 Axion Development Team. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the following
+ disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+3. The names "Tigris", "Axion", nor the names of its contributors may
+ not be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+4. Products derived from this software may not be called "Axion", nor
+ may "Tigris" or "Axion" appear in their names 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 "Axion Development Team" is defined to be:
+
+ * Chuck Burdick
+ * James Burke
+ * Morgan Delagrange
+ * Geir Magnusson Jr.
+ * Martin Poeschl
+ * Steve Polyak
+ * Daniel Rall
+ * Ahimanikya Satapathy
+ * Doug Sale
+ * James Strachan
+ * Rodney Waldhoff
+ * Jason van Zyl
+
+License changes are to be determined by a simple majority vote of the
+Axion Development Team.
+
+===============================================================================
+dom4j-1.6.1.jar
+
+Copyright 2001-2005 (C) MetaStuff, Ltd. 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 "DOM4J" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of MetaStuff, Ltd. For written permission,
+ please contact dom4j-info@metastuff.com.
+
+4. Products derived from this Software may not be called "DOM4J"
+ nor may "DOM4J" appear in their names without prior written
+ permission of MetaStuff, Ltd. DOM4J is a registered
+ trademark of MetaStuff, Ltd.
+
+5. Due credit should be given to the DOM4J Project -
+ http://www.dom4j.org
+
+THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. 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
+METASTUFF, LTD. 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.
+
+===============================================================================
+
+The EMF jars;
+ codegen-2.2.3.jar
+ codegen-ecore-2.2.3.jar
+ common-2.2.3.jar
+ ecore-2.2.3.jar
+ ecore-change-2.2.3.jar
+ ecore-xmi-2.2.3.jar
+ xsd-2.2.3.jar
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and
+are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program by such
+Contributor itself or anyone acting on such Contributor's behalf.
+Contributions do not include additions to the Program which: (i) are
+separate modules of software distributed in conjunction with the
+Program under their own license agreement, and (ii) are not derivative
+works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its Contribution
+alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free copyright
+license to reproduce, prepare derivative works of, publicly display,
+publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and
+object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free patent
+license under Licensed Patents to make, use, sell, offer to sell,
+import and otherwise transfer the Contribution of such Contributor, if
+any, in source code and object code form. This patent license shall
+apply to the combination of the Contribution and the Program if, at
+the time the Contribution is added by the Contributor, such addition
+of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow
+Recipient to distribute the Program, it is Recipient's responsibility
+to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright
+license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+and conditions, express and implied, including warranties or
+conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+for damages, including direct, indirect, special, incidental and
+consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are
+offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable
+manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the
+Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third party
+against the Indemnified Contributor to the extent caused by the acts
+or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement.
+In order to qualify, an Indemnified Contributor must: a) promptly
+notify the Commercial Contributor in writing of such claim, and b)
+allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in any such
+claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable
+laws, damage to or loss of data, programs or equipment, and
+unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+the Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of
+the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign
+the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the
+Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+no rights or licenses to the intellectual property of any Contributor
+under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this Agreement
+more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.
+
+===============================================================================
+For Saxon including
+ saxon-8.7.jar
+ saxon-dom-8.7.jar
+ saxon-xpath-8.7.jar
+
+ MOZILLA PUBLIC LICENSE
+Version 1.0
+
+1. Definitions.
+
+ 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.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.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 a list of 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'' 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 fifty percent (50%) or more 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) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell (``Utilize'') the Original Code (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or combinations.
+
+ 2.2. Contributor Grant.
+ Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
+
+ (a) 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 or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that may be necessary to Utilize further Modifications or combinations.
+
+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 You have knowledge that a party claims an intellectual property right in particular functionality or code (or its utilization under this License), you 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 you obtain such knowledge after You make Your Modification available as described in Section 3.2, You shall promptly modify the LEGAL file in all copies You make 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 Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source Code, and this License in any documentation for the Source Code, where You describe recipients' rights relating to Covered Code. If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A. 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 file) where a user would be likely to look for such a notice. 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 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 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'', ``NPL'' or any confusingly similar phrase do not appear anywhere in your 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.
+
+ 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.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER 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 THAT 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: (a) unless otherwise agreed in writing, all disputes relating to this License (excepting any dispute relating to intellectual property rights) shall be subject to final and binding arbitration, with the losing party paying all costs of arbitration; (b) any arbitration relating to this Agreement shall be held in Santa Clara County, California, under the auspices of JAMS/EndDispute; and (c) any litigation relating to this Agreement 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.
+
+ Except in cases where another Contributor has failed to comply with Section 3.4, You are responsible for damages arising, directly or indirectly, out of Your utilization of rights under this License, based on the number of copies of Covered Code you made available, the revenues you received from utilizing such rights, and other relevant factors. You agree to work with affected parties to distribute responsibility on an equitable basis.
+
+EXHIBIT A.
+
+ ``The contents of this file are subject to the Mozilla Public License Version 1.0 (the "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): ______________________________________.''
+
+===============================================================================
+
+For the Rhino JavaScript engine js-1.6R7.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 (groovy-all-minimal-1.5.4.jar):
+
+/*
+ $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 (jython-2.2.jar):
+
+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-1.1.jar,
+jaxb-api-2.1.jar,
+jaxb-impl-2.1.6.jar,
+jaxb-xjc-2.1.4.jar,
+jaxb2-reflection-2.1.4.jar,
+jsr181-api-1.0-MR1.jar,
+jsr250-api-1.0.jar,
+jaxws-api-2.1-1.jar,
+mail-1.4.jar,
+saaj-api-1.3.jar,
+servlet-api-2.5.jar,
+stax-api-1.0-commons-cli-1.0.jar2.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 (jruby-complete-1.0.jar), wsdl4j (wsdl4j-1.6.2.jar):
+
+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-2.2.jar:
+
+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."
+
+===============================================================================
+rome-0.9.jar
+
+Copyright 2004 Sun Microsystems, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+===============================================================================
+jdom-1.0.jar :
+
+$Id: LICENSE.txt,v 1.11 2004/02/06 09:32:57 jhunter Exp $
+
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. The name "JDOM" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact <request_AT_jdom_DOT_org>.
+
+ 4. Products derived from this software may not be called "JDOM", nor
+ may "JDOM" appear in their name, without prior written permission
+ from the JDOM Project Management <request_AT_jdom_DOT_org>.
+
+ In addition, we request (but do not require) that you include in the
+ end-user documentation provided with the redistribution and/or in the
+ software itself an acknowledgement equivalent to the following:
+ "This product includes software developed by the
+ JDOM Project (http://www.jdom.org/)."
+ Alternatively, the acknowledgment may be graphical using the logos
+ available at http://www.jdom.org/images/logos.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
+ 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.
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the JDOM Project and was originally
+ created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
+ Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information
+ on the JDOM Project, please see <http://www.jdom.org/>.
+
+========================================================================
+
+dwr-2.0.1.jar :
+
+/*
+* Copyright 2005 Joe Walker
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+==========================================================================
+
+dojotoolkit V1.0.0:
+
+The "New" BSD License:
+**********************
+
+Copyright (c) 2005, The Dojo Foundation
+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 Dojo Foundation 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 module tuscany-implementation-script-1.0-incubating.jar temporarily includes
+one file under the below BSD license with the following copyright:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+BSD license:
+
+ 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.
+
+================================================================================
+
+The serp-1.12.0.jar is distributed under the BSD license with the following copyright:
+
+ Copyright (c) 2002, A. Abram White
+ All rights reserved.
+
+BSD license:
+
+ 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.
+
+================================================================================
+The javacc-3.2.jar, and howl-1.0.1-1.jar are distributed under the BSD license:
+
+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.
+
+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 tuscany-assembly-xsd jar includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+================================================================================
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+These files being ...
+commonj/sdo/ChangeSummary$Setting.class
+commonj/sdo/ChangeSummary.class
+commonj/sdo/DataGraph.class
+commonj/sdo/DataObject.class
+commonj/sdo/helper/CopyHelper.class
+commonj/sdo/helper/DataFactory.class
+commonj/sdo/helper/DataHelper.class
+commonj/sdo/helper/EqualityHelper.class
+commonj/sdo/helper/HelperContext.class
+commonj/sdo/helper/TypeHelper.class
+commonj/sdo/helper/XMLDocument.class
+commonj/sdo/helper/XMLHelper.class
+commonj/sdo/helper/XSDHelper.class
+commonj/sdo/impl/ExternalizableDelegator$Resolvable.class
+commonj/sdo/impl/ExternalizableDelegator.class
+commonj/sdo/Property.class
+commonj/sdo/Sequence.class
+commonj/sdo/Type.class
+xml/datagraph.xsd
+xml/sdoJava.xml
+xml/sdoJava.xsd
+xml/sdoModel.xml
+xml/sdoModel.xsd
+xml/sdoXML.xml
+xml/sdoXML.xsd
+
+
+License for the Service Data Objects JavaDoc and Interface Definition files.
+
+The Service Data Objects Specification is being provided by the copyright holders under the following
+license. By using and/or copying this work, you agree that you have read, understood and will comply with
+the following terms and conditions:
+
+Permission to copy, display and distribute the Service Data Objects Specification and/or portions thereof, without
+modification, in any medium without fee or royalty is hereby granted, provided that you include the
+following on ALL copies of the Service Data Objects Specification, or portions thereof, that you make:
+
+1. A link or URL to the Service Data Objects Specification at this location:
+http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
+
+2. The full text of this copyright notice as shown in the Service Data Objects Specification.
+
+BEA, IBM, Oracle, Primeton Technologies, Rogue Wave Software, SAP, Software AG, Sun Microsystems, Xcalia,
+Zend Technologies (collectively, the “Authors”) agree to grant you a royalty-free license, under reasonable,
+non-discriminatory terms and conditions to patents that they deem necessary to implement the Service Data
+Objects Specification.
+
+THE Service Data Objects SPECIFICATION IS PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR
+WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SPECIFICATION AND THE IMPLEMENTATION OF ITS 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.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or publicity
+pertaining to the Service Data Objects Specification or its contents without specific, written prior
+permission. Title to copyright in the Service Data Objects Specification will at all times remain with the
+Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+================================================================================
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/NOTICE b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/NOTICE
new file mode 100644
index 0000000000..0b2fe5dff3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/bin/NOTICE
@@ -0,0 +1,95 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses XmlSchema developed at
+The Apache Software Foundation (http://ws.apache.org/commons/XmlSchema)
+ Portions Copyright 2006 International Business Machines Corp.
+
+This product includes/uses ode-bpel-api-1.1 developed at
+The Apache Software Foundation (http://ode.apache.org)
+ - Copyright 1999-2006 Intalio - This product includes software developed by Intalio (http://www.intalio.com)
+ - Copyright 2006 Sybase - This product includes software developed by Sybase.(http://www.sybase.com)
+
+"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 Axion : the Open Source Java Database (http://axion.tigris.org/)
+ Copyright (c) 2002-2003 Axion Development Team. All rights reserved.
+
+This product includes/uses DOM4J : the flexible XML framework for java (http://www.dom4j.org/)
+ Copyright 2001-2005 (C) MetaStuff, Ltd. 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/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
+
+This product includes software from the GlassFish project (https://glassfish.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product includes software from the Rome project (https://rome.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product includes/uses the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+
+This product includes/uses the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+
+This product includes/uses the Sourceforge wsdl4j project (http://sourceforge.net/projects/wsdl4j/)i
+
+This product includes/uses the Codehaus JRuby project (http://jruby.codehaus.org/)
+
+This product includes/uses JDOM (http://www.jdom.org/)
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin. All rights reserved.
+
+This product includes/uses DWR (http://getahead.org/dwr)
+ Copyright 2005 Joe Walker. All rights reserved.
+
+This product includes/uses dojotoolkit (http://dojotoolkit.org/)
+ Copyright (c) 2005, The Dojo Foundation. All rights reserved.
+
+This product includes/uses Howl (http://howl.objectweb.org/)
+ Copyright (c) 2004, Bull S.A.
+
+This product includes/uses axion (http://axion.tigris.org/)
+ Copyright (c) 2002-2003 Axion Development Team.
+
+This product includes/uses javacc (https://javacc.dev.java.net/)
+ Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+
+The Program includes all or portions of the following software: "The
+Saxon XSLT and XQuery Processor from Saxonica Limited" distributed under
+an MPL v1.0 license. Please refer to the homepage URL at
+http://www.saxonica.com/.
+
+This product includes/uses Serp (http://serp.sourceforge.net/) under the BSD license:
+ Copyright (c) 2002, A. Abram White. All rights reserved.
+
+This product also includes software under the BSD license
+with the following copyright:
+ Copyright (c) 2006, Sun Microsystems, Inc. All rights reserved.
+
+This product includes software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
+This product includes software under the Service Data Objects JavaDoc and
+Interface Definition file license
+
+(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-android/distribution/features/core/src/main/release/src/BUILDING b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/BUILDING
new file mode 100644
index 0000000000..65d09c5eae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/BUILDING
@@ -0,0 +1,55 @@
+Building the Apache Tuscany SCA 1.2 (incubating) April 2008 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 or higher.
+
+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.7 or higher, which can be downloaded from
+ http://maven.apache.org/download.html. Make sure that your PATH includes
+ the MVN_HOME/bin directory.
+
+4) Make sure that your MAVEN_OPTS environment variable has -Xmx128M (or more),
+ you can manually do this by executing the following in your prompt :
+ Windows users:
+ set MAVEN_OPTS=-Xmx128M
+ Unix users:
+ export MAVEN_OPTS=-Xmx128M
+
+
+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 distribution 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-android/distribution/features/core/src/main/release/src/LICENSE b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/LICENSE
new file mode 100644
index 0000000000..144d8ae692
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/LICENSE
@@ -0,0 +1,397 @@
+
+ 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, Interface Definition files
+and XSD files.
+
+The Service Data Objects JavaDoc, Interface Definition files and XSD files
+are being provided by the copyright holders under the following license.
+By using and/or copying this work, you agree that you have read,
+understood and will comply with the following terms and conditions:
+
+Permission to copy, display, make derivative works of and distribute
+the Service Data Objects JavaDoc, Interface Definition files and XSD files
+(the "Artifacts") in any medium without fee or royalty is hereby granted,
+provided that you include the following on ALL copies of the Artifacts,
+or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+
+
+THE ARTIFACTS ARE PROVIDED "AS IS" AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+The name and trademarks of the Authors may NOT be used in any manner,
+including advertising or publicity pertaining to the Service Data
+Objects Specification or its contents without specific, written prior
+permission. Title to copyright in the Service Data Objects
+Specification will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.11, last updated on 2007/12/21
+
+=================================================================================================================
+
+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.
+
+=================================================================================================================
+
+The module assembly-xsd includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+=================================================================================================================
+The modules
+
+binding-ws-xml
+databinding
+databinding-axiom
+databinding-jaxb
+databinding-json
+databinding-sdo
+databinding-sdo-axiom
+databinding-xmlbeans
+interface-wsdl-xml
+
+Include the ipo.xsd and address.xsd information from the XML Schema Primer
+(http://www.w3.org/TR/2004/PER-xmlschema-0-20040318/) combined into the
+file ipo.xsd and extended with UK postcode structures.
+
+The ipo.xsd file is include under the following license:
+
+W3C(c) SOFTWARE NOTICE AND LICENSE
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee) agree
+that you have read, understood, and will comply with the following terms and conditions.
+
+Permission to copy, modify, and distribute this software and its documentation,
+with or without modification, for any purpose and without fee or royalty is
+hereby granted, provided that you include the following on ALL copies of the
+software and documentation or portions thereof, including modifications:
+
+ 1. The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.
+ 2. Any pre-existing intellectual property disclaimers, notices, or terms
+ and conditions. If none exist, the W3C Software Short Notice should be
+ included (hypertext is preferred, text is permitted) within the body of
+ any redistributed or derivative code.
+ 3. Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from which
+ the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
+NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,
+WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
+USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
+COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+The name and trademarks of copyright holders may NOT be used in advertising or
+publicity pertaining to the software without specific, written prior permission.
+Title to copyright in this software and any associated documentation will at all
+times remain with copyright holders.
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/NOTICE b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/NOTICE
new file mode 100644
index 0000000000..a37f9b03f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/core/src/main/release/src/NOTICE
@@ -0,0 +1,39 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
+
+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 includes software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
+This product includes software under the Service Data Objects JavaDoc and
+Interface Definition file license
+
+(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.
+
+This product includes software under the W3C(c) Software License
+with the following copyright:
+
+Copyright (c) 2008 World Wide Web Consortium, (Massachusetts Institute of Technology,
+European Research Consortium for Informatics and Mathematics, Keio University).
+All Rights Reserved. This work is distributed under the W3C(c) Software License [1] in
+the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-all-maven-files.sh b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-all-maven-files.sh
new file mode 100755
index 0000000000..5f321004b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-all-maven-files.sh
@@ -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.
+
+# This script can be used to generate Maven build POM and assembly files
+# for all the distributions
+
+echo "Generate Maven files: core"
+cd core; ../etc/generate-filtered-dependencies.sh > src/main/components/bin-filtered-dependencies.xml; ../etc/generate-maven-files.sh
+
+echo "Generate Maven files: repository"
+cd ../repository; ../etc/generate-maven-files.sh
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-filtered-dependencies.sh b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-filtered-dependencies.sh
new file mode 100755
index 0000000000..7a04369b50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-filtered-dependencies.sh
@@ -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.
+
+# This generates a Maven assembly component that can be included in a Maven
+# assembly to include the source of the modules in a source distribution.
+
+echo "<!--"
+echo " * Licensed to the Apache Software Foundation (ASF) under one"
+echo " * or more contributor license agreements. See the NOTICE file"
+echo " * distributed with this work for additional information"
+echo " * regarding copyright ownership. The ASF licenses this file"
+echo " * to you under the Apache License, Version 2.0 (the"
+echo " * "License"); you may not use this file except in compliance"
+echo " * with the License. You may obtain a copy of the License at"
+echo " *"
+echo " * http://www.apache.org/licenses/LICENSE-2.0"
+echo " *"
+echo " * Unless required by applicable law or agreed to in writing,"
+echo " * software distributed under the License is distributed on an"
+echo " * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY"
+echo " * KIND, either express or implied. See the License for the"
+echo " * specific language governing permissions and limitations"
+echo " * under the License."
+echo "-->"
+echo "<component>"
+echo " <dependencySets>"
+echo ""
+echo " <!-- Add all the Tuscany modules to the modules directory -->"
+echo " <dependencySet>"
+echo " <outputDirectory>modules</outputDirectory>"
+echo " <unpack>false</unpack>"
+echo " <includes>"
+echo " <include>org.apache.tuscany.sca:*</include>"
+echo " </includes>"
+echo " <excludes>"
+
+mvn -o dependency:list | awk '/.INFO. (.*.tuscany.sca):(tuscany-)(.*):(.*):(.*):(.*)/ { print gensub("(.INFO. )(.*)(:)(.*)(:)(.*)(:)(.*)(:)(.*)", "\\2:\\4", "g") }' | sort | awk '{ printf " <exclude>%s</exclude>\n", $1 }'
+
+echo " </excludes>"
+echo " </dependencySet>"
+echo ""
+echo " <!-- Add all the dependent jars to the lib directory -->"
+echo " <dependencySet>"
+echo " <outputDirectory>lib</outputDirectory>"
+echo " <unpack>false</unpack>"
+echo " <excludes>"
+
+mvn -o dependency:list | awk '/.INFO. (.*):(.*):(.*):(.*):(.*)/ && !/(.*)(.tuscany.sca):(.*)/ { print gensub("(.INFO. )(.*)(:)(.*)(:)(.*)(:)(.*)(:)(.*)", "\\2:\\4", "g") }' | sort | awk '{ printf " <exclude>%s</exclude>\n", $1 }'
+
+echo " <exclude>org.apache.tuscany.sca:*</exclude>"
+echo " </excludes>"
+echo " </dependencySet>"
+echo " </dependencySets>"
+echo "</component>"
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-maven-files.sh b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-maven-files.sh
new file mode 100755
index 0000000000..adb190eabd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-maven-files.sh
@@ -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.
+
+# This script can be used to generate Maven build POM and assembly files
+# for a distribution
+
+../etc/generate-src-modules.sh > src/main/components/src-modules.xml
+../etc/generate-pom.sh > pom.xml.tmp
+cp pom.xml.tmp pom.xml
+rm pom.xml.tmp
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-pom.sh b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-pom.sh
new file mode 100755
index 0000000000..ce0228694c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-pom.sh
@@ -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.
+
+# This script can be used to generate a Maven build profile that includes all
+# the modules included directly or transitively in a distribution
+
+cat pom.xml | awk 'BEGIN { i=0 } /<modules>/ { i=1; print } /.*/ { if (i==0) print } '
+
+mvn -o dependency:list | awk '/.INFO. (.*.tuscany.sca):(tuscany-)(.*):(.*):(.*):(.*)/ { print gensub("(.INFO. )(.*)(:)(tuscany-)(.*)(:)(.*)(:)(.*)(:)(.*)", "\\5", "g") }' | grep -v "distribution-" | grep -v "maven-" | grep -v "wsdl2java" | grep -v "java2wsdl" | sort | awk '{ printf " <module>../../../modules/%s</module>\n", $1 }'
+
+cat pom.xml | awk 'BEGIN { i=0 } /<\/modules>/ { i=1 } /.*/ { if (i==1) print } '
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-src-modules.sh b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-src-modules.sh
new file mode 100755
index 0000000000..60dbbcd2d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/etc/generate-src-modules.sh
@@ -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.
+
+# This generates a Maven assembly component that can be included in a Maven
+# assembly to include the source of the modules in a source distribution.
+
+echo "<!--"
+echo " * Licensed to the Apache Software Foundation (ASF) under one"
+echo " * or more contributor license agreements. See the NOTICE file"
+echo " * distributed with this work for additional information"
+echo " * regarding copyright ownership. The ASF licenses this file"
+echo " * to you under the Apache License, Version 2.0 (the"
+echo " * "License"); you may not use this file except in compliance"
+echo " * with the License. You may obtain a copy of the License at"
+echo " *"
+echo " * http://www.apache.org/licenses/LICENSE-2.0"
+echo " *"
+echo " * Unless required by applicable law or agreed to in writing,"
+echo " * software distributed under the License is distributed on an"
+echo " * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY"
+echo " * KIND, either express or implied. See the License for the"
+echo " * specific language governing permissions and limitations"
+echo " * under the License."
+echo "-->"
+echo "<component>"
+echo " <fileSets>"
+echo ""
+echo " <!-- Add module sources to the modules directory -->"
+echo " <fileSet>"
+echo " <directory>../../../modules</directory>"
+echo " <outputDirectory>modules</outputDirectory>"
+echo " <includes>"
+
+mvn -o dependency:list | awk '/.INFO. (.*.tuscany.sca):(tuscany-)(.*):(.*):(.*):(.*)/ { print gensub("(.INFO. )(.*)(:)(tuscany-)(.*)(:)(.*)(:)(.*)(:)(.*)", "\\5", "g") }' | sort | awk '{ printf " <include>%s/**/*</include>\n", $1 }'
+
+echo " </includes>"
+echo " <excludes>"
+echo " <!-- General file/folders to exclude -->"
+echo " <exclude>**/.*</exclude>"
+echo " <exclude>**/.*/**</exclude>"
+echo " <exclude>**/*.log</exclude>"
+echo ""
+echo " <!-- Specific files/folders to exclude -->"
+echo " <exclude>pom.xml</exclude>"
+echo " <exclude>**/target</exclude>"
+echo " <exclude>**/target/**/*</exclude>"
+echo " </excludes>"
+echo " </fileSet>"
+echo " </fileSets>"
+echo "</component>"
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/pom.xml b/sca-java-1.x/branches/sca-android/distribution/features/pom.xml
new file mode 100644
index 0000000000..6f7dc519cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/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-sca</artifactId>
+ <relativePath>../../pom.xml</relativePath>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-features</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Feature Distributions</name>
+
+ <modules>
+ <module>core</module>
+ <module>repository</module>
+ </modules>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/repository/pom.xml b/sca-java-1.x/branches/sca-android/distribution/features/repository/pom.xml
new file mode 100644
index 0000000000..2c1e30c82d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/pom.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-distribution-features</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-distribution-repository</artifactId>
+ <name>Apache Tuscany SCA Maven Repository Distribution</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-core</artifactId>
+ <type>pom</type>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+
+ <!-- Default build profile that can be used to build the distro packages -->
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <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/repository.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <finalName>apache-tuscany-sca-repository-1.4-SNAPSHOT</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- Profile that can be used to build the modules included in the distro -->
+ <profile>
+ <id>modules</id>
+ <modules>
+ <module>../../../modules/assembly</module>
+ <module>../../../modules/assembly-xml</module>
+ <module>../../../modules/assembly-xsd</module>
+ <module>../../../modules/binding-sca</module>
+ <module>../../../modules/binding-sca-xml</module>
+ <module>../../../modules/contribution</module>
+ <module>../../../modules/contribution-impl</module>
+ <module>../../../modules/contribution-java</module>
+ <module>../../../modules/contribution-namespace</module>
+ <module>../../../modules/contribution-xml</module>
+ <module>../../../modules/core</module>
+ <module>../../../modules/core-databinding</module>
+ <module>../../../modules/core-spi</module>
+ <module>../../../modules/databinding</module>
+ <module>../../../modules/databinding-jaxb</module>
+ <module>../../../modules/definitions</module>
+ <module>../../../modules/definitions-xml</module>
+ <module>../../../modules/endpoint</module>
+ <module>../../../modules/extensibility</module>
+ <module>../../../modules/host-http</module>
+ <module>../../../modules/implementation-java</module>
+ <module>../../../modules/implementation-java-runtime</module>
+ <module>../../../modules/implementation-java-xml</module>
+ <module>../../../modules/implementation-node</module>
+ <module>../../../modules/implementation-node-runtime</module>
+ <module>../../../modules/interface</module>
+ <module>../../../modules/interface-java</module>
+ <module>../../../modules/interface-java-jaxws</module>
+ <module>../../../modules/interface-java-xml</module>
+ <module>../../../modules/monitor</module>
+ <module>../../../modules/node-api</module>
+ <module>../../../modules/node-impl</module>
+ <module>../../../modules/node-launcher</module>
+ <module>../../../modules/policy</module>
+ <module>../../../modules/policy-xml</module>
+ <module>../../../modules/sca-api</module>
+ <module>../../../modules/xsd</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/assembly/repository.xml b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/assembly/repository.xml
new file mode 100644
index 0000000000..ed459500a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/assembly/repository.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.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>tuscany-sca-1.4-SNAPSHOT</baseDirectory>
+ <formats>
+ <!--
+ <format>dir</format>
+ <format>tar.gz</format>
+ -->
+ <format>zip</format>
+ </formats>
+
+ <componentDescriptors>
+ <componentDescriptor>../core/src/main/components/bin-common.xml</componentDescriptor>
+ </componentDescriptors>
+
+ <repositories>
+ <repository>
+ <includeMetadata>true</includeMetadata>
+ <outputDirectory>repository</outputDirectory>
+ </repository>
+ </repositories>
+</assembly>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/components/src-modules.xml b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/components/src-modules.xml
new file mode 100644
index 0000000000..cef542b41c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/components/src-modules.xml
@@ -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.
+-->
+<component>
+ <fileSets>
+
+ <!-- Add module sources to the modules directory -->
+ <fileSet>
+ <directory>../../../modules</directory>
+ <outputDirectory>modules</outputDirectory>
+ <includes>
+ <include>assembly/**/*</include>
+ <include>assembly-xml/**/*</include>
+ <include>assembly-xsd/**/*</include>
+ <include>binding-sca/**/*</include>
+ <include>binding-sca-xml/**/*</include>
+ <include>contribution/**/*</include>
+ <include>contribution-impl/**/*</include>
+ <include>contribution-java/**/*</include>
+ <include>contribution-namespace/**/*</include>
+ <include>contribution-xml/**/*</include>
+ <include>core/**/*</include>
+ <include>core-databinding/**/*</include>
+ <include>core-spi/**/*</include>
+ <include>databinding/**/*</include>
+ <include>databinding-jaxb/**/*</include>
+ <include>definitions/**/*</include>
+ <include>definitions-xml/**/*</include>
+ <include>distribution-core/**/*</include>
+ <include>endpoint/**/*</include>
+ <include>extensibility/**/*</include>
+ <include>host-http/**/*</include>
+ <include>implementation-java/**/*</include>
+ <include>implementation-java-runtime/**/*</include>
+ <include>implementation-java-xml/**/*</include>
+ <include>implementation-node/**/*</include>
+ <include>implementation-node-runtime/**/*</include>
+ <include>interface/**/*</include>
+ <include>interface-java/**/*</include>
+ <include>interface-java-jaxws/**/*</include>
+ <include>interface-java-xml/**/*</include>
+ <include>monitor/**/*</include>
+ <include>node-api/**/*</include>
+ <include>node-impl/**/*</include>
+ <include>node-launcher/**/*</include>
+ <include>policy/**/*</include>
+ <include>policy-xml/**/*</include>
+ <include>sca-api/**/*</include>
+ <include>xsd/**/*</include>
+ </includes>
+ <excludes>
+ <!-- General file/folders to exclude -->
+ <exclude>**/.*</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>**/*.log</exclude>
+
+ <!-- Specific files/folders to exclude -->
+ <exclude>pom.xml</exclude>
+ <exclude>**/target</exclude>
+ <exclude>**/target/**/*</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/CHANGES b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/CHANGES
new file mode 100644
index 0000000000..3de7358ec6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/CHANGES
@@ -0,0 +1,431 @@
+Changes With Apache Tuscany SCA 1.2 (incubating) April 2008
+===========================================================
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-2027
+ * TUSCANY-1999
+ * TUSCANY-2037
+ * TUSCANY-2034
+ * TUSCANY-2038
+ * TUSCANY-2043
+ * TUSCANY-2046
+ * TUSCANY-2047
+ * TUSCANY-2028
+ * TUSCANY-1873
+ * TUSCANY-2049
+ * TUSCANY-2035
+ * TUSCANY-1206
+ * TUSCANY-2036
+ * TUSCANY-1771
+ * TUSCANY-2013
+ * TUSCANY-1926
+ * TUSCANY-1917
+ * TUSCANY-1949
+ * TUSCANY-1941
+ * TUSCANY-2045
+ * TUSCANY-2057
+ * TUSCANY-2055
+ * TUSCANY-2056
+ * TUSCANY-2072
+ * TUSCANY-2047
+ * TUSCANY-2073
+ * TUSCANY-1977
+ * TUSCANY-2075
+ * TUSCANY-1894
+ * TUSCANY-2079
+ * TUSCANY-2078
+ * TUSCANY-2080
+ * TUSCANY-2068
+ * TUSCANY-1950
+ * TUSCANY-2077
+ * TUSCANY-2056
+ * TUSCANY-2088
+ * TUSCANY-2086
+ * TUSCANY-2094
+ * TUSCANY-2106
+
+ Features and/or Enhancements
+
+ * Core
+ - Interceptor Enhancements
+ - Phase-based interceptor ordering to allow contribution of new interceptors and also define the order in witch they should be invoked
+ - Pass-by-reference SPI to allow interceptors to indicate if they support pass-by-reference
+ - PolicyProvider SPIs to allow extensions to plugin policy interceptors
+ - Support for JAXWS annotations and mapping of faults to Java exceptions according to JAXWS specification
+ - Improvement of contribution service to allow it to be used outside of the runtime environment
+ - Support for Contribution Import/Export resource
+ - Enhanced Distributed Domain story using Workspace
+ - Implementation of a SCA domain allowing a system administrator to manage contributions, composites and sca nodes that run these composites
+ - Set of core services providing management capabilities
+ - Administration web interface
+ - This is a work in progress and you can see it in action in samples/calculator-distributed. Other samples that use distributed operation are yet to move over to the workspace.
+ - Enhanced support for SCA Policy spec
+ - Ability to apply external policy definitions to a SCA composition
+ - Ability to spread policy definitions to multiple definitions.xml files available across the sca domain
+ - Bug fixes
+ - Improvements of http binding to support servlet components
+ - Enable Tuscany to run inside an OSGi runtime
+
+ * Web 2.0 Extensions
+ - Enhancements to implementation.widget (support for properties)
+ - New atom binding based on Apache Abdera
+ - Refactoring of rss-rome binding
+ * Other Extensions
+ - Binding JMS
+ - greatly simplified the use of the JMS binding, support locating JMS resources from JNDI, and better compliance with the SCA JMS binding spec
+ - see the doc page for more details: http://incubator.apache.org/tuscany/sca-java-bindingjms.html
+ - Enhancements to Binding RMI
+ - Support shared RMI registry and use 999x as the ports in test case to avoid 1099 conflict
+ - Enhancements to Groovy extension
+ - Support for 'native' groovy classes
+ - Enhancements to OSGi bundle contributions
+ - Support Bundle URLs to be added as contributions
+
+ * Tools
+ - Eclipse plugin providing a Tuscany runtime Library and Tuscany launcher in Eclipse environment
+ - An updatesite is also available to facilitate the plugin installation using the Eclipse update manager
+
+ * Samples/Tutorial/Demos
+ - calculator-distributed migrated to use new Tuscany Distributed Workspace
+ - sample-calculator-ws-secure-webapp
+ - sample-helloworld-jms-webapp
+ - new jms samples
+ - improve bigbank demo to include support for policies
+ - tutorial store changes
+ - use of import/export
+ - development of contribution without requiring dependencies on the Tuscany runtime
+ - usage of new sca domain infrastructure
+
+ * Testing
+ - Web Container Testing Framework integrated with (Tomcat, Jetty, Geronimo and Websphere)
+
+
+Changes With Apache Tuscany SCA 1.1 (incubating) January 2008
+===============================================================
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-1939
+ * TUSCANY-1914
+ * TUSCANY-1854
+ * TUSCANY-1931
+ * TUSCANY-1547
+ * TUSCANY-1909
+ * TUSCANY-1919
+ * TUSCANY-1930
+ * TUSCANY-1806
+ * TUSCANY-1804
+ * TUSCANY-1916
+ * TUSCANY-1913
+ * TUSCANY-1834
+ * TUSCANY-1857
+ * TUSCANY-1687
+ * TUSCANY-1801
+ * TUSCANY-1742
+ * TUSCANY-1762
+ * TUSCANY-1945
+ * TUSCANY-1595
+ * TUSCANY-1594
+ * TUSCANY-1849
+ * TUSCANY-1836
+ * TUSCANY-1934
+ * TUSCANY-1902
+ * TUSCANY-1608
+ * TUSCANY-1943
+ * TUSCANY-1896
+ * TUSCANY-1626
+ * TUSCANY-1797
+ * TUSCANY-1601
+ * TUSCANY-1415
+
+- Better JMS support
+ * binding.jms supporting point to point text based messaging only
+ * New SOAP/JMS sample (helloworld-ws-reference/service-jms)
+
+- Improvements in PolicyFramework Support
+ * Support for policy specifications on operation elements in a composite definition
+ * Separate sample (calculator-implementation-policies) to demonstrate use of Implementation Policies
+ (uses logging and JAAS Authentication)
+
+- Modeling of client side java script components
+ * See implementation.widget
+
+- Evolving support for doman API suggested by assembly spec including a standalone node and nodes running
+ connected together in a domain. This is still experimental.
+
+- Class loading and OSGI improvements
+ * Enable Tuscany to be run in a multi-classloader environment including inside OSGi. By default,
+ Tuscany continues to run using a single CLASSPATH-based classloader.
+ * Contributions no longer need to be in the CLASSPATH. All import/export dependencies across contributions should be
+ explicitly specified (as described in the spec).
+
+- JAXB based POJO transformations
+
+Changes With Apache Tuscany SCA 1.0.1 (incubating) November 2007
+================================================================
+
+The Tuscany SCA Java 1.0.1 is mainly a bug-fix release. It also comes with some improvements as listed below.
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-1848
+ * TUSCANY-1857
+ * TUSCANY-1859
+ * TUSCANY-1801
+ * TUSCANY-1823
+ * TUSCANY-1839
+ * TUSCANY-1814
+ * TUSCANY-1818
+ * TUSCANY-1834
+ * TUSCANY-1637
+ * TUSCANY-1826
+ * TUSCANY-1823
+ * TUSCANY-1819
+ * TUSCANY-1821
+ * TUSCANY-1822
+ * TUSCANY-1806
+ * TUSCANY-1808
+ * TUSCANY-1756
+ * TUSCANY-1757
+
+- Fix build issues with Maven 2.0.7 and JDK 6
+
+- Reduce memory consumption for WSDLs that import large XSDs
+
+- Add more logging statements for better servicibility
+
+- Add an extension point to allow extensions to plug-in extension schemas.
+
+- Add a demo application to showcase XML integration story
+
+- Improve in databinding framework
+ * Add support for JSON Databindings and other refactoring
+ * Set databinding for introspected data type and enhance the checking of wrapper style
+ * Improve the tree-based XMLStreamReader and convert Bean & DOM to use this approach
+ * Add a tree-iterator based XMLStreamReader base impl
+ * Add default element info to java interface
+ * Rename Interface.setDefaultDataBinding to resetDataBinding
+
+- Limit the method injection to setters and allow the setter annotation to override field annotation
+
+- Evolving support in Intent and Policy handling
+ * Add support for policies in implementation
+ * Fix the algorithm for macthing policySets defined on bindings for the wire
+ * Add policy intent for implementation.java
+ * Extend java implementation type to recognize and apply policies, adding util support for this in Policy module
+ * Add policy module for logging
+
+- Evolving development in the SCA Domain/Node
+
+- Update NOTICE files with missing dependencies
+
+
+Changes With Apache Tuscany SCA 1.0 (incubating) September 2007
+===============================================================
+
+- Tuscany Java SCA now implements V1.0 of the core SCA
+ specifications
+ SCA Assembly Model V1.0
+ SCA Java Common Annotations and APIs V1.0
+ SCA Java Component Implementation V1.0
+ SCA Web Services Binding V1.0
+ Including callbacks, conversations and callable references
+
+
+- Support for ws-security configurable in the web services binding
+ thro Tuscany SCA policy intents and policysets using the policy framework
+ introduced in the last release.
+
+ Note : This release supports specifications of policies around axis2
+ config params - see helloworld-ws-service-secure sample. The policy
+ intents that have been tested are authentication, integrity and
+ confidentiality.
+ There is no sample or test that exercises confidentiality since there
+ are some unresolved licensing issue around bouncycastle libraries.
+ However, users who are not encumbered by the bouncycastle license
+ restrictions can try the 'confidentiality' intent. See FAQ -
+ http://incubator.apache.org/tuscany/tuscany-sca-java-faq.html
+
+ This release does not include support for WS-Policy
+ attachments in Tuscany Policysets for ws-security.
+
+
+- An XQuery component implementation type
+ implementation-xquery
+
+
+- A Databinding for converting data to and from nodes for XQuery
+ processing
+ databinding-saxon
+
+
+- OSGI support has been extended to allow Tuscany contributions
+ packaged as OSGI bundles hence taking advantage of OSGI's bundle
+ loading an dependency management capabilities
+
+
+- A BPEL component implementation type experimental implementation
+based on SCA BPEL Client and Implementation V1.0. At the moment only
+supports BPEL process as services.
+ implementation-bpel
+
+
+- The distributed runtime implementation has been separated out
+ into
+ *) domain
+ *) node
+ It is now wrapped by a SCADomain interface as is the standalone
+ runtime.
+
+ Note: This release does not include support for WebApp host deployment
+ for a distributed SCA Domain
+
+
+
+- The web service binding will now generate WSDL automatically
+ based on the service interface if no WSDL is provided
+
+
+- A new "store" sample and associated document show how a
+ simple store front application can be constructed
+ samples/store
+
+- The following features of this release are still experimental:
+ - BPEL implementation type, integrating with Apache ODE
+ - OSGI implementation type, integrating with Apache Felix
+ - XQuery implementation type
+
+
+
+Changes With Apache Tuscany SCA 0.99 (incubating) August 2007
+=============================================================
+
+The following are the significant additions to release 0.99
+over and above all of what was offered in release 0.91.
+
+- A version of the default sca binding that works between
+ components runing in separate Java virtual machines
+ binding-sca-axis
+
+- A simple node implementation and a service discovery
+ function for running sca applications distributed
+ across more than one node
+ distributed
+ distributed-impl
+
+- integration with OSGi runtimes is now supported with
+ a new implementation-osgi component type
+
+- PUB/SUB interactions are now supported by using new
+ notification binding and implementation types, and
+ samples demonstrating the feature.
+
+- The Tuscany runtime now has a policy framework supporting
+ the SCA policy specification
+
+- the endpoint URIs used by SCA bindings has been rationalized
+ and now follows the SCA Assembly specification
+
+- binding-ajax has been renamed to binding-dwr
+
+Changes With Apache Tuscany SCA 0.91 (incubating) July 2007
+===========================================================
+
+The following are the significant additions to release 0.91
+over and above all of what was offered in release 0.90.
+
+
+- Enhancements to support multiple contributions to the SCA Domain
+
+- The inclusion of a alternative simplified extensions-helper
+SPI layer to faciliate rapid development of extensions
+
+- More Implementation Extenstions
+ Spring
+ WebResource
+
+- More Binding Extensions
+ AJAX
+ EJB
+ RSS/ATOM Feeds
+
+- Demos that demonstrate the use of a mix of extensions
+ alert-aggregator-webapp
+ bigbank-account
+ bigbank-calculator
+ bigbank-stockquote
+
+
+- Samples
+ Samples to demostrate use of Spring, Resource, AJAX extensions
+
+Changes With Apache Tuscany SCA 0.90 (incubating) June 2007
+===========================================================
+
+- 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-android/distribution/features/repository/src/main/release/DISCLAIMER b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/DISCLAIMER
new file mode 100644
index 0000000000..a65af91c5a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/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-android/distribution/features/repository/src/main/release/README b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/README
new file mode 100644
index 0000000000..4d83dcfde9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/README
@@ -0,0 +1,19 @@
+Apache Tuscany SCA 1.2 (incubating) April 2008 README
+=====================================================
+
+Welcome to the Tuscany SCA 1.2 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-android/distribution/features/repository/src/main/release/RELEASE_NOTES b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/RELEASE_NOTES
new file mode 100644
index 0000000000..a04ef5c553
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/RELEASE_NOTES
@@ -0,0 +1,83 @@
+Apache Tuscany SCA 1.2 (incubating) April 2008 Release Notes
+============================================================
+
+Apache Tuscany provides a runtime based on the Service Component
+Architecture. SCA is a set of specifications aimed at simplifying SOA
+Application Development which are being standardized at OASIS as part
+of Open Composite Services Architecture (Open CSA) - http://www.oasis-opencsa.org/.
+
+Overview
+--------
+
+ The Apache Tuscany SCA 1.2 release includes implementations of the
+ main SCA specifications including:
+
+ SCA Assembly Model V1.0
+ SCA Policy Framework V1.0
+ SCA Java Common Annotations and APIs V1.0
+ SCA Java Component Implementation V1.0
+ SCA Spring Component Implementation V1.0
+ SCA BPEL Client and Implementation V1.0
+ SCA Web Services Binding V1.0
+ SCA EJB Session Bean Binding V1.0
+
+ It also includes implementations of many features not yet defined
+ by SCA specifications, including:
+
+ - SCA bindings for Direct Web Remoting, RSS and ATOM Feeds,
+ HTTP resources, JSON-RPC, PUB/SUB Notifications, and RMI.
+ - SCA implementation types for OSGI, XQuery, BPEL, Widget and various
+ dynamic languages including Groovy, Javascript, Python and Ruby
+ - Databindings for Service Data Objects (SDO), JAXB, XmlBeans,
+ Axis2's AXIOM, JSON, SAXON, DOM, SAX and StAX
+
+ The Tuscany SCA Runtime can be configured as a single node SCA domain or
+ as an SCA domain distributed across multiple nodes.
+ In addition Tuscany SCA supports the following host-deployment options: -
+ - running standalone
+ - running with distributed nodes across multiple JVMs
+ - running with embedded Jetty or Tomcat
+ - running as part of a standard web application
+
+ The Wepapp samples included in this release have been tried and tested on
+ - Tomcat 5.5.20 and Tomcat 6.0.14
+ - Jetty 6.1.3
+ - Geronimo 2.0.2 Tomcat6 jee5
+ - WebSphere 6.1 fix pack 9
+
+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 list archives:
+
+ 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
+
+To join the project's mailing lists follow the instructions at:
+
+ http://incubator.apache.org/tuscany/mailing-lists.html
+
+To find out more about OASIS Open CSA go to:
+
+ http://www.oasis-opencsa.org.
+
+Apache Tuscany welcomes your help. Any contribution, including code,
+testing, improving the documentation, or bug reporting is always
+appreciated.
+
+Thank you for using Apache Tuscany!
+
+- The Tuscany Team.
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/INSTALL b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/INSTALL
new file mode 100644
index 0000000000..2da53a2b44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/INSTALL
@@ -0,0 +1,27 @@
+Installing the Apache Tuscany SCA 1.2 (incubating) April 2008 Release binary distribution
+=========================================================================================
+
+Unzip Tuscany binary distribution archive and you get the following:
+
+tuscany-sca-1.1-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
+ README - readme for the release
+ RELEASE_NOTES - description of this release
+ CHANGES - A note of the major changes in this release
+
+ /demos - Demo applications showcasing the use of Apache Tuscany
+
+ /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
+
+ /tutorial - The store tutorial, see the README in that directory
+
+
+
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/LICENSE b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/LICENSE
new file mode 100644
index 0000000000..5e1f585d46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/LICENSE
@@ -0,0 +1,2366 @@
+
+ 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.
+
+===============================================================================
+
+The following components come under Apache Software License 1.1
+
+ commons-discovery-0.2.jar
+ commons-primitives-1.0.jar
+
+The following components come under Apache Software License 2.0
+
+ abdera-core-0.3.0-incubating.jar
+ abdera-i18n-0.3.0-incubating.jar
+ abdera-parser-0.3.0-incubating.jar
+ activeio-2.0-r118.jar
+ activeio-core-3.0.0-incubator.jar
+ apache-activemq-4.1.1.jar
+ addressing-1.3.mar
+ annogen-0.1.0.jar
+ annotations-api-6.0.14.jar
+ aopalliance-1.0.jar
+ axiom-api-1.2.5.jar
+ axiom-dom-1.2.5.jar
+ axiom-impl-1.2.5.jar
+ axis2-adb-1.3.jar
+ axis2-codegen-1.3.jar
+ axis2-java2wsdl-1.3.jar
+ axis2-kernel-1.3.jar
+ axis2-mtompolicy-1.3.jar
+ bsf-all-3.0-beta2.jar
+ catalina-6.0.14.jar
+ cglib-nodep-2.1_3.jar
+ commons-collections-3.1.jar
+ commons-codec-1.3.jar
+ commons-fileupload-1.1.1.jar
+ commons-httpclient-3.0.1.jar
+ commons-io-1.2.jar
+ commons-jexl-1.1.jar
+ commons-lang-2.1.jar
+ commons-logging-1.1.jar
+ coyote-6.0.14.jar
+ derby-10.1.3.1.jar
+ geronimo-activation_1.1_spec-1.0-M1.jar
+ geronimo-common-1.2-beta.jar
+ geronimo-commonj_1.1_spec-1.0.jar
+ geronimo-connector-1.2-beta.jar
+ geronimo-core-1.2-beta.jar
+ geronimo-deployment-1.2-beta.jar
+ geronimo-ejb_3.0_spec-1.0.jar
+ geronimo-interceptor-1.2-beta.jar
+ geronimo-j2ee-1.2-beta.jar
+ geronimo-j2ee-connector_1.5_spec-1.1.jar
+ geronimo-j2ee-jacc_1.0_spec-1.1.jar
+ geronimo-j2ee-management_1.0_spec-1.1.jar
+ geronimo-javamail_1.4_spec-1.0-M1.jar
+ geronimo-jms_1.1_spec-1.1.jar
+ geronimo-jpa_3.0_spec-1.0.jar
+ geronimo-jta_1.0.1B_spec-1.0.jar
+ geronimo-kernel-1.2-beta.jar
+ geronimo-management-1.2-beta.jar
+ geronimo-naming-1.2-beta.jar
+ geronimo-security-1.2-beta.jar
+ geronimo-spec-j2ee-connector-1.5-rc4.jar
+ geronimo-spec-jta-1.0.1B-rc4.jar
+ geronimo-system-1.2-beta.jar
+ geronimo-transaction-1.2-beta.jar
+ geronimo-util-1.2-beta.jar
+ httpcore-4.0-alpha5.jar
+ httpcore-nio-4.0-alpha5.jar
+ httpcore-niossl-4.0-alpha5.jar
+ jettison-1.0-RC2.jar
+ jetty-6.1.7.jar
+ jetty-util-6.1.7.jar
+ json-rpc-1.0.jar
+ juli-6.0.14.jar
+ log4j-1.2.12.jar
+ logkit-1.0.1.jar
+ neethi-2.0.2.jar
+ ode-bpel-api-1.1.jar
+ ode-bpel-compiler-1.1.jar
+ ode-bpel-dao-1.1.jar
+ ode-bpel-epr-1.1.jar
+ ode-bpel-obj-1.1.jar
+ ode-bpel-runtime-1.1.jar
+ ode-bpel-schemas-1.1.jar
+ ode-bpel-store-1.1.jar
+ ode-dao-jpa-1.1.jar
+ ode-dao-jpa-ojpa-derby-1.1.zip
+ ode-jacob-1.1.jar
+ ode-jacob-ap-1.1.jar
+ ode-scheduler-simple-1.1.jar
+ ode-utils-1.1.jar
+ openjpa-all-0.9.7-incubating.jar
+ openjpa-persistence-0.9.7-incubating.jar
+ org.apache.felix.bundlerepository-1.0.2.jar
+ org.apache.felix.framework-1.0.3.jar
+ org.apache.felix.main-1.0.3.jar
+ org.apache.felix.shell-1.0.0.jar
+ org.apache.felix.shell.tui-1.0.0.jar
+ rampart-core-1.3.jar
+ rampart-policy-1.3.jar
+ rampart-trust-1.3.jar
+ regexp-1.3.jar
+ spring-beans-2.0.6.jar
+ spring-context-2.0.6.jar
+ spring-core-2.0.6.jar
+ tranql-connector-1.1.jar
+ tuscany-sdo-api-r2.1-1.0-incubating.jar
+ tuscany-sdo-impl-1.0-incubating.jar
+ tuscany-sdo-lib-1.0-incubating.jar
+ tuscany-sdo-tools-1.0-incubating.jar
+ woden-1.0-incubating-M7b.jar
+ wss4j-1.5.3.jar
+ wstx-asl-3.2.1.jar
+ xalan-2.7.0.jar
+ xbean-naming-2.7.jar
+ xercesImpl-2.8.1.jar
+ xml-apis-1.3.03.jar
+ xmlbeans-2.3.0.jar
+ xml-resolver-1.1.jar
+ xmlsec-1.4.0.jar
+ XmlSchema-1.3.2.jar
+
+===============================================================================
+axion-1.0-M3-dev.jar
+
+Copyright (c) 2002-2003 Axion Development Team. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the following
+ disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+3. The names "Tigris", "Axion", nor the names of its contributors may
+ not be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+4. Products derived from this software may not be called "Axion", nor
+ may "Tigris" or "Axion" appear in their names 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 "Axion Development Team" is defined to be:
+
+ * Chuck Burdick
+ * James Burke
+ * Morgan Delagrange
+ * Geir Magnusson Jr.
+ * Martin Poeschl
+ * Steve Polyak
+ * Daniel Rall
+ * Ahimanikya Satapathy
+ * Doug Sale
+ * James Strachan
+ * Rodney Waldhoff
+ * Jason van Zyl
+
+License changes are to be determined by a simple majority vote of the
+Axion Development Team.
+
+===============================================================================
+dom4j-1.6.1.jar
+
+Copyright 2001-2005 (C) MetaStuff, Ltd. 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 "DOM4J" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of MetaStuff, Ltd. For written permission,
+ please contact dom4j-info@metastuff.com.
+
+4. Products derived from this Software may not be called "DOM4J"
+ nor may "DOM4J" appear in their names without prior written
+ permission of MetaStuff, Ltd. DOM4J is a registered
+ trademark of MetaStuff, Ltd.
+
+5. Due credit should be given to the DOM4J Project -
+ http://www.dom4j.org
+
+THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. 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
+METASTUFF, LTD. 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.
+
+===============================================================================
+
+The EMF jars;
+ codegen-2.2.3.jar
+ codegen-ecore-2.2.3.jar
+ common-2.2.3.jar
+ ecore-2.2.3.jar
+ ecore-change-2.2.3.jar
+ ecore-xmi-2.2.3.jar
+ xsd-2.2.3.jar
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and
+are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program by such
+Contributor itself or anyone acting on such Contributor's behalf.
+Contributions do not include additions to the Program which: (i) are
+separate modules of software distributed in conjunction with the
+Program under their own license agreement, and (ii) are not derivative
+works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its Contribution
+alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free copyright
+license to reproduce, prepare derivative works of, publicly display,
+publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and
+object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free patent
+license under Licensed Patents to make, use, sell, offer to sell,
+import and otherwise transfer the Contribution of such Contributor, if
+any, in source code and object code form. This patent license shall
+apply to the combination of the Contribution and the Program if, at
+the time the Contribution is added by the Contributor, such addition
+of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow
+Recipient to distribute the Program, it is Recipient's responsibility
+to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright
+license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+and conditions, express and implied, including warranties or
+conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+for damages, including direct, indirect, special, incidental and
+consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are
+offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable
+manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the
+Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third party
+against the Indemnified Contributor to the extent caused by the acts
+or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement.
+In order to qualify, an Indemnified Contributor must: a) promptly
+notify the Commercial Contributor in writing of such claim, and b)
+allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in any such
+claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable
+laws, damage to or loss of data, programs or equipment, and
+unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+the Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of
+the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign
+the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the
+Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+no rights or licenses to the intellectual property of any Contributor
+under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this Agreement
+more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.
+
+===============================================================================
+For Saxon including
+ saxon-8.7.jar
+ saxon-dom-8.7.jar
+ saxon-xpath-8.7.jar
+
+ MOZILLA PUBLIC LICENSE
+Version 1.0
+
+1. Definitions.
+
+ 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.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.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 a list of 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'' 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 fifty percent (50%) or more 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) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell (``Utilize'') the Original Code (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or combinations.
+
+ 2.2. Contributor Grant.
+ Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
+
+ (a) 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 or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that may be necessary to Utilize further Modifications or combinations.
+
+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 You have knowledge that a party claims an intellectual property right in particular functionality or code (or its utilization under this License), you 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 you obtain such knowledge after You make Your Modification available as described in Section 3.2, You shall promptly modify the LEGAL file in all copies You make 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 Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source Code, and this License in any documentation for the Source Code, where You describe recipients' rights relating to Covered Code. If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A. 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 file) where a user would be likely to look for such a notice. 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 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 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'', ``NPL'' or any confusingly similar phrase do not appear anywhere in your 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.
+
+ 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.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER 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 THAT 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: (a) unless otherwise agreed in writing, all disputes relating to this License (excepting any dispute relating to intellectual property rights) shall be subject to final and binding arbitration, with the losing party paying all costs of arbitration; (b) any arbitration relating to this Agreement shall be held in Santa Clara County, California, under the auspices of JAMS/EndDispute; and (c) any litigation relating to this Agreement 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.
+
+ Except in cases where another Contributor has failed to comply with Section 3.4, You are responsible for damages arising, directly or indirectly, out of Your utilization of rights under this License, based on the number of copies of Covered Code you made available, the revenues you received from utilizing such rights, and other relevant factors. You agree to work with affected parties to distribute responsibility on an equitable basis.
+
+EXHIBIT A.
+
+ ``The contents of this file are subject to the Mozilla Public License Version 1.0 (the "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): ______________________________________.''
+
+===============================================================================
+
+For the Rhino JavaScript engine js-1.6R7.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 (groovy-all-minimal-1.5.4.jar):
+
+/*
+ $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 (jython-2.2.jar):
+
+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-1.1.jar,
+jaxb-api-2.1.jar,
+jaxb-impl-2.1.6.jar,
+jaxb-xjc-2.1.4.jar,
+jaxb2-reflection-2.1.4.jar,
+jsr181-api-1.0-MR1.jar,
+jsr250-api-1.0.jar,
+jaxws-api-2.1-1.jar,
+mail-1.4.jar,
+saaj-api-1.3.jar,
+servlet-api-2.5.jar,
+stax-api-1.0-commons-cli-1.0.jar2.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 (jruby-complete-1.0.jar), wsdl4j (wsdl4j-1.6.2.jar):
+
+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-2.2.jar:
+
+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."
+
+===============================================================================
+rome-0.9.jar
+
+Copyright 2004 Sun Microsystems, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+===============================================================================
+jdom-1.0.jar :
+
+$Id: LICENSE.txt,v 1.11 2004/02/06 09:32:57 jhunter Exp $
+
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. The name "JDOM" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact <request_AT_jdom_DOT_org>.
+
+ 4. Products derived from this software may not be called "JDOM", nor
+ may "JDOM" appear in their name, without prior written permission
+ from the JDOM Project Management <request_AT_jdom_DOT_org>.
+
+ In addition, we request (but do not require) that you include in the
+ end-user documentation provided with the redistribution and/or in the
+ software itself an acknowledgement equivalent to the following:
+ "This product includes software developed by the
+ JDOM Project (http://www.jdom.org/)."
+ Alternatively, the acknowledgment may be graphical using the logos
+ available at http://www.jdom.org/images/logos.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
+ 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.
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the JDOM Project and was originally
+ created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
+ Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information
+ on the JDOM Project, please see <http://www.jdom.org/>.
+
+========================================================================
+
+dwr-2.0.1.jar :
+
+/*
+* Copyright 2005 Joe Walker
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+==========================================================================
+
+dojotoolkit V1.0.0:
+
+The "New" BSD License:
+**********************
+
+Copyright (c) 2005, The Dojo Foundation
+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 Dojo Foundation 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 module tuscany-implementation-script-1.0-incubating.jar temporarily includes
+one file under the below BSD license with the following copyright:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+BSD license:
+
+ 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.
+
+================================================================================
+
+The serp-1.12.0.jar is distributed under the BSD license with the following copyright:
+
+ Copyright (c) 2002, A. Abram White
+ All rights reserved.
+
+BSD license:
+
+ 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.
+
+================================================================================
+The javacc-3.2.jar, and howl-1.0.1-1.jar are distributed under the BSD license:
+
+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.
+
+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 tuscany-assembly-xsd jar includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+================================================================================
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+These files being ...
+commonj/sdo/ChangeSummary$Setting.class
+commonj/sdo/ChangeSummary.class
+commonj/sdo/DataGraph.class
+commonj/sdo/DataObject.class
+commonj/sdo/helper/CopyHelper.class
+commonj/sdo/helper/DataFactory.class
+commonj/sdo/helper/DataHelper.class
+commonj/sdo/helper/EqualityHelper.class
+commonj/sdo/helper/HelperContext.class
+commonj/sdo/helper/TypeHelper.class
+commonj/sdo/helper/XMLDocument.class
+commonj/sdo/helper/XMLHelper.class
+commonj/sdo/helper/XSDHelper.class
+commonj/sdo/impl/ExternalizableDelegator$Resolvable.class
+commonj/sdo/impl/ExternalizableDelegator.class
+commonj/sdo/Property.class
+commonj/sdo/Sequence.class
+commonj/sdo/Type.class
+xml/datagraph.xsd
+xml/sdoJava.xml
+xml/sdoJava.xsd
+xml/sdoModel.xml
+xml/sdoModel.xsd
+xml/sdoXML.xml
+xml/sdoXML.xsd
+
+
+License for the Service Data Objects JavaDoc and Interface Definition files.
+
+The Service Data Objects Specification is being provided by the copyright holders under the following
+license. By using and/or copying this work, you agree that you have read, understood and will comply with
+the following terms and conditions:
+
+Permission to copy, display and distribute the Service Data Objects Specification and/or portions thereof, without
+modification, in any medium without fee or royalty is hereby granted, provided that you include the
+following on ALL copies of the Service Data Objects Specification, or portions thereof, that you make:
+
+1. A link or URL to the Service Data Objects Specification at this location:
+http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
+
+2. The full text of this copyright notice as shown in the Service Data Objects Specification.
+
+BEA, IBM, Oracle, Primeton Technologies, Rogue Wave Software, SAP, Software AG, Sun Microsystems, Xcalia,
+Zend Technologies (collectively, the “Authors”) agree to grant you a royalty-free license, under reasonable,
+non-discriminatory terms and conditions to patents that they deem necessary to implement the Service Data
+Objects Specification.
+
+THE Service Data Objects SPECIFICATION IS PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR
+WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SPECIFICATION AND THE IMPLEMENTATION OF ITS 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.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or publicity
+pertaining to the Service Data Objects Specification or its contents without specific, written prior
+permission. Title to copyright in the Service Data Objects Specification will at all times remain with the
+Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+================================================================================
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/NOTICE b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/NOTICE
new file mode 100644
index 0000000000..0b2fe5dff3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/bin/NOTICE
@@ -0,0 +1,95 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses XmlSchema developed at
+The Apache Software Foundation (http://ws.apache.org/commons/XmlSchema)
+ Portions Copyright 2006 International Business Machines Corp.
+
+This product includes/uses ode-bpel-api-1.1 developed at
+The Apache Software Foundation (http://ode.apache.org)
+ - Copyright 1999-2006 Intalio - This product includes software developed by Intalio (http://www.intalio.com)
+ - Copyright 2006 Sybase - This product includes software developed by Sybase.(http://www.sybase.com)
+
+"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 Axion : the Open Source Java Database (http://axion.tigris.org/)
+ Copyright (c) 2002-2003 Axion Development Team. All rights reserved.
+
+This product includes/uses DOM4J : the flexible XML framework for java (http://www.dom4j.org/)
+ Copyright 2001-2005 (C) MetaStuff, Ltd. 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/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
+
+This product includes software from the GlassFish project (https://glassfish.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product includes software from the Rome project (https://rome.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product includes/uses the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+
+This product includes/uses the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+
+This product includes/uses the Sourceforge wsdl4j project (http://sourceforge.net/projects/wsdl4j/)i
+
+This product includes/uses the Codehaus JRuby project (http://jruby.codehaus.org/)
+
+This product includes/uses JDOM (http://www.jdom.org/)
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin. All rights reserved.
+
+This product includes/uses DWR (http://getahead.org/dwr)
+ Copyright 2005 Joe Walker. All rights reserved.
+
+This product includes/uses dojotoolkit (http://dojotoolkit.org/)
+ Copyright (c) 2005, The Dojo Foundation. All rights reserved.
+
+This product includes/uses Howl (http://howl.objectweb.org/)
+ Copyright (c) 2004, Bull S.A.
+
+This product includes/uses axion (http://axion.tigris.org/)
+ Copyright (c) 2002-2003 Axion Development Team.
+
+This product includes/uses javacc (https://javacc.dev.java.net/)
+ Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+
+The Program includes all or portions of the following software: "The
+Saxon XSLT and XQuery Processor from Saxonica Limited" distributed under
+an MPL v1.0 license. Please refer to the homepage URL at
+http://www.saxonica.com/.
+
+This product includes/uses Serp (http://serp.sourceforge.net/) under the BSD license:
+ Copyright (c) 2002, A. Abram White. All rights reserved.
+
+This product also includes software under the BSD license
+with the following copyright:
+ Copyright (c) 2006, Sun Microsystems, Inc. All rights reserved.
+
+This product includes software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
+This product includes software under the Service Data Objects JavaDoc and
+Interface Definition file license
+
+(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-android/distribution/features/repository/src/main/release/src/BUILDING b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/BUILDING
new file mode 100644
index 0000000000..65d09c5eae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/BUILDING
@@ -0,0 +1,55 @@
+Building the Apache Tuscany SCA 1.2 (incubating) April 2008 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 or higher.
+
+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.7 or higher, which can be downloaded from
+ http://maven.apache.org/download.html. Make sure that your PATH includes
+ the MVN_HOME/bin directory.
+
+4) Make sure that your MAVEN_OPTS environment variable has -Xmx128M (or more),
+ you can manually do this by executing the following in your prompt :
+ Windows users:
+ set MAVEN_OPTS=-Xmx128M
+ Unix users:
+ export MAVEN_OPTS=-Xmx128M
+
+
+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 distribution 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-android/distribution/features/repository/src/main/release/src/LICENSE b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/LICENSE
new file mode 100644
index 0000000000..144d8ae692
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/LICENSE
@@ -0,0 +1,397 @@
+
+ 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, Interface Definition files
+and XSD files.
+
+The Service Data Objects JavaDoc, Interface Definition files and XSD files
+are being provided by the copyright holders under the following license.
+By using and/or copying this work, you agree that you have read,
+understood and will comply with the following terms and conditions:
+
+Permission to copy, display, make derivative works of and distribute
+the Service Data Objects JavaDoc, Interface Definition files and XSD files
+(the "Artifacts") in any medium without fee or royalty is hereby granted,
+provided that you include the following on ALL copies of the Artifacts,
+or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+
+
+THE ARTIFACTS ARE PROVIDED "AS IS" AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+The name and trademarks of the Authors may NOT be used in any manner,
+including advertising or publicity pertaining to the Service Data
+Objects Specification or its contents without specific, written prior
+permission. Title to copyright in the Service Data Objects
+Specification will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.11, last updated on 2007/12/21
+
+=================================================================================================================
+
+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.
+
+=================================================================================================================
+
+The module assembly-xsd includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+=================================================================================================================
+The modules
+
+binding-ws-xml
+databinding
+databinding-axiom
+databinding-jaxb
+databinding-json
+databinding-sdo
+databinding-sdo-axiom
+databinding-xmlbeans
+interface-wsdl-xml
+
+Include the ipo.xsd and address.xsd information from the XML Schema Primer
+(http://www.w3.org/TR/2004/PER-xmlschema-0-20040318/) combined into the
+file ipo.xsd and extended with UK postcode structures.
+
+The ipo.xsd file is include under the following license:
+
+W3C(c) SOFTWARE NOTICE AND LICENSE
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee) agree
+that you have read, understood, and will comply with the following terms and conditions.
+
+Permission to copy, modify, and distribute this software and its documentation,
+with or without modification, for any purpose and without fee or royalty is
+hereby granted, provided that you include the following on ALL copies of the
+software and documentation or portions thereof, including modifications:
+
+ 1. The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.
+ 2. Any pre-existing intellectual property disclaimers, notices, or terms
+ and conditions. If none exist, the W3C Software Short Notice should be
+ included (hypertext is preferred, text is permitted) within the body of
+ any redistributed or derivative code.
+ 3. Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from which
+ the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
+NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,
+WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
+USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
+COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+The name and trademarks of copyright holders may NOT be used in advertising or
+publicity pertaining to the software without specific, written prior permission.
+Title to copyright in this software and any associated documentation will at all
+times remain with copyright holders.
diff --git a/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/NOTICE b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/NOTICE
new file mode 100644
index 0000000000..a37f9b03f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/features/repository/src/main/release/src/NOTICE
@@ -0,0 +1,39 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
+
+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 includes software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
+This product includes software under the Service Data Objects JavaDoc and
+Interface Definition file license
+
+(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.
+
+This product includes software under the W3C(c) Software License
+with the following copyright:
+
+Copyright (c) 2008 World Wide Web Consortium, (Massachusetts Institute of Technology,
+European Research Consortium for Informatics and Mathematics, Keio University).
+All Rights Reserved. This work is distributed under the W3C(c) Software License [1] in
+the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+
diff --git a/sca-java-1.x/branches/sca-android/distribution/pom.xml b/sca-java-1.x/branches/sca-android/distribution/pom.xml
new file mode 100644
index 0000000000..43c37d15d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/distribution/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-distribution</artifactId>
+ <name>Apache Tuscany SCA Distribution</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>features</module>
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/README b/sca-java-1.x/branches/sca-android/itest/admin/README
new file mode 100644
index 0000000000..c4e96d7af0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/README
@@ -0,0 +1,28 @@
+This is a simple test compiled to test simple features of SCA
+
+There are interfaces to different services that have been included
+
+1. MyListService
+2. MyListServiceByYear
+3. MyService
+4. MyServiceByDate
+5. MyTotalservice
+
+The service that has been used in the tests primarily is MyService/MyTotalService.
+in the test cases.
+
+There are three test cases and three composites (MySimppleService,Iteration1,Iteration3).
+
+1. MySimpleServiceTestCase - Checks if the components in MySimpleService.composite are initialized properly.
+ It tries to call simple functions implemented in MySimpleServiceImpl.
+
+2. MyTotalServiceTestCase - Initializes the components in the Iteration3Composite.composite file.
+ tries to call simple functions implemented in MyTotalServiceImpl.
+
+3. MySimpleServiceInRecursiveTestCase - Initializes the components in the Iteration1Composite.composite file.
+ It initializes its components using implementation:composite tag in the
+ composite file which points to MySimpleService.composite.
+ The test case recursively calls functions initialized in MySimpleService.composite.
+
+
+
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/pom.xml b/sca-java-1.x/branches/sca-android/itest/admin/pom.xml
new file mode 100644
index 0000000000..52a7bfb90a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-admin</artifactId>
+ <name>Apache Tuscany Admin Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListService.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListService.java
new file mode 100644
index 0000000000..b3d2137767
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListService.java
@@ -0,0 +1,9 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListService {
+ String[] getHolidays();
+ String getYear();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceByYear.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceByYear.java
new file mode 100644
index 0000000000..025302fb6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceByYear.java
@@ -0,0 +1,8 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListServiceByYear {
+ String[] getHolidays(int year);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceImpl.java
new file mode 100644
index 0000000000..de480e6d85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceImpl.java
@@ -0,0 +1,69 @@
+package org.apache.tuscany.sca.itest.admin;
+
+
+import java.util.List;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.sca.itest.admin.MyListService;
+import org.apache.tuscany.sca.itest.admin.MyListServiceByYear;
+
+@Service(interfaces={MyListService.class,MyListServiceByYear.class})
+
+public class MyListServiceImpl implements MyListService,MyListServiceByYear
+{
+
+ // This is multiplicity=1:n
+ @Reference(name="myListServiceList",required=true)
+ public List<MyListService> myListServicesList;
+
+ // This is multiplicity=0:n
+ @Reference(name="myListServiceArray",required=false)
+ public MyListService[] myListServicesArray;
+
+ @Property(name="serviceYear")
+ protected String year = "2006";
+
+ public String[] getHolidays()
+ {
+ return getHolidays(new Integer(year).intValue());
+ }
+
+ public String[] getHolidays(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-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyLogger.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyLogger.java
new file mode 100644
index 0000000000..8ff146b630
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyLogger.java
@@ -0,0 +1,17 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import java.io.PrintStream;
+
+public class MyLogger {
+
+ private PrintStream outStream;
+
+ public MyLogger(PrintStream out) {
+ this.outStream = out;
+ }
+
+ public void println(String text) {
+ outStream.println("MyLog: " + text);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyService.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyService.java
new file mode 100644
index 0000000000..638c6aff8c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyService.java
@@ -0,0 +1,9 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import java.util.Date;
+
+public interface MyService extends SCAComponentService{
+ Date nextHoliday();
+ String getLocation();
+ String getYear();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceByDate.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceByDate.java
new file mode 100644
index 0000000000..bd820884e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceByDate.java
@@ -0,0 +1,10 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyServiceByDate {
+ Date nextHoliday(Date date);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceImpl.java
new file mode 100644
index 0000000000..fa2720001b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceImpl.java
@@ -0,0 +1,113 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import java.util.Date;
+
+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;
+import org.apache.tuscany.sca.itest.admin.MyListService;
+import org.apache.tuscany.sca.itest.admin.MyListServiceByYear;
+import org.apache.tuscany.sca.itest.admin.MyLogger;
+import org.apache.tuscany.sca.itest.admin.MyService;
+import org.apache.tuscany.sca.itest.admin.MyServiceByDate;
+
+
+@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"},{"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";
+
+
+ private String componentName;
+
+
+ private MyLogger logger;
+
+ public MyServiceImpl()
+ {
+ logger = new MyLogger(System.out);
+ logger.println("creating service instance...");
+ }
+
+ public Date nextHoliday() {
+
+ return nextHoliday(new Date());
+ }
+
+
+ public Date nextHoliday(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[] getHolidays(int year)
+ {
+ int index = year -2006;
+ if (index>=0 && index<holidays.length)
+ return holidays[index];
+ return null;
+ }
+
+ public String[] getHolidays()
+ {
+
+ Integer theYear;
+ if (year ==null || year.length()==0)
+ theYear = new Integer("2006");
+ else
+ theYear = new Integer(year);
+
+ return getHolidays(theYear.intValue());
+ }
+
+ @Init
+ public void start()
+ {
+ logger.println("Start service..");
+ }
+
+ @Destroy
+ public void stop()
+ {
+ logger.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-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalService.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalService.java
new file mode 100644
index 0000000000..eec64fa0d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalService.java
@@ -0,0 +1,6 @@
+package org.apache.tuscany.sca.itest.admin;
+
+public interface MyTotalService extends MyListService, MyListServiceByYear, MyService, MyServiceByDate
+{
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceImpl.java
new file mode 100644
index 0000000000..d712662cb3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceImpl.java
@@ -0,0 +1,74 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import java.util.Date;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.ComponentName;
+import org.apache.tuscany.sca.itest.admin.MyListService;
+import org.apache.tuscany.sca.itest.admin.MyListServiceByYear;
+import org.apache.tuscany.sca.itest.admin.MyService;
+import org.apache.tuscany.sca.itest.admin.MyServiceByDate;
+import org.apache.tuscany.sca.itest.admin.MyTotalService;
+
+@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 (required=false)
+ 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();
+
+ @ComponentName
+ private String componentName;
+
+ public String[] getHolidays()
+ {
+ return myListService.getHolidays();
+ }
+
+ public String[] getHolidays(int year)
+ {
+ return myListServiceByYear.getHolidays(year);
+ }
+
+
+ public Date nextHoliday(Date date)
+ {
+ return myServiceByDate.nextHoliday(date);
+ }
+
+ public String getLocation()
+ {
+ return myService.getLocation();
+ }
+
+ public String getYear()
+ {
+ return myService.getYear();
+ }
+
+ public String getComponentName()
+ {
+ return componentName;
+ }
+
+ public Date nextHoliday()
+ {
+ return myService.nextHoliday();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/SCAComponentService.java b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/SCAComponentService.java
new file mode 100644
index 0000000000..42fa3f0c41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/SCAComponentService.java
@@ -0,0 +1,9 @@
+package org.apache.tuscany.sca.itest.admin;
+
+
+
+public interface SCAComponentService
+{
+ String getComponentName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceInRecursiveTestCase.java b/sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceInRecursiveTestCase.java
new file mode 100644
index 0000000000..bcf4153064
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceInRecursiveTestCase.java
@@ -0,0 +1,61 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.tuscany.sca.itest.admin.MyService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+
+public class MySimpleServiceInRecursiveTestCase
+{
+ private static MyService myServiceOrg;
+ private static MyService myServiceAnother;
+ private static MyService myServiceCary;
+
+ private static SCADomain domain;
+
+
+ @Test
+ public void testPropertyDefault()
+ {
+ assertEquals("RTP",myServiceOrg.getLocation());
+ assertEquals("2006",myServiceOrg.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideValue()
+ {
+ assertEquals("CARY",myServiceCary.getLocation());
+ assertEquals("2007",myServiceCary.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideVariable()
+ {
+ assertEquals("Durham",myServiceAnother.getLocation());
+ assertEquals("2009",myServiceAnother.getYear());
+ }
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("Iteration1Composite.composite");
+ } catch ( Exception e ) { e.printStackTrace(); }
+
+ myServiceOrg = domain.getService(MyService.class, "MySimpleServiceInRecursive/MyServiceOrig1");
+ myServiceCary = domain.getService(MyService.class, "MySimpleServiceInRecursive/MyServiceCary1");
+ myServiceAnother = domain.getService(MyService.class, "MySimpleServiceInRecursiveAnother/MyServiceNew1");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceTestCase.java
new file mode 100644
index 0000000000..747f71576c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceTestCase.java
@@ -0,0 +1,57 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.tuscany.sca.itest.admin.MyService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MySimpleServiceTestCase
+{
+ private static SCADomain domain;
+ private static MyService myServiceOrg;
+ private static MyService myServiceNew;
+ private static MyService myServiceCary;
+
+ @Test
+ public void testPropertyDefault()
+ {
+ assertEquals("RTP",myServiceOrg.getLocation());
+ assertEquals("2006",myServiceOrg.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideWithValue()
+ {
+ assertEquals("CARY",myServiceCary.getLocation());
+ assertEquals("2007",myServiceCary.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideWithVariable()
+ {
+ assertEquals("Raleigh",myServiceNew.getLocation());
+ assertEquals("2008",myServiceNew.getYear());
+ }
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("MySimpleService.composite");
+ } catch ( Exception e ) { System.out.println("Could not initialize " + e.toString());
+ e.printStackTrace(); }
+ myServiceOrg = domain.getService(MyService.class, "MyServiceComponentOrig/MyService");
+ myServiceCary = domain.getService(MyService.class, "MyServiceComponentCary2007/MyService");
+ myServiceNew = domain.getService(MyService.class, "MyServiceComponentNew/MyService");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceTestCase.java
new file mode 100644
index 0000000000..6c2dffb7b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceTestCase.java
@@ -0,0 +1,48 @@
+package org.apache.tuscany.sca.itest.admin;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.tuscany.sca.itest.admin.MyTotalService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MyTotalServiceTestCase
+{
+ private static MyTotalService myTotalServiceOrg;
+ private static MyTotalService myTotalServiceNew;
+
+ private static SCADomain domain;
+
+ @Test
+ public void testPropertyDefault()
+ {
+ assertEquals("RTP",myTotalServiceOrg.getLocation());
+ assertEquals("2006",myTotalServiceOrg.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideVariable()
+ {
+ assertEquals("Raleigh",myTotalServiceNew.getLocation());
+ assertEquals("2008",myTotalServiceNew.getYear());
+ }
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("Iteration3Composite.composite");
+ } catch ( Exception e ) { e.printStackTrace(); }
+
+ myTotalServiceOrg =domain.getService(MyTotalService.class, "MyTotalServiceComponent");
+ myTotalServiceNew=domain.getService(MyTotalService.class, "MyTotalServiceNewComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/Iteration1Composite.composite b/sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/Iteration1Composite.composite
new file mode 100644
index 0000000000..95dbbf0124
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/Iteration1Composite.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"
+ xmlns:foo="http://foo"
+ xmlns:cust="http://www.example.com/Customer"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ targetNamespace="http://foo"
+ name="Iteration1Composite" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <property name="newLocation" type="xs:anyURI">Raleigh</property>
+ <property name="newYear" type="xs:anyURI">2008</property>
+
+ <property name="anotherLocation" type="xs:anyURI">Durham</property>
+ <property name="anotherYear" type="xs:anyURI">2009</property>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite name="foo:MySimpleService"/>
+ </component>
+
+ <component name="MySimpleServiceInRecursiveAnother">
+ <implementation.composite name="foo:MySimpleService"/>
+ <property name="newLocation">Durham</property>
+ <property name="newYear">2009</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/Iteration3Composite.composite b/sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/Iteration3Composite.composite
new file mode 100644
index 0000000000..dd06d030d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/Iteration3Composite.composite
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0" name="Iteration3Composite"
+ targetNamespace="http://foo" local="true" autowire="false" requires="cns:confidentiality"
+ policySets="sns:secure">
+ <property name="newLocation" type="anyURI">Raleigh</property>
+ <property name="newYear" type="anyURI">2008</property>
+
+ <component name="MyServiceComponentOrig">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ </component>
+
+ <component name="MyServiceComponentCary2007">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceComponentNew">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ <property name="location" source="$newLocation"/>
+ <property name="year" source="$newYear"/>
+ </component>
+
+ <component name="MyTotalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceComponentOrig/MyService"/>
+ <reference name="myListService" target="MyServiceComponentOrig/MyListService"/>
+ </component>
+
+ <component name="MyTotalServiceNewComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceComponentNew/MyService"/>
+ <reference name="myListService" target="MyServiceComponentNew/MyListService"/>
+ </component>
+
+ <property name="anotherLocation" type="anyURI">Durham</property>
+ <property name="anotherYear" type="anyURI">2009</property>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite name="foo:MySimpleService"/>
+ </component>
+
+ <component name="MySimpleServiceInRecursiveAnother">
+ <implementation.composite name="foo:MySimpleService"/>
+ <property name="newLocation">Durham</property>
+ <property name="newYear">2009</property>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/MySimpleService.composite b/sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/MySimpleService.composite
new file mode 100644
index 0000000000..a1f8abb8da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/admin/src/test/resources/MySimpleService.composite
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ xmlns:cust="http://www.example.com/Customer"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ targetNamespace="http://foo"
+ name="MySimpleService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="MyServiceCary1" promote="MyServiceComponentCary2007/MyService">
+ <interface.java interface="org.apache.tuscany.sca.itest.admin.MyService"/>
+ </service>
+
+ <service name="MyServiceOrig1" promote="MyServiceComponentOrig/MyService">
+ <interface.java interface="org.apache.tuscany.sca.itest.admin.MyService"/>
+ </service>
+
+ <service name="MyServiceNew1" promote="MyServiceComponentNew/MyService">
+ <interface.java interface="org.apache.tuscany.sca.itest.admin.MyService"/>
+ </service>
+
+ <property name="newLocation" type="anyURI">Raleigh</property>
+ <property name="newYear" type="anyURI">2008</property>
+
+ <component name="MyServiceComponentOrig">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ </component>
+
+ <component name="MyServiceComponentCary2007">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceComponentNew">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ <property name="location" source="$newLocation"/>
+ <property name="year" source="$newYear"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/pom.xml b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/pom.xml
new file mode 100644
index 0000000000..9119be6ad6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-binidng-sca-jms</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-binding-sca-jms-client</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-jms</artifactId>
+ <version>1.4-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-android/itest/binding-sca-jms/client/src/main/java/itest/MyClientImpl.java b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/java/itest/MyClientImpl.java
new file mode 100644
index 0000000000..d1b4ecbd15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/java/itest/MyClientImpl.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 itest;
+
+import org.osoa.sca.annotations.Reference;
+
+public class MyClientImpl implements MyService {
+
+ @Reference public MyService delegate;
+
+ public String sayHello(String s) {
+ return "Hi " + delegate.sayHello(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/java/itest/MyService.java b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/java/itest/MyService.java
new file mode 100644
index 0000000000..e5123f087c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/java/itest/MyService.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 itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyService {
+
+ String sayHello(String s);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8c311553c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorC"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/resources/MyClient.composite b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/resources/MyClient.composite
new file mode 100644
index 0000000000..81aa3ed98d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/main/resources/MyClient.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"
+ targetNamespace="http://itest"
+ name="MyService">
+
+ <component name="MyClientComponent">
+ <implementation.java class="itest.MyClientImpl" />
+ <reference name="delegate" target="MyServiceComponent" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/test/java/itest/MyClientTestCase.java b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/test/java/itest/MyClientTestCase.java
new file mode 100644
index 0000000000..5c56dbaf84
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/client/src/test/java/itest/MyClientTestCase.java
@@ -0,0 +1,39 @@
+package itest;
+
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.Test;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class MyClientTestCase {
+
+ @Test
+ public void testCalculator() throws Exception {
+
+ SCANode serviceNode = SCANodeFactory.newInstance().createSCANode("MyService.composite", new SCAContribution("bla2", "../service/target/itest-binding-sca-jms-service.jar"));
+
+ SCANode clientNode = SCANodeFactory.newInstance().createSCANodeFromClassLoader("MyClient.composite", null);
+ try {
+
+ serviceNode.start();
+ clientNode.start();
+
+ MyService service = ((SCAClient)clientNode).getService(MyService.class, "MyClientComponent");
+
+ Assert.assertEquals("Hi Hello petra", service.sayHello("petra"));
+
+ } finally {
+ clientNode.stop();
+ serviceNode.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/pom.xml b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/pom.xml
new file mode 100644
index 0000000000..2a706dd404
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-binidng-sca-jms</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA JMS SCA Binding Integration Tests</name>
+
+ <modules>
+ <module>service</module>
+ <module>client</module>
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/pom.xml b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/pom.xml
new file mode 100644
index 0000000000..f57827b66d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-binidng-sca-jms</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-binding-sca-jms-service</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-jms</artifactId>
+ <version>1.4-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-android/itest/binding-sca-jms/service/src/main/java/itest/MyService.java b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/java/itest/MyService.java
new file mode 100644
index 0000000000..e5123f087c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/java/itest/MyService.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 itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyService {
+
+ String sayHello(String s);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/java/itest/MyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/java/itest/MyServiceImpl.java
new file mode 100644
index 0000000000..d0f8dcc393
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/java/itest/MyServiceImpl.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 itest;
+
+public class MyServiceImpl implements MyService {
+
+ public String sayHello(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8c311553c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorC"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/resources/MyService.composite b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/resources/MyService.composite
new file mode 100644
index 0000000000..03ac786809
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/main/resources/MyService.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://itest"
+ name="MyService">
+
+ <component name="MyServiceComponent">
+ <implementation.java class="itest.MyServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/test/java/itest/MyServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/test/java/itest/MyServiceTestCase.java
new file mode 100644
index 0000000000..cb79ae050a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/binding-sca-jms/service/src/test/java/itest/MyServiceTestCase.java
@@ -0,0 +1,34 @@
+package itest;
+
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.Test;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class MyServiceTestCase {
+
+ @Test
+ public void testCalculator() throws Exception {
+
+ SCANode node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("MyService.composite", null);
+ try {
+
+ node.start();
+
+ MyService service = ((SCAClient)node).getService(MyService.class, "MyServiceComponent");
+
+ Assert.assertEquals("Hello petra", service.sayHello("petra"));
+
+ } finally {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/pom.xml b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/pom.xml
new file mode 100644
index 0000000000..3a61b820d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/pom.xml
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-bpel</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-bpel-helloworld-reference</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Reference BPEL iTest</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.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-bpel-ode</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- http://jira.codehaus.org/browse/SUREFIRE-322 -->
+ <version>2.3.1</version>
+ <configuration>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!--
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <id>generate-bpel-helloworld</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/helloworld/helloworld.wsdl</schemaFile>
+ <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory>
+ <prefix>HelloWorld</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>${basedir}/src/test/resources/helloworld/helloworld.wsdl</fileName>
+ </wsdlFile>
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java
new file mode 100644
index 0000000000..532b84bd22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.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 greetings;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface GreetingsService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java
new file mode 100644
index 0000000000..86d7f245e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.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 greetings;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(GreetingsService.class)
+public class GreetingsServiceImpl implements GreetingsService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java
new file mode 100644
index 0000000000..8dea2715bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.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 greetings;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the Greetings service
+ *
+ * @version $Rev$ $Date$
+ */
+public class GreetingsTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ GreetingsService greetingsService = null;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("greetings/greetings.composite");
+ greetingsService = scaDomain.getService(GreetingsService.class, "GreetingsServiceComponent");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testInvoke() {
+ String response = greetingsService.getGreetings("Luciano");
+ assertEquals("Hello Luciano", response);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..672dbdc0b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/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;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String hello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..d7ebd5cbb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import greetings.GreetingsService;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ protected GreetingsService greetingsService;
+
+ public GreetingsService getGreetingsService() {
+ System.out.println("Got Injected greetingsService");
+ return greetingsService;
+ }
+
+ @Reference
+ public void setGreetingsService(GreetingsService greetingsService) {
+ System.out.println("Injected greetingsService");
+ this.greetingsService = greetingsService;
+ }
+
+ public String hello(String name) {
+ System.out.println("Calling greeting services getGreetings");
+ return greetingsService.getGreetings(name);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..bdfedee2f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL Helloworld Service
+ *
+ * @version $Rev$ $Date$
+ */
+public class HelloWorldTestCase extends TestCase {
+ private SCADomain scaDomain;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testServiceInvocation() {
+ HelloWorldService bpelService = scaDomain.getService(HelloWorldService.class, "HelloWorldService");
+ String response = bpelService.hello("Luciano");
+ assertEquals("Hello Luciano", response);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite
new file mode 100644
index 0000000000..dfec43e8e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.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"
+ targetNamespace="http://greetings"
+ xmlns:hw="http://greetings"
+ name="greetings">
+
+ <component name="GreetingsServiceComponent">
+ <implementation.java class="greetings.GreetingsServiceImpl" />
+ <service name="GreetingsService">
+ <interface.wsdl interface="http://greetings#wsdl.interface(Greetings)" />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl
new file mode 100644
index 0000000000..e768707ccd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="greetings"
+ targetNamespace="http://greetings"
+ xmlns:tns="http://greetings"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://greetings" 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="Greetings">
+ <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="GreetingsSoapBinding" type="tns:Greetings">
+ <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="GreetingsService">
+ <wsdl:port name="GreetingsSoapPort" binding="tns:GreetingsSoapBinding">
+ <wsdlsoap:address location="http://localhost:8085/GreetingsServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="GreetingsPartnerLinkType">
+ <plnk:role name="Provider" portType="tns:Greetings"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/deploy.xml b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/deploy.xml
new file mode 100644
index 0000000000..25d676bcfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:greetings="http://greetings"
+ xmlns:tus="http://tuscany.apache.org">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="tus:helloPartnerLink" port="HelloWorld"/>
+ </provide>
+ <invoke partnerLink="greetingsPartnerLink">
+ <service name="tus:greetingsPartnerLink" port="Greetings"/>
+ </invoke>
+ </process>
+</deploy>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel
new file mode 100644
index 0000000000..5ec2cc9f2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://helloworld"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:helloworld="http://helloworld"
+ xmlns:greetings="http://greetings"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://helloworld"/>
+
+ <import location="../greetings/greetings.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://greetings"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="helloworld:HelloPartnerLinkType" myRole="me" />
+ <partnerLink name="greetingsPartnerLink" partnerLinkType="greetings:GreetingsPartnerLinkType" partnerRole="Provider" initializePartnerRole="yes" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="helloMessage" messageType="helloworld:HelloMessage"/>
+ <variable name="helloResponse" messageType="helloworld:HelloMessage"/>
+ <variable name="greetingsRequest" messageType="greetings:getGreetingsRequest"/>
+ <variable name="greetingsResponse" messageType="greetings:getGreetingsResponse"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ createInstance="yes"
+ operation="hello"
+ variable="helloMessage"
+ partnerLink="helloPartnerLink"
+ portType="helloworld:HelloWorld" />
+
+ <assign name="assignToGreetingsRequest">
+ <copy>
+ <from>$helloMessage.TestPart</from>
+ <to>$greetingsRequest.parameters</to>
+ </copy>
+ </assign>
+
+ <invoke name="invokeGreetings"
+ operation="getGreetings"
+ inputVariable="greetingsRequest"
+ outputVariable="greetingsResponse"
+ partnerLink="greetingsPartnerLink"
+ portType="greetings:Greetings" />
+
+ <assign name="assignToHelloResponse">
+ <copy>
+ <from>$greetingsResponse.parameters/greetings:getGreetingsReturn</from>
+ <to>$helloResponse.TestPart</to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ operation="hello"
+ partnerLink="helloPartnerLink"
+ portType="helloworld:HelloWorld"
+ variable="helloResponse"/>
+ </sequence>
+</process>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType
new file mode 100644
index 0000000000..13d12e32a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType
@@ -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.
+-->
+<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="helloPartnerLink">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ </service>
+
+
+ <reference name="greetingsPartnerLink">
+ <interface.wsdl interface="http://greetings#wsdl.interface(Greetings)" />
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite
new file mode 100644
index 0000000000..504e2ccc5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.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://bpel"
+ xmlns:hns="http://helloworld"
+ name="helloworld">
+
+ <component name="HelloWorldService">
+ <implementation.bpel process="hns:HelloWorld"/>
+ <reference name="greetingsPartnerLink" target="GreetingsServiceComponent"/>
+ </component>
+
+ <component name="GreetingsServiceComponent">
+ <implementation.java class="greetings.GreetingsServiceImpl" />
+ <service name="GreetingsService">
+ <interface.wsdl interface="http://greetings#wsdl.interface(Greetings)" />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl
new file mode 100644
index 0000000000..0f51b96b27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl
@@ -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.
+ -->
+
+<wsdl:definitions name="helloworld"
+ targetNamespace="http://helloworld"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ 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"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://helloworld"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port name="HelloSoapPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloWorld"/>
+ <plnk:role name="you" portType="tns:HelloWorld"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/log4j.properties b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..4e13380e0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-reference/src/test/resources/log4j.properties
@@ -0,0 +1,36 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=OFF, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=OFF
+log4j.category.org.hibernate.type=OFF
+log4j.category.org.objectweb=OFF
+log4j.category.org.apache.ode.axis2=OFF
+log4j.category.org.apache.ode.bpel.engine=OFF
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
+log4j.category.org.apache.ode.bpel.epr=OFF
+log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG
+log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG
+log4j.category.org.apache.tuscany.sca.implementation.bpel.provider=DEBUG
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=[%p] - %C{1}.%M(%L) | %m%n
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/pom.xml b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/pom.xml
new file mode 100644
index 0000000000..eb11a6ad7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/pom.xml
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-bpel</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-bpel-helloworld-ws</artifactId>
+ <name>Apache Tuscany SCA HelloWorld BPEL iTest</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.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-bpel-ode</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-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>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- http://jira.codehaus.org/browse/SUREFIRE-322 -->
+ <version>2.3.1</version>
+ <configuration>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <id>generate-bpel-helloworld</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/helloworld/helloworld.wsdl</schemaFile>
+ <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory>
+ <prefix>HelloWorld</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>${basedir}/src/test/resources/helloworld/helloworld.wsdl</fileName>
+ </wsdlFile>
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorld.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..ffdbc50a22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorld.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 helloworld;
+
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloWorld {
+ private HelloPortType helloService;
+
+ public HelloWorld() {
+ super();
+ }
+
+ @Reference
+ public void setHelloService(HelloPortType helloService){
+ this.helloService = helloService;
+ }
+
+ public String hello(String hello) throws java.rmi.RemoteException {
+ System.out.println(">>> Invoking helloService.hello with : " + hello);
+ return this.helloService.hello(hello);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorldTestCase.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..6971151a77
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorldTestCase.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 helloworld;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL Helloworld Service
+ *
+ * @version $Rev$ $Date$
+ */
+public class HelloWorldTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ public void testServiceInvocation() throws Exception {
+ HelloPortType bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldServiceComponent");
+ String response = bpelService.hello("Hello");
+ assertEquals("Hello World", response);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/deploy.xml b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/deploy.xml
new file mode 100644
index 0000000000..9bd95b2c58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/deploy.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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:tus="http://tuscany.apache.org">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="tus:helloPartnerLink" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.bpel b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.bpel
new file mode 100644
index 0000000000..8cf91adc2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="helloMessage" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="helloMessage" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="helloMessage" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"/>
+ </sequence>
+</process>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.componentType b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.componentType
new file mode 100644
index 0000000000..2b360111cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/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="helloPartnerLink">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.composite
new file mode 100644
index 0000000000..f864f45613
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="helloworld">
+
+ <component name="BPELHelloWorldServiceComponent">
+ <implementation.bpel process="hns:HelloWorld"/>
+ <service name="helloPartnerLink">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ <binding.ws uri="http://localhost:8085/HelloPartnerLink" wsdlElement="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.service(HelloService)"/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.wsdl
new file mode 100644
index 0000000000..610bda3cc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.wsdl
@@ -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.
+ -->
+
+<wsdl:definitions name="helloworld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/log4j.properties b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..37f66e4189
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld-ws/src/test/resources/log4j.properties
@@ -0,0 +1,36 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=OFF, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=OFF
+log4j.category.org.hibernate.type=OFF
+log4j.category.org.objectweb=OFF
+log4j.category.org.apache.ode.axis2=OFF
+log4j.category.org.apache.ode.bpel.engine=OFF
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
+log4j.category.org.apache.ode.bpel.epr=OFF
+log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG
+log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG
+log4j.category.org.apache.tuscany.sca.implementation.bpel.provider=DEBUG
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=[%p] - %C{1}.%M(%L) | %m%n
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/pom.xml b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/pom.xml
new file mode 100644
index 0000000000..9b7786c270
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/pom.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-bpel</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-bpel-helloworld</artifactId>
+ <name>Apache Tuscany SCA HelloWorld BPEL iTest</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.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-bpel-ode</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- http://jira.codehaus.org/browse/SUREFIRE-322 -->
+ <version>2.3.1</version>
+ <configuration>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <id>generate-bpel-helloworld</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/helloworld/helloworld.wsdl</schemaFile>
+ <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory>
+ <prefix>HelloWorld</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>${basedir}/src/test/resources/helloworld/helloworld.wsdl</fileName>
+ </wsdlFile>
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..ffdbc50a22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.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 helloworld;
+
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloWorld {
+ private HelloPortType helloService;
+
+ public HelloWorld() {
+ super();
+ }
+
+ @Reference
+ public void setHelloService(HelloPortType helloService){
+ this.helloService = helloService;
+ }
+
+ public String hello(String hello) throws java.rmi.RemoteException {
+ System.out.println(">>> Invoking helloService.hello with : " + hello);
+ return this.helloService.hello(hello);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..76fcd35c2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.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 helloworld;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL Helloworld Service
+ *
+ * @version $Rev$ $Date$
+ */
+public class HelloWorldTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testServiceInvocation() throws Exception {
+ HelloPortType bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldService");
+ String response = bpelService.hello("Hello");
+ assertEquals("Hello World", response);
+ }
+
+ public void testReferenceInvocation() throws Exception {
+ HelloWorld bpelService = scaDomain.getService(HelloWorld.class, "BPELHelloWorld");
+ String response = bpelService.hello("Hello");
+ assertEquals("Hello World", response);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml
new file mode 100644
index 0000000000..9bd95b2c58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/deploy.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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:tus="http://tuscany.apache.org">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="tus:helloPartnerLink" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel
new file mode 100644
index 0000000000..8cf91adc2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="helloMessage" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="helloMessage" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="helloMessage" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"/>
+ </sequence>
+</process>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.componentType b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.componentType
new file mode 100644
index 0000000000..2b360111cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/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="helloPartnerLink">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite
new file mode 100644
index 0000000000..f6b12fb14b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.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://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="helloworld">
+
+ <component name="BPELHelloWorld">
+ <implementation.java class="helloworld.HelloWorld"/>
+ <reference name="helloService" target="BPELHelloWorldService">
+ <!-- Workaround for databinding issue -->
+ <!-- interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" / -->
+ </reference>
+ </component>
+
+ <component name="BPELHelloWorldService">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl
new file mode 100644
index 0000000000..610bda3cc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl
@@ -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.
+ -->
+
+<wsdl:definitions name="helloworld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/log4j.properties b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..37f66e4189
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/helloworld/src/test/resources/log4j.properties
@@ -0,0 +1,36 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=OFF, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=OFF
+log4j.category.org.hibernate.type=OFF
+log4j.category.org.objectweb=OFF
+log4j.category.org.apache.ode.axis2=OFF
+log4j.category.org.apache.ode.bpel.engine=OFF
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
+log4j.category.org.apache.ode.bpel.epr=OFF
+log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG
+log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG
+log4j.category.org.apache.tuscany.sca.implementation.bpel.provider=DEBUG
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=[%p] - %C{1}.%M(%L) | %m%n
diff --git a/sca-java-1.x/branches/sca-android/itest/bpel/pom.xml b/sca-java-1.x/branches/sca-android/itest/bpel/pom.xml
new file mode 100644
index 0000000000..7168e27f98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/bpel/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-bpel</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA BPEL Integration Tests</name>
+
+ <modules>
+ <module>helloworld</module>
+ <module>helloworld-ws</module>
+ <module>helloworld-reference</module>
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/pom.xml b/sca-java-1.x/branches/sca-android/itest/builder/pom.xml
new file mode 100644
index 0000000000..4855b0cfe6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-builder</artifactId>
+ <name>Apache Tuscany SCA Builder Integration Test</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-monitor-logging</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</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-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java
new file mode 100644
index 0000000000..932ae3987a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.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.builder;
+
+import java.util.List;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation class for ComponentD.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(interfaces={Service3.class, Service3a.class})
+public class ComponentDImpl implements Service3, Service3a {
+
+ @Reference
+ protected Service3a reference3;
+
+ public String getGreetings(String name) {
+ return "Hello, " + name + "!";
+ }
+
+ public String getGreetings2(String name) {
+ return "Goodbye, " + name + "!";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java
new file mode 100644
index 0000000000..f9ef0a1b4f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.builder;
+
+import java.util.List;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation class for ComponentD.
+ *
+ * @version $Rev: 678875 $ $Date: 2008-07-22 21:01:07 +0100 (Tue, 22 Jul 2008) $
+ */
+@Service(interfaces={Service3.class, Service3a.class})
+public class ComponentDReferenceMultiplicityImpl implements Service3, Service3a {
+
+ @Reference
+ protected Service3a reference3;
+
+ @Reference
+ protected List<Service3> reference3a;
+
+ public String getGreetings(String name) {
+ return "Hello, " + name + "!";
+ }
+
+ public String getGreetings2(String name) {
+ return "Goodbye, " + name + "!";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java
new file mode 100644
index 0000000000..c041a76b47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.builder;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation class for ComponentD.
+ *
+ * @version $Rev: 678875 $ $Date: 2008-07-22 21:01:07 +0100 (Tue, 22 Jul 2008) $
+ */
+@Service(interfaces={Service3.class})
+public class ComponentEImpl implements Service3 {
+
+
+ public String getGreetings(String name) {
+ return "Hello, " + name + " from ComponentE";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java
new file mode 100644
index 0000000000..ccfeff0997
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.builder;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation class for ComponentD.
+ *
+ * @version $Rev: 678875 $ $Date: 2008-07-22 21:01:07 +0100 (Tue, 22 Jul 2008) $
+ */
+@Service(interfaces={Service3.class})
+public class ComponentFImpl implements Service3 {
+
+
+ public String getGreetings(String name) {
+ return "Hello, " + name + " from ComponentF";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java
new file mode 100644
index 0000000000..9a775feec9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.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.builder;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Interface for Service3 in ComponentD.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Service3 {
+
+ String getGreetings(String name);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java
new file mode 100644
index 0000000000..98a1741fb6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.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.builder;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Interface for Service3a in ComponentD.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Service3a {
+
+ String getGreetings2(String name);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..256d01be58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario1"
+ xmlns:ns1="http://scenario1">
+ <deployable composite="ns1:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/scenario1.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/scenario1.composite
new file mode 100644
index 0000000000..5c2a98ab40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/scenario1.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://scenario1"
+ xmlns:tns="http://scenario1"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/scenario1a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/scenario1a.composite
new file mode 100644
index 0000000000..21b5897aa1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario1/scenario1a.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"
+ targetNamespace="http://scenario1"
+ xmlns:tns="http://scenario1"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..083079ba42
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario10"
+ xmlns:ns10="http://scenario10">
+ <deployable composite="ns10:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/scenario10.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/scenario10.composite
new file mode 100644
index 0000000000..c24b7f0046
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/scenario10.composite
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario10"
+ xmlns:tns="http://scenario10"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference1a" promote="ComponentB/reference2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference2" target="ComponentB/Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </reference>
+ <reference name="reference2a" target="ComponentF">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3)" />
+ <binding.ws />
+ </reference>
+ </component>
+
+ <component name="ComponentF">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/scenario10a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/scenario10a.composite
new file mode 100644
index 0000000000..27a73d5c41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/scenario10a.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario10"
+ xmlns:tns="http://scenario10"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a" promote="ComponentD/reference3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3" target="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference3a" target="ComponentE">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+
+ <component name="ComponentE">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/service3.wsdl b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/service3.wsdl
new file mode 100644
index 0000000000..14edcc00e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario10/service3.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 name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings">
+ <wsdl:part name="getGreetings" element="tns:getGreetings" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part name="getGreetingsResponse" element="tns:getGreetingsResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetings" />
+ <wsdl:output message="tns:getGreetingsResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..a6e4b65970
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario11"
+ xmlns:ns11="http://scenario11">
+ <deployable composite="ns11:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/scenario11.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/scenario11.composite
new file mode 100644
index 0000000000..3a94152e6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/scenario11.composite
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario11"
+ xmlns:tns="http://scenario11"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference1a" promote="ComponentB/reference2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a" target="ComponentF">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+
+ <component name="ComponentF">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/scenario11a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/scenario11a.composite
new file mode 100644
index 0000000000..6130c68651
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/scenario11a.composite
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario11"
+ xmlns:tns="http://scenario11"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3" target="ComponentB/Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </reference>
+ <reference name="reference2a" promote="ComponentD/reference3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3)" />
+ <binding.ws />
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3" target="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference3a" target="ComponentE">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+
+ <component name="ComponentE">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/service3.wsdl b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/service3.wsdl
new file mode 100644
index 0000000000..14edcc00e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario11/service3.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 name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings">
+ <wsdl:part name="getGreetings" element="tns:getGreetings" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part name="getGreetingsResponse" element="tns:getGreetingsResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetings" />
+ <wsdl:output message="tns:getGreetingsResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..125bdc5e53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario12"
+ xmlns:ns12="http://scenario12">
+ <deployable composite="ns12:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/scenario12.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/scenario12.composite
new file mode 100644
index 0000000000..aabd445e23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/scenario12.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"
+ targetNamespace="http://scenario12"
+ xmlns:tns="http://scenario12"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference1a" promote="ComponentB/reference2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a" target="ComponentF">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+
+ <component name="ComponentF">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/scenario12a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/scenario12a.composite
new file mode 100644
index 0000000000..a2ccc47c28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario12/scenario12a.composite
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario12"
+ xmlns:tns="http://scenario12"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a" promote="ComponentD/reference3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference3" target="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws/>
+ </reference>
+ <reference name="reference3a" target="ComponentE">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </reference>
+ </component>
+
+ <component name="ComponentE">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..c906c6c5b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario13"
+ xmlns:ns13="http://scenario13">
+ <deployable composite="ns13:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/scenario13.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/scenario13.composite
new file mode 100644
index 0000000000..ed59cd2adf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/scenario13.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"
+ targetNamespace="http://scenario13"
+ xmlns:tns="http://scenario13"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference1a" promote="ComponentB/reference2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+
+ <component name="ComponentF">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/scenario13a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/scenario13a.composite
new file mode 100644
index 0000000000..41150f78fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario13/scenario13a.composite
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario13"
+ xmlns:tns="http://scenario13"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a" promote="ComponentD/reference3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference3" target="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws/>
+ </reference>
+ <reference name="reference3a" target="ComponentE">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </reference>
+ </component>
+
+ <component name="ComponentE">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..6fa901c4df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario2"
+ xmlns:ns2="http://scenario2">
+ <deployable composite="ns2:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/scenario2.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/scenario2.composite
new file mode 100644
index 0000000000..66f88294ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/scenario2.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://scenario2"
+ xmlns:tns="http://scenario2"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/scenario2a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/scenario2a.composite
new file mode 100644
index 0000000000..db1af4743f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario2/scenario2a.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"
+ targetNamespace="http://scenario2"
+ xmlns:tns="http://scenario2"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..f5899ab1f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario3"
+ xmlns:ns3="http://scenario3">
+ <deployable composite="ns3:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/scenario3.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/scenario3.composite
new file mode 100644
index 0000000000..4b37c19e4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/scenario3.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"
+ targetNamespace="http://scenario3"
+ xmlns:tns="http://scenario3"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/scenario3a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/scenario3a.composite
new file mode 100644
index 0000000000..fedd79ff3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario3/scenario3a.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario3"
+ xmlns:tns="http://scenario3"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..642245ea7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario4"
+ xmlns:ns4="http://scenario4">
+ <deployable composite="ns4:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/scenario4.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/scenario4.composite
new file mode 100644
index 0000000000..1bb876b33d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/scenario4.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"
+ targetNamespace="http://scenario4"
+ xmlns:tns="http://scenario4"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/scenario4a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/scenario4a.composite
new file mode 100644
index 0000000000..55e13700a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario4/scenario4a.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario4"
+ xmlns:tns="http://scenario4"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..92da17179f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario5"
+ xmlns:ns5="http://scenario5">
+ <deployable composite="ns5:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenario5.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenario5.composite
new file mode 100644
index 0000000000..403e19b087
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenario5.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario5"
+ xmlns:tns="http://scenario5"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3a)" />
+ <binding.ws uri="http://foo.com/bar" />
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenario5a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenario5a.composite
new file mode 100644
index 0000000000..0e37ded0e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenario5a.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"
+ targetNamespace="http://scenario5"
+ xmlns:tns="http://scenario5"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenarios.wsdl b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenarios.wsdl
new file mode 100644
index 0000000000..7480419231
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario5/scenarios.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 name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetings2Response">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings2">
+ <wsdl:part name="getGreetings2" element="tns:getGreetings2" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings2Response">
+ <wsdl:part name="getGreetings2Response" element="tns:getGreetings2Response" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3a">
+ <wsdl:operation name="getGreetings2">
+ <wsdl:input message="tns:getGreetings2" />
+ <wsdl:output message="tns:getGreetings2Response" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..42d45b0b98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario6"
+ xmlns:ns6="http://scenario6">
+ <deployable composite="ns6:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenario6.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenario6.composite
new file mode 100644
index 0000000000..1c89139905
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenario6.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"
+ targetNamespace="http://scenario6"
+ xmlns:tns="http://scenario6"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference2" target="ComponentB/Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3a)" />
+ <binding.ws />
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenario6a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenario6a.composite
new file mode 100644
index 0000000000..853703a353
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenario6a.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"
+ targetNamespace="http://scenario6"
+ xmlns:tns="http://scenario6"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenarios.wsdl b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenarios.wsdl
new file mode 100644
index 0000000000..7480419231
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario6/scenarios.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 name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetings2Response">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings2">
+ <wsdl:part name="getGreetings2" element="tns:getGreetings2" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings2Response">
+ <wsdl:part name="getGreetings2Response" element="tns:getGreetings2Response" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3a">
+ <wsdl:operation name="getGreetings2">
+ <wsdl:input message="tns:getGreetings2" />
+ <wsdl:output message="tns:getGreetings2Response" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..44c471cc65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario7"
+ xmlns:ns7="http://scenario7">
+ <deployable composite="ns7:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenario7.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenario7.composite
new file mode 100644
index 0000000000..6b1ac24cec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenario7.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://scenario7"
+ xmlns:tns="http://scenario7"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenario7a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenario7a.composite
new file mode 100644
index 0000000000..8e0cebbdd5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenario7a.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"
+ targetNamespace="http://scenario7"
+ xmlns:tns="http://scenario7"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3" target="ComponentB/Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3a)" />
+ <binding.ws />
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenarios.wsdl b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenarios.wsdl
new file mode 100644
index 0000000000..7480419231
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario7/scenarios.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 name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetings2Response">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings2">
+ <wsdl:part name="getGreetings2" element="tns:getGreetings2" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings2Response">
+ <wsdl:part name="getGreetings2Response" element="tns:getGreetings2Response" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3a">
+ <wsdl:operation name="getGreetings2">
+ <wsdl:input message="tns:getGreetings2" />
+ <wsdl:output message="tns:getGreetings2Response" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..7cb09d0a74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario8"
+ xmlns:ns8="http://scenario8">
+ <deployable composite="ns8:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenario8.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenario8.composite
new file mode 100644
index 0000000000..26e5ee33fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenario8.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"
+ targetNamespace="http://scenario8"
+ xmlns:tns="http://scenario8"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenario8a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenario8a.composite
new file mode 100644
index 0000000000..4fa0712199
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenario8a.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"
+ targetNamespace="http://scenario8"
+ xmlns:tns="http://scenario8"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference3" target="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3a)" />
+ <binding.ws />
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenarios.wsdl b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenarios.wsdl
new file mode 100644
index 0000000000..7480419231
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario8/scenarios.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 name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetings2Response">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings2">
+ <wsdl:part name="getGreetings2" element="tns:getGreetings2" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings2Response">
+ <wsdl:part name="getGreetings2Response" element="tns:getGreetings2Response" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3a">
+ <wsdl:operation name="getGreetings2">
+ <wsdl:input message="tns:getGreetings2" />
+ <wsdl:output message="tns:getGreetings2Response" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..6e0908702b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario9"
+ xmlns:ns9="http://scenario9">
+ <deployable composite="ns9:CompositeA" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/scenario9.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/scenario9.composite
new file mode 100644
index 0000000000..3fce35470e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/scenario9.composite
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario9"
+ xmlns:tns="http://scenario9"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar"/>
+ </reference>
+ <reference name="reference1a" promote="ComponentB/reference2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar"/>
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+
+ <component name="ComponentF">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/scenario9a.composite b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/scenario9a.composite
new file mode 100644
index 0000000000..6e86c547b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/main/resources/scenario9/scenario9a.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario9"
+ xmlns:tns="http://scenario9"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a" promote="ComponentD/reference3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3" target="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference3a" target="ComponentE">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+
+ <component name="ComponentE">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java b/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java
new file mode 100644
index 0000000000..1f45cb4a66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java
@@ -0,0 +1,805 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.builder;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.xml.namespace.QName;
+import junit.framework.TestCase;
+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.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+
+/**
+ * Load and build some composites and inspect the results.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BuilderTestCase extends TestCase {
+ private CustomCompositeBuilder customBuilder;
+
+ @Override
+ protected void setUp() throws Exception {
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ }
+
+
+ // Scenario 1: <binding.ws> on outer composite service CompositeA/Service1
+ public void testScenario1() throws Exception {
+ System.out.println("====>Running testScenario1");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario1.composite", "TestContribution", "src/main/resources/scenario1/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario1Results(false);
+ }
+
+ public void testScenario1NonWiring() throws Exception {
+ System.out.println("====>Running testScenario1NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario1.composite", "TestContribution", "src/main/resources/scenario1/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario1Results(true);
+ }
+
+ private void checkScenario1Results(boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ if (!nonWiring) {
+ // Should create component service $promoted$Service1 on innermost component
+ // ComponentD, with <binding.ws> and uri="/Service1"
+ // No other services on ComponentD should have <binding.ws>
+ WebServiceBinding wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
+ if ("$promoted$Service1".equals(service.getName())) {
+ wsBinding = wsb;
+ } else {
+ assert wsb == null;
+ }
+ }
+ assert "/Service1".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$Service1 with endpoint uri="/Service1"
+ Definition def = wsBinding.getWSDLDocument();
+ javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ Port port = svc.getPort("Service3Port");
+ assert "/Service1".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not create component service $promoted$Service1 on innermost component ComponentD
+ // No component services on ComponentD should have <binding.ws>
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$Service1".equals(service.getName());
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+
+ // No services on ComponentB should have <binding.ws>
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ for (ComponentService service : componentB.getServices()) {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+
+ // No services on CompositeC should have <binding.ws>
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario1", "CompositeC"));
+ for (Service service : compositeC.getServices()) {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+
+ if (nonWiring) {
+ // Should not add a WSDL document to domain composite service Service1
+ WebServiceBinding wsBinding = null;
+ for (Service service : domainComposite.getServices()) {
+ if ("Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert wsBinding.getWSDLDocument() == null;
+ }
+ }
+
+ // Scenario 2: <binding.ws> on outer component service ComponentB/Service2
+ public void testScenario2() throws Exception {
+ System.out.println("====>Running testScenario2");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario2.composite", "TestContribution", "src/main/resources/scenario2/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario2and3Results("http://scenario2", false);
+ }
+
+ public void testScenario2NonWiring() throws Exception {
+ System.out.println("====>Running testScenario2NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario2.composite", "TestContribution", "src/main/resources/scenario2/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario2and3Results("http://scenario2", true);
+ }
+
+ private void checkScenario2and3Results(String namespace, boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2"
+ // No other services on ComponentB should have <binding.ws>
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ WebServiceBinding wsBinding = null;
+ for (ComponentService service : componentB.getServices()) {
+ WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
+ if ("Service2".equals(service.getName())) {
+ wsBinding = wsb;
+ } else {
+ assert wsb == null;
+ }
+ }
+ Definition def = wsBinding.getWSDLDocument();
+ javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ Port port = svc.getPort("Service3Port");
+ assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ if (!nonWiring) {
+ // Should create component service $promoted$ComponentB$slash$Service2 on innermost component
+ // ComponentD, with <binding.ws> and uri="/ComponentB/Service2"
+ wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("$promoted$ComponentB$slash$Service2".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert "/ComponentB/Service2".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$ComponentB$slash$Service2 with endpoint uri="/ComponentB/Service2"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not create component service $promoted$ComponentB$slash$Service2 on innermost component ComponentD
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$ComponentB$slash$Service2".equals(service.getName());
+ }
+ }
+
+ // Should add <binding.ws> to outer composite service CompositeA/Service1
+ wsBinding = null;
+ for (Service service : domainComposite.getServices()) {
+ if ("Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert wsBinding != null;
+ if (nonWiring) {
+ // Should not add a WSDL document to domain composite service Service1
+ assert wsBinding.getWSDLDocument() == null;
+ }
+
+ if (!nonWiring) {
+ // Should create component service $promoted$Service1 on innermost component
+ // ComponentD, with <binding.ws> and uri="/Service1"
+ wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("$promoted$Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert "/Service1".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$Service1 with endpoint uri="/Service1"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/Service1".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not create component service $promoted$.Service1 on innermost component ComponentD
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$Service1".equals(service.getName());
+ }
+ }
+
+ // No services on ComponentD should have <binding.ws>, except for $promoted$Service1
+ // and $promoted$ComponentB$slash$Service2
+ for (ComponentService service : componentD.getServices()) {
+ if (!"$promoted$Service1".equals(service.getName()) &&
+ !"$promoted$ComponentB$slash$Service2".equals(service.getName())) {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+
+ // No services on CompositeC should have <binding.ws>, except for Service2 in Scenario 3
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName(namespace, "CompositeC"));
+ for (Service service : compositeC.getServices()) {
+ if ("http://scenario3".equals(namespace) && "Service2".equals(service.getName())) {
+ assert service.getBinding(WebServiceBinding.class) != null;
+ } else {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+ }
+
+ // Scenario 3: <binding.ws> on inner composite service CompositeC/Service2
+ public void testScenario3() throws Exception {
+ System.out.println("====>Running testScenario3");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario3.composite", "TestContribution", "src/main/resources/scenario3/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario2and3Results("http://scenario3", false);
+ }
+
+ public void testScenario3NonWiring() throws Exception {
+ System.out.println("====>Running testScenario3NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario3.composite", "TestContribution", "src/main/resources/scenario3/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario2and3Results("http://scenario3", true);
+ }
+
+ // Scenario 4: <binding.ws> on inner component service ComponentD/Service3
+ public void testScenario4() throws Exception {
+ System.out.println("====>Running testScenario4");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario4.composite", "TestContribution", "src/main/resources/scenario4/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario4Results(false);
+ }
+
+ public void testScenario4NonWiring() throws Exception {
+ System.out.println("====>Running testScenario4NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario4.composite", "TestContribution", "src/main/resources/scenario4/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario4Results(true);
+ }
+
+ private void checkScenario4Results(boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should create WSDL document for ComponentD/Service3 with endpoint uri="/ComponentD/Service3"
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ WebServiceBinding wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("Service3".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ Definition def = wsBinding.getWSDLDocument();
+ javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ Port port = svc.getPort("Service3Port");
+ assert "/ComponentB/ComponentD/Service3".equals(TestUtils.getPortAddress(port));
+
+ // Should add <binding.ws> to inner composite service CompositeC/Service2
+ // No other services on CompositeC should have <binding.ws>
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario4", "CompositeC"));
+ wsBinding = null;
+ for (Service service : compositeC.getServices()) {
+ WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
+ if ("Service2".equals(service.getName())) {
+ wsBinding = wsb;
+ } else {
+ assert wsb == null;
+ }
+ }
+ assert "/ComponentB/Service2".equals(wsBinding.getURI());
+
+ // Should add <binding.ws> to outer component service ComponentB/Service2
+ // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2"
+ // No other services on ComponentB should have <binding.ws>
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ wsBinding = null;
+ for (ComponentService service : componentB.getServices()) {
+ WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
+ if ("Service2".equals(service.getName())) {
+ wsBinding = wsb;
+ } else {
+ assert wsb == null;
+ }
+ }
+ assert "/ComponentB/Service2".equals(wsBinding.getURI());
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
+
+ if (!nonWiring) {
+ // Should create component service $promoted$ComponentB$slash$Service2 on innermost component
+ // ComponentD, with <binding.ws> and uri="/ComponentB/Service2"
+ wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("$promoted$ComponentB$slash$Service2".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert "/ComponentB/Service2".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$ComponentB$slash$Service2 with endpoint uri="/ComponentB/Service2"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not create component service $promoted$ComponentB$slash$Service2 on innermost component ComponentD
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$ComponentB$slash$Service2".equals(service.getName());
+ }
+ }
+
+ // Should add <binding.ws> to outer composite service CompositeA/Service1
+ wsBinding = null;
+ for (Service service : domainComposite.getServices()) {
+ if ("Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert wsBinding != null;
+ if (nonWiring) {
+ // Should not add a WSDL document to domain composite service Service1
+ assert wsBinding.getWSDLDocument() == null;
+ }
+
+ if (!nonWiring) {
+ // Should create component service $promoted$Service1 on innermost component
+ // ComponentD, with <binding.ws> and uri="/Service1"
+ wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("$promoted$Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert "/Service1".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$Service1 with endpoint uri="/Service1"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/Service1".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not create component service $promoted$.Service1 on innermost component ComponentD
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$Service1".equals(service.getName());
+ }
+ }
+
+ // No services on ComponentD should have <binding.ws>, except for Service3,
+ // $promoted$.Service1 and $promoted$.ComponentB.Service2
+ for (ComponentService service : componentD.getServices()) {
+ if (!"Service3".equals(service.getName()) &&
+ !"$promoted$Service1".equals(service.getName()) &&
+ !"$promoted$ComponentB$slash$Service2".equals(service.getName())) {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+ }
+
+ // Scenario 5: <binding.ws> and <interface.wsdl> on outer composite reference CompositeA/reference1
+ public void testScenario5() throws Exception {
+ System.out.println("====>Running testScenario5");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario5.composite", "TestContribution", "src/main/resources/scenario5/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario5Results(false);
+ }
+
+ public void testScenario5NonWiring() throws Exception {
+ System.out.println("====>Running testScenario5NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario5.composite", "TestContribution", "src/main/resources/scenario5/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario5Results(true);
+ }
+
+ private void checkScenario5Results(boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should not add <binding.ws> to any outer component references
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ for (ComponentReference reference : componentB.getReferences()) {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ }
+
+ Definition def;
+ javax.wsdl.Service svc;
+ Port port;
+ WebServiceBinding wsBinding;
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ if (!nonWiring) {
+ // Should add <binding.ws> to inner component reference ComponentD/reference3 with uri="http://foo.com/bar"
+ // Should set <interface.wsdl> on inner component reference ComponentD/reference3
+ wsBinding = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract(wsBinding) instanceof WSDLInterfaceContract;
+ }
+ }
+ assert "http://foo.com/bar".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://scenarios/ComponentD/reference3", "Service3aService"));
+ port = svc.getPort("Service3aPort");
+ assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not add <binding.ws> to any inner component references
+ for (ComponentReference reference : componentD.getReferences()) {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+
+ // Should not add <binding.ws> or <interface.wsdl> to inner composite reference CompositeC/reference2
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario5", "CompositeC"));
+ for (Reference reference : compositeC.getReferences()) {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ assert reference.getInterfaceContract() instanceof JavaInterfaceContract;
+ }
+ }
+
+ // Scenario 6: <binding.ws> and <interface.wsdl> on outer component reference ComponentB/reference2
+ public void testScenario6() throws Exception {
+ System.out.println("====>Running testScenario6");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario6.composite", "TestContribution", "src/main/resources/scenario6/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario6and7Results("http://scenario6", false);
+ }
+
+ public void testScenario6NonWiring() throws Exception {
+ System.out.println("====>Running testScenario6NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario6.composite", "TestContribution", "src/main/resources/scenario6/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario6and7Results("http://scenario6", true);
+ }
+
+ private void checkScenario6and7Results(String namespace, boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should remove target= on ComponentB/reference2 (for Scenario 6) or
+ // CompositeC/reference2 (for Scenario 7), and add uri="http://foo.com/bar"
+ // to the <binding.ws> element on ComponentB/reference2
+ // For nonWiring, ComponentB/reference2 should have target=
+ // and no uri= should be added
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ WebServiceBinding wsBinding = null;
+ for (ComponentReference reference : componentB.getReferences()) {
+ if ("reference2".equals(reference.getName())) {
+ if (!nonWiring) {
+ assert reference.getTargets().size() == 0;
+ } else {
+ assert reference.getTargets().size() == 1;
+ }
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ }
+ }
+ if (!nonWiring) {
+ assert "http://foo.com/bar".equals(wsBinding.getURI());
+ } else {
+ assert wsBinding.getURI() == null;
+ }
+
+ Definition def;
+ javax.wsdl.Service svc;
+ Port port;
+ if (!nonWiring) {
+ // Should create WSDL document for ComponentB/reference2 with endpoint uri="http://foo.com/bar"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService"));
+ port = svc.getPort("Service3aPort");
+ assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
+ }
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ if (!nonWiring) {
+ // Should add <binding.ws> to inner component reference ComponentD/reference3 with uri="http://foo.com/bar"
+ // Should set <interface.wsdl> on inner component reference ComponentD/reference3
+ wsBinding = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getBindings().size() == 1;
+ assert reference.getInterfaceContract(wsBinding) instanceof WSDLInterfaceContract;
+ }
+ }
+ assert "http://foo.com/bar".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService"));
+ port = svc.getPort("Service3aPort");
+ assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not add <binding.ws> to any inner component references
+ for (ComponentReference reference : componentD.getReferences()) {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+
+ // No references on CompositeC should have <binding.ws> or <interface.wsdl>, except for
+ // reference2 in Scenario 7
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName(namespace, "CompositeC"));
+ for (Reference reference : compositeC.getReferences()) {
+ if ("http://scenario7".equals(namespace) && "reference2".equals(reference.getName())) {
+ assert reference.getBinding(WebServiceBinding.class)!= null;
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ } else {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ assert reference.getInterfaceContract() instanceof JavaInterfaceContract;
+ }
+ }
+
+ // Should add <binding.ws> and <interface.wsdl> to outer composite reference CompositeA/reference1
+ wsBinding = null;
+ for (Reference reference : domainComposite.getReferences()) {
+ if ("reference1".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert wsBinding.getURI() == null;
+
+ // Should not add a WSDL document to domain composite reference reference1
+ assert wsBinding.getWSDLDocument() == null;
+ }
+
+ // Scenario 7: <binding.ws> and <interface.wsdl> on inner composite reference CompositeC/reference2
+ public void testScenario7() throws Exception {
+ System.out.println("====>Running testScenario7");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario7.composite", "TestContribution", "src/main/resources/scenario7/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario6and7Results("http://scenario7", false);
+ }
+
+ public void testScenario7NonWiring() throws Exception {
+ System.out.println("====>Running testScenario7NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario7.composite", "TestContribution", "src/main/resources/scenario7/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario6and7Results("http://scenario7", true);
+ }
+
+ // Scenario 8: <binding.ws> and <interface.wsdl> on inner component reference ComponentD/reference3
+ public void testScenario8() throws Exception {
+ System.out.println("====>Running testScenario8");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario8.composite", "TestContribution", "src/main/resources/scenario8/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario8Results(false);
+ }
+
+ public void testScenario8NonWiring() throws Exception {
+ System.out.println("====>Running testScenario8NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario8.composite", "TestContribution", "src/main/resources/scenario8/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario8Results(true);
+ }
+
+ private void checkScenario8Results(boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should replace target= on ComponentD/reference3 by uri="http://foo.com/bar" on <binding.ws>
+ // For nonWiring, the original target= is preserved and there is no uri=
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ WebServiceBinding wsBinding = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3".equals(reference.getName())) {
+ if (!nonWiring) {
+ assert reference.getTargets().size() == 0;
+ } else {
+ assert reference.getTargets().size() == 1;
+ }
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ }
+ }
+ if (!nonWiring) {
+ assert "http://foo.com/bar".equals(wsBinding.getURI());
+ } else {
+ assert wsBinding.getURI() == null;
+ }
+
+ Definition def;
+ javax.wsdl.Service svc;
+ Port port;
+ if (!nonWiring) {
+ // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://scenarios/ComponentD/reference3", "Service3aService"));
+ port = svc.getPort("Service3aPort");
+ assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
+ }
+
+ // Should add <binding.ws> and <interface.wsdl> to inner composite reference CompositeC/reference2
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario8", "CompositeC"));
+ wsBinding = null;
+ for (Reference reference : compositeC.getReferences()) {
+ if ("reference2".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert wsBinding.getURI() == null;
+
+ // Should add <binding.ws> and <interface.wsdl> to outer component reference ComponentB/reference2
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ wsBinding = null;
+ for (ComponentReference reference : componentB.getReferences()) {
+ if ("reference2".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert wsBinding.getURI() == null;
+
+ // Should add <binding.ws> and <interface.wsdl> to outer composite reference CompositeA/reference1
+ wsBinding = null;
+ for (Reference reference : domainComposite.getReferences()) {
+ if ("reference1".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert wsBinding.getURI() == null;
+
+ // Should not add a WSDL document to domain composite reference reference1
+ assert wsBinding.getWSDLDocument() == null;
+ }
+
+ // Scenario 9: target in reference CDR3A and binding.ws uri= at CAR1A
+ public void testScenario9() throws Exception {
+ System.out.println("====>Running testScenario9");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario9.composite", "TestContribution", "src/main/resources/scenario9/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario9Results();
+ }
+
+ private void checkScenario9Results() {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ ComponentReference componentRef = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3a".equals(reference.getName())) {
+ componentRef = reference;
+ assertTrue(reference.getBindings().size() == 2);
+ assertTrue(reference.getBindings().get(0) instanceof SCABinding);
+ assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding);
+ }
+ }
+ assertTrue(componentRef != null);
+ }
+
+ // Scenario 10: targets in references CBR2A and CDR3A and binding.ws at CBR2A
+ public void testScenario10() throws Exception {
+ System.out.println("====>Running testScenario10");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario10.composite", "TestContribution", "src/main/resources/scenario10/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario10And11Results();
+ }
+
+ // Scenario 11: targets in references CBR2A and CDR3A and binding.ws at CCR2A
+ public void testScenario11() throws Exception {
+ System.out.println("====>Running testScenario11");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario11.composite", "TestContribution", "src/main/resources/scenario11/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario10And11Results();
+ }
+
+ private void checkScenario10And11Results() {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ ComponentReference componentRef = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3a".equals(reference.getName())) {
+ componentRef = reference;
+ assertTrue(reference.getBindings().size() == 2);
+ Binding binding1 = reference.getBindings().get(0);
+ assertTrue(binding1 instanceof SCABinding);
+ assertTrue(reference.getInterfaceContract(binding1) instanceof JavaInterfaceContract);
+ Binding binding2 = reference.getBindings().get(1);
+ assertTrue(binding2 instanceof WebServiceBinding);
+ assertTrue(reference.getInterfaceContract(binding2) instanceof WSDLInterfaceContract);
+ }
+ }
+ assertTrue(componentRef != null);
+ }
+
+ // Scenario 12: targets in references CBR2A and CDR3A and binding.ws at CDR3A
+ public void testScenario12() throws Exception {
+ System.out.println("====>Running testScenario12");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario12.composite", "TestContribution", "src/main/resources/scenario12/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario12Results();
+ }
+
+ private void checkScenario12Results() {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ ComponentReference componentRef = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3a".equals(reference.getName())) {
+ componentRef = reference;
+ assertTrue(reference.getBindings().size() == 2);
+ assertTrue(reference.getBindings().get(0) instanceof WebServiceBinding);
+ assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding);
+ }
+ }
+ assertTrue(componentRef != null);
+ }
+
+ // Scenario 13: target in reference CDR3A
+ public void testScenario13() throws Exception {
+ System.out.println("====>Running testScenario13");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario13.composite", "TestContribution", "src/main/resources/scenario13/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario13Results();
+ }
+
+ private void checkScenario13Results() {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ ComponentReference componentRef = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3a".equals(reference.getName())) {
+ componentRef = reference;
+ assertTrue(reference.getBindings().size() == 1);
+ assertTrue(reference.getBindings().get(0) instanceof WebServiceBinding);
+ }
+ }
+ assertTrue(componentRef != null);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java b/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java
new file mode 100644
index 0000000000..cad09920e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.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.itest.builder;
+
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultEndpointFactory;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Test version of org.apache.tuscany.sca.assembly.builder.impl.builder.CompositeBuilderImpl
+ *
+ * This class should be identical to CompositeBuilderImpl except for omitting the
+ * following builders:
+ * componentWireBuilder
+ * compositeReferenceWireBuilder
+ * compositePromotedServiceBuilder
+ * It omits the component wiring step and the special processing that's performed
+ * for composite service and reference promotion.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBuilderNonWiringImpl implements CompositeBuilder {
+ private static final Logger logger = Logger.getLogger(CompositeBuilderNonWiringImpl.class.getName());
+ private CompositeBuilder compositeIncludeBuilder;
+ //private CompositeBuilder componentReferenceWireBuilder;
+ //private CompositeBuilder componentReferencePromotionWireBuilder;
+ //private CompositeBuilder compositeReferenceWireBuilder;
+ private CompositeBuilder compositeCloneBuilder;
+ private CompositeBuilder componentConfigurationBuilder;
+ private CompositeBuilder compositeServiceConfigurationBuilder;
+ private CompositeBuilder compositeReferenceConfigurationBuilder;
+ private CompositeBuilder compositeBindingURIBuilder;
+ private CompositeBuilder componentServicePromotionBuilder;
+ //private CompositeBuilder compositeServicePromotionBuilder;
+ private CompositeBuilder compositePromotionBuilder;
+ private CompositeBuilder compositePolicyBuilder;
+ private CompositeBuilder componentServiceBindingBuilder;
+ private CompositeBuilder componentReferenceBindingBuilder;
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param intentAttachPointTypeFactory
+ * @param interfaceContractMapper
+ * @param monitor
+ */
+ public CompositeBuilderNonWiringImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ Monitor monitor) {
+ this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, null, monitor);
+ }
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param endpointFactory
+ * @param intentAttachPointTypeFactory
+ * @param interfaceContractMapper
+ * @param policyDefinitions
+ * @param monitor
+ */
+ public CompositeBuilderNonWiringImpl(AssemblyFactory assemblyFactory,
+ EndpointFactory endpointFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+
+ if (endpointFactory == null){
+ endpointFactory = new DefaultEndpointFactory();
+ }
+
+ compositeIncludeBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeIncludeBuilderImpl(monitor);
+ //componentReferenceWireBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ //componentReferencePromotionWireBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
+ //compositeReferenceWireBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
+ compositeCloneBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeCloneBuilderImpl(monitor);
+ componentConfigurationBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+ compositeServiceConfigurationBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeServiceConfigurationBuilderImpl(assemblyFactory);
+ compositeReferenceConfigurationBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeReferenceConfigurationBuilderImpl(assemblyFactory);
+ compositeBindingURIBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+ //componentServicePromotionBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentServicePromotionBuilderImpl(assemblyFactory);
+ //compositeServicePromotionBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeServicePromotionBuilderImpl(assemblyFactory);
+ compositePromotionBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ compositePolicyBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ componentServiceBindingBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentServiceBindingBuilderImpl(monitor);
+ componentReferenceBindingBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentReferenceBindingBuilderImpl(monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Collect and fuse includes
+ compositeIncludeBuilder.build(composite);
+
+ // Expand nested composites
+ compositeCloneBuilder.build(composite);
+
+ // Configure all components
+ componentConfigurationBuilder.build(composite);
+
+ // Connect composite services/references to promoted services/references
+ compositePromotionBuilder.build(composite);
+
+ // Compute the policies across the model hierarchy
+ compositePolicyBuilder.build(composite);
+
+ // Configure composite services
+ compositeServiceConfigurationBuilder.build(composite);
+
+ // Configure composite references
+ compositeReferenceConfigurationBuilder.build(composite);
+
+ // Configure binding URIs
+ compositeBindingURIBuilder.build(composite);
+
+ // Create promoted component services
+// componentServicePromotionBuilder.build(composite);
+
+ // Create promoted composite services
+// compositeServicePromotionBuilder.build(composite);
+
+ // Build component service binding-related information
+ componentServiceBindingBuilder.build(composite);
+
+ // Wire the components
+// componentReferenceWireBuilder.build(composite);
+
+ // Wire the promoted component references
+// componentReferencePromotionWireBuilder.build(composite);
+
+ // Wire the composite references
+// compositeReferenceWireBuilder.build(composite);
+
+ // Build component reference binding-related information
+ componentReferenceBindingBuilder.build(composite);
+
+ // Fuse nested composites
+ //FIXME do this later
+ //cloneBuilder.fuseCompositeImplementations(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java b/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java
new file mode 100644
index 0000000000..82a8ca6689
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java
@@ -0,0 +1,210 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.builder;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+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.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
+import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
+
+public class CustomCompositeBuilder {
+ private URLArtifactProcessor<Contribution> contributionProcessor;
+ private ModelResolverExtensionPoint modelResolvers;
+ private ModelFactoryExtensionPoint modelFactories;
+ private WorkspaceFactory workspaceFactory;
+ private AssemblyFactory assemblyFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessor<Object> xmlProcessor;
+ private ContributionDependencyBuilder contributionDependencyBuilder;
+ private CompositeBuilder domainCompositeBuilder;
+ private static Workspace workspace;
+ private List<SCADefinitions> policyDefinitions;
+ private Monitor monitor;
+ private Composite domainComposite;
+ private boolean nonWiring;
+
+ protected CustomCompositeBuilder(boolean nonWiring) {
+ this.nonWiring = nonWiring;
+ }
+
+ private void init() {
+
+ // Create extension point registry
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ monitor = monitorFactory.createMonitor();
+
+ // Initialize the Tuscany module activators
+ ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
+ for (ModuleActivator activator : moduleActivators.getModuleActivators()) {
+ activator.start(extensionPoints);
+ }
+
+ // Get XML input/output factories
+ modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+
+ // Get contribution workspace and assembly model factories
+ workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+
+ // Create XML artifact processors
+ StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor);
+
+ // Create contribution content processor
+ URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class);
+
+ // Get the model resolvers
+ modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
+
+ // Create a contribution dependency builder
+ contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor);
+
+ // Create a composite builder
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
+ if (nonWiring) {
+ domainCompositeBuilder = new CompositeBuilderNonWiringImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
+ } else {
+ domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
+ }
+ }
+
+ public void loadContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {
+ init();
+
+ // Create workspace model
+ workspace = workspaceFactory.createWorkspace();
+ workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories));
+
+ // Read the test contribution
+ URI artifactURI = URI.create(sourceURI);
+ URL artifactURL = new File(sourceURL).toURI().toURL();
+ URL contributionURL = new File(compositeURL).toURI().toURL();
+ Contribution testContribution = contributionProcessor.read(contributionURL, artifactURI, artifactURL);
+ workspace.getContributions().add(testContribution);
+
+ // Build the contribution dependencies
+ Map<Contribution, List<Contribution>> contributionDependencies = new HashMap<Contribution, List<Contribution>>();
+ Set<Contribution> resolved = new HashSet<Contribution>();
+ for (Contribution contribution: workspace.getContributions()) {
+ List<Contribution> dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace);
+
+ // Resolve contributions
+ for (Contribution dependency: dependencies) {
+ if (!resolved.contains(dependency)) {
+ resolved.add(dependency);
+ contributionProcessor.resolve(dependency, workspace.getModelResolver());
+ }
+ }
+
+ contributionDependencies.put(contribution, dependencies);
+ }
+
+ // Create a composite model for the domain
+ domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA10_NS, "domain"));
+
+ // Add all deployables to it, normally the domain administrator would select
+ // the deployables to include
+ domainComposite.getIncludes().addAll(workspace.getDeployables());
+
+ // Build the domain composite and wire the components included in it
+ domainCompositeBuilder.build(domainComposite);
+ }
+
+ /**
+ * Returns the delegating model processor.
+ * @return the delegating model processor
+ */
+ public StAXArtifactProcessor<Object> getModelProcessor() {
+ return xmlProcessor;
+ }
+
+ /**
+ * Returns the XML output factory.
+ * @return the XML output factory
+ */
+ public XMLOutputFactory getOutputFactory() {
+ return outputFactory;
+ }
+
+ /**
+ * Returns the domain composite.
+ * @return the domain composite model object
+ */
+ public Composite getDomainComposite() {
+ return domainComposite;
+ }
+
+ /**
+ * Returns the monitor.
+ * @return the monitor instance
+ */
+ public Monitor getMonitor() {
+ return monitor;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java b/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java
new file mode 100644
index 0000000000..9bff4d394e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.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.sca.itest.builder;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLStreamWriter;
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.w3c.dom.Document;
+
+/**
+ * Static utility methods for use by test cases.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestUtils {
+
+ protected static void checkProblems(CustomCompositeBuilder customBuilder) throws Exception {
+ boolean problems = false;
+ for (Problem problem : customBuilder.getMonitor().getProblems()) {
+ if (problem.getCause() != null) {
+ problem.getCause().printStackTrace();
+ }
+ problems = true;
+ }
+ assert !problems;
+ }
+
+ protected static String getPortAddress(Port port) {
+ Object ext = port.getExtensibilityElements().get(0);
+ if (ext instanceof SOAPAddress) {
+ return ((SOAPAddress)ext).getLocationURI();
+ }
+ if (ext instanceof SOAP12Address) {
+ return ((SOAP12Address)ext).getLocationURI();
+ }
+ return null;
+ }
+
+ protected static Component getComponent(Composite composite, String name) {
+ for (Component component : composite.getComponents()) {
+ if (name.equals(component.getName())) {
+ return component;
+ }
+ // process implementation composites recursively
+ Implementation impl = component.getImplementation();
+ if (impl instanceof Composite) {
+ Component comp = getComponent((Composite)impl, name);
+ if (comp != null) {
+ return comp;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected static Composite getComposite(Composite composite, QName name) {
+ if (name.equals(composite.getName())) {
+ return composite;
+ }
+ for (Component component : composite.getComponents()) {
+ // process implementation composites recursively
+ Implementation impl = component.getImplementation();
+ if (impl instanceof Composite) {
+ Composite comp = getComposite((Composite)impl, name);
+ if (comp != null) {
+ return comp;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected static void printResults(CustomCompositeBuilder customBuilder) throws Exception {
+ for (Problem problem : customBuilder.getMonitor().getProblems()) {
+ if (problem.getCause() != null) {
+ problem.getCause().printStackTrace();
+ }
+ }
+ Composite domainComposite = customBuilder.getDomainComposite();
+ printComposite(domainComposite, customBuilder);
+ }
+
+ private static void printComposite(Composite composite, CustomCompositeBuilder customBuilder) throws Exception {
+ // process implementation composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ printComposite((Composite)implementation, customBuilder);
+ }
+ }
+
+ // write out the SCDL
+ writeSCDL(composite, customBuilder);
+
+ // find all the component service and reference bindings
+ for (Component component : composite.getComponents()) {
+ for (ComponentService componentService : component.getServices()) {
+ for (Binding binding : componentService.getBindings()) {
+ if (binding instanceof WebServiceBinding) {
+ writeWSDL(component, componentService, ((WebServiceBinding)binding).getWSDLDocument());
+ }
+ }
+ }
+ for (ComponentReference componentReference : component.getReferences()) {
+ for (Binding binding : componentReference.getBindings()) {
+ if (binding instanceof WebServiceBinding) {
+ writeWSDL(component, componentReference, ((WebServiceBinding)binding).getWSDLDocument());
+ }
+ }
+ }
+ }
+
+ // find all the composite service and reference bindings
+ for (Service service : composite.getServices()) {
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof WebServiceBinding) {
+ writeWSDL(null, service, ((WebServiceBinding)binding).getWSDLDocument());
+ }
+ }
+ }
+ for (Reference reference : composite.getReferences()) {
+ for (Binding binding : reference.getBindings()) {
+ if (binding instanceof WebServiceBinding) {
+ writeWSDL(null, reference, ((WebServiceBinding)binding).getWSDLDocument());
+ }
+ }
+ }
+ }
+
+ private static void writeSCDL(Composite composite, CustomCompositeBuilder customBuilder) throws Exception {
+ // Print out a composite
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ XMLStreamWriter writer = customBuilder.getOutputFactory().createXMLStreamWriter(bos);
+ customBuilder.getModelProcessor().write(composite, writer);
+
+ // Parse and write again to pretty format it
+ DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray()));
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+ format.setIndent(2);
+ XMLSerializer serializer = new XMLSerializer(System.out, format);
+ System.out.println("-->Runtime SCDL model for composite " + composite.getName());
+ serializer.serialize(document);
+ }
+
+ private static void writeWSDL(Component component, Contract contract, Definition definition) {
+ if (definition == null) {
+ System.out.println("-->No generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName());
+ } else {
+ try {
+ System.out.println("-->Generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName());
+ WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
+ writer.writeWSDL(definition, System.out);
+ } catch (WSDLException e) {
+ // ignore
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/pom.xml b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/pom.xml
new file mode 100644
index 0000000000..bd373b2ae6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callablereferences-ws</artifactId>
+ <name>Apache Tuscany Test for Callable References over Web Services</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java
new file mode 100644
index 0000000000..ecf1ac27e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.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 com.example;
+
+public interface ExampleClient {
+
+ void runTest();
+
+ void sayHello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java
new file mode 100644
index 0000000000..c46087d865
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ExampleClient.class)
+@Scope("COMPOSITE")
+public class ExampleClientImpl implements ExampleClient {
+
+ private ExampleService myService;
+
+ @Context
+ protected ComponentContext context;
+
+ @Reference
+ public void setMyService(ExampleService myService) {
+ this.myService = myService;
+ }
+
+ public void runTest() {
+ ServiceReference<ExampleClient> ref = context.createSelfReference(ExampleClient.class);
+ ref.getService().sayHello("Jack");
+ CallableReference result = myService.hello("Jill", ref);
+ if (result != null) {
+ ((CallableReference<ExampleClient>)result).getService().sayHello("John");
+ }
+ result = myService.hello("Jane", null);
+ if (result != null) {
+ ((CallableReference<ExampleClient>)result).getService().sayHello("Jim");
+ }
+ }
+
+ public void sayHello(String name) {
+ System.out.println("Hello, client " + name + "!");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java
new file mode 100644
index 0000000000..670c145cc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleService.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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExampleService {
+
+ CallableReference hello(String name, ServiceReference ref);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java
new file mode 100644
index 0000000000..eb4d647a22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+public class ExampleServiceImpl implements ExampleService {
+
+ public CallableReference hello(String name, ServiceReference ref) {
+ if (ref != null) {
+ ((ServiceReference<ExampleClient>)ref).getService().sayHello(name);
+ }
+ return (CallableReference)ref;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.java
new file mode 100644
index 0000000000..bb5e57397d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.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.itest.callablerefwsreturn;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Alpha {
+ boolean run();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.java
new file mode 100644
index 0000000000..6e5f1cedf9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.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.itest.callablerefwsreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.Conversation;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(Alpha.class)
+@Scope("COMPOSITE")
+public class AlphaImpl implements Alpha {
+ @Reference
+ public Beta beta;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ Object conversationId0 = null;
+
+ public boolean run() {
+ CallableReference<Gamma> gammaRef = null;
+ try {
+ Object conversationId1 = null;
+ Object conversationId2 = null;
+
+ // it is expected that this call returns a reference to Gamma that
+ // reuses the established Conversation
+ gammaRef = beta.getRef();
+
+ // no Conversation exists
+ Conversation con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha1: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha1: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId1 = con.getConversationID();
+ }
+
+ // this call should reuse a Conversation, but as none exists it
+ // creates a new conversation
+ gammaRef.getService().doSomething();
+ gammaRef.getService().doSomething();
+ gammaRef.getService().doSomething();
+
+ con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha2: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha2: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId2 = con.getConversationID();
+ }
+
+ boolean testPassed = conversationId1.equals(conversationId2);
+
+ if (conversationId0 == null){
+ conversationId0 = conversationId1;
+ return testPassed;
+ } else {
+ return testPassed && (!conversationId0.equals(conversationId1));
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ } finally {
+ if (gammaRef != null) {
+ gammaRef.getService().stop();
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.java
new file mode 100644
index 0000000000..995e4fcf39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.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.callablerefwsreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Beta {
+ CallableReference<Gamma> getRef();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.java
new file mode 100644
index 0000000000..be72fd779e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.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.callablerefwsreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(Beta.class)
+@Scope("COMPOSITE")
+public class BetaImpl implements Beta {
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ public Gamma gamma;
+
+ public CallableReference<Gamma> getRef() {
+ ServiceReference<Gamma> gammaRef = componentContext
+ .getServiceReference(Gamma.class, "gamma");
+ Gamma g = gammaRef.getService();
+ g.start();
+ return gammaRef;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.java
new file mode 100644
index 0000000000..b73f26b573
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.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.itest.callablerefwsreturn;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Conversational
+public interface Gamma {
+ int start();
+
+ void doSomething();
+
+ @EndsConversation
+ void stop();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.java
new file mode 100644
index 0000000000..c3abc4c65d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.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.itest.callablerefwsreturn;
+
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(Gamma.class)
+@Scope("CONVERSATION")
+public class GammaImpl implements Gamma {
+ @ConversationID
+ protected String conversationId;
+
+ public GammaImpl() {
+ System.out.println("GammaImpl:GammaImpl(), conversationId="
+ + conversationId);
+ }
+
+ public int start() {
+ System.out.println("Gamma:start(), conversationId=" + conversationId);
+ return 1;
+ }
+
+ public void doSomething() {
+ System.out.println("Gamma:doSomething(), conversationId="
+ + conversationId);
+ }
+
+ public void stop() {
+ System.out.println("Gamma:stop(), conversationId=" + conversationId);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite
new file mode 100644
index 0000000000..3d782a0b84
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:t="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:s="http://test"
+ name="test">
+
+ <component name="Alpha">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.callablerefwsreturn.AlphaImpl" />
+ <service name="Alpha">
+ <binding.sca />
+ </service>
+ <reference name="beta">
+ <binding.ws uri="http://localhost:8085/Beta" />
+ </reference>
+ </component>
+
+ <component name="Beta">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.callablerefwsreturn.BetaImpl" />
+ <service name="Beta">
+ <binding.ws uri="http://localhost:8085/Beta" />
+ </service>
+ <reference name="gamma">
+ <binding.ws uri="http://localhost:8085/Gamma" />
+ </reference>
+ </component>
+
+ <component name="Gamma">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.callablerefwsreturn.GammaImpl" />
+ <service name="Gamma">
+ <binding.ws uri="http://localhost:8085/Gamma" />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/resources/example.composite b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/resources/example.composite
new file mode 100644
index 0000000000..ea0819a32e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/main/resources/example.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.example.com"
+ xmlns:hw="http://www.example.com"
+ name="example">
+
+ <component name="ExampleClientComponent">
+ <implementation.java class="com.example.ExampleClientImpl" />
+ <reference name="myService">
+ <interface.java interface="com.example.ExampleService" />
+ <binding.ws uri="http://localhost:8085/axis2/services/ExampleService" />
+ </reference>
+ </component>
+
+ <component name="ExampleComponent">
+ <implementation.java class="com.example.ExampleServiceImpl"/>
+ <service name="ExampleService">
+ <interface.java interface="com.example.ExampleService" />
+ <binding.ws uri="http://localhost:8085/axis2/services/ExampleService" />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java
new file mode 100644
index 0000000000..310e31fb02
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.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 com.example;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExampleTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private ExampleClient client;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("example.composite");
+ client = scaDomain.getService(ExampleClient.class, "ExampleClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ client.runTest();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.java b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.java
new file mode 100644
index 0000000000..66fb2ef96c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.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.itest.callablerefws;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.callablerefwsreturn.Alpha;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CallableReferenceReturnTestCase {
+ private static SCADomain domain;
+ private static Alpha alpha;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CallableReferenceWsReturnTest.composite");
+ alpha = domain.getService(Alpha.class, "Alpha");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testCallableReferenceReturn() {
+ Assert.assertTrue(alpha.run());
+ Assert.assertTrue(alpha.run());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/pom.xml b/sca-java-1.x/branches/sca-android/itest/callablereferences/pom.xml
new file mode 100644
index 0000000000..323ee9c076
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callablereferences</artifactId>
+ <name>Apache Tuscany SCA Callable References Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+<!--
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+-->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java
new file mode 100644
index 0000000000..5934f16851
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.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.callableref;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AComponent {
+ String foo();
+
+ String fooB();
+ String fooB1();
+
+ String fooC();
+ String fooC1();
+
+ String fooStringD();
+ String fooD();
+
+ String fooBC();
+
+ String invokeDReference();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java
new file mode 100644
index 0000000000..7c2fd092dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.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.itest.callableref;
+
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+public class AComponentImpl implements AComponent {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference(name = "bReference")
+ protected BComponent b;
+
+ @Reference
+ protected CComponent cReference;
+
+ @Reference
+ protected ServiceReference<CComponent> cServiceReference;
+
+ @Reference(required=false)
+ protected DComponent dReference;
+
+ protected DComponent dReference1;
+
+ @Reference(name = "dReference1")
+ public void setDReference(DComponent dReference) {
+ this.dReference1 = dReference;
+ }
+
+ public String foo() {
+ return "AComponent";
+ }
+
+ public String fooB() {
+ return b.foo();
+ }
+
+ public String fooB1() {
+ CallableReference<BComponent> bRef = componentContext.cast(b);
+ return bRef.getService().foo();
+ }
+
+ public String fooC() {
+ return cReference.foo();
+ }
+
+ public String fooC1() {
+ return cServiceReference.getService().foo();
+ }
+
+ public String fooBC() {
+ CallableReference<CComponent> cReference = componentContext.getServiceReference(CComponent.class, "cReference");
+ return b.fooC(cReference);
+ }
+
+ public String fooD() {
+ CallableReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class);
+ return dReference1.foo(aReference);
+ }
+
+ /**
+ * A test case to work out what needs to be done in a transformer to get the
+ * CallableReference across the wire. Left here for interest in case anyone
+ * is looking for how to get at the innards of CallableReferences
+ */
+ public String fooStringD() {
+ CallableReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class);
+ ByteArrayOutputStream bos = null;
+
+ try {
+ bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(aReference);
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ return null;
+ }
+
+ String aReferenceString = Base64Binary.encode(bos.toByteArray());
+ return dReference1.fooString(aReferenceString);
+ }
+
+ public String invokeDReference() {
+ return dReference.foo(null);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java
new file mode 100644
index 0000000000..ade672b0ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.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.itest.callableref;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface BComponent {
+
+ String foo();
+
+ String fooC(CallableReference<CComponent> cComponent);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java
new file mode 100644
index 0000000000..518e77d3a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.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.callableref;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+public class BComponentImpl implements BComponent {
+
+ public BComponentImpl() {
+ }
+
+ public String foo() {
+ return "BComponent";
+ }
+
+ public String fooC(CallableReference<CComponent> cReference) {
+ return "B" + cReference.getService().foo();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java
new file mode 100644
index 0000000000..fdf80cc1c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.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.callableref;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CComponent {
+
+ String foo();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java
new file mode 100644
index 0000000000..cc8ec8f000
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.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.itest.callableref;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(CComponent.class)
+public class CComponentImpl implements CComponent {
+
+ public String foo() {
+ return "CComponent";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java
new file mode 100644
index 0000000000..48b697df31
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.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.itest.callableref;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface DComponent {
+
+ String foo(CallableReference<AComponent> aReference);
+
+ String fooString(String aReferenceString);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java
new file mode 100644
index 0000000000..27ad48b9fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.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.itest.callableref;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(DComponent.class)
+public class DComponentImpl implements DComponent {
+
+ @Context
+ protected RequestContext requestContext;
+
+ public String foo(CallableReference<AComponent> aReference) {
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(aReference);
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
+ Object obj = ois.readObject();
+ aReference = (CallableReference<AComponent>) obj;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.out.println("Invoking service: " + requestContext.getServiceName());
+ return "D" + aReference.getService().foo();
+ }
+
+ public String fooString(String aReferenceString) {
+ CallableReference<AComponent> aReference = null;
+ try {
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64Binary.decode(aReferenceString)));
+ Object obj = ois.readObject();
+ aReference = (CallableReference<AComponent>) obj;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.out.println("Invoking service: " + requestContext.getServiceName());
+ return "D" + aReference.getService().foo();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefconversational/ConversationalService.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefconversational/ConversationalService.java
new file mode 100644
index 0000000000..abcedfa6e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefconversational/ConversationalService.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.itest.callablerefconversational;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple conversational Service that is used to testing the method
+ * ComponentContext.createSelfReference()
+ *
+ * @version $Date$ $Revision$
+ */
+@Conversational
+public interface ConversationalService {
+ /**
+ * Default value for the user data
+ */
+ String DEFAULT_USER_DATA = "NOT SET";
+
+ /**
+ * Retrieves the conversation ID for this Service
+ *
+ * @return The conversation ID for this Service
+ */
+ Object getConversationID();
+
+ /**
+ * Creates a self reference to this Service
+ *
+ * @return A self reference to this Service
+ */
+ ServiceReference<ConversationalService> createSelfRef();
+
+ /**
+ * Sets some user data on the instance
+ *
+ * @param a_Data Some data
+ *
+ * @See {@link #getUserData()}
+ */
+ void setUserData(String a_Data);
+
+ /**
+ * Gets some user data on the instance
+ *
+ * @return Some data
+ *
+ * @See {@link #setUserData(String)}
+ */
+ String getUserData();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefconversational/ConversationalServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefconversational/ConversationalServiceImpl.java
new file mode 100644
index 0000000000..f2e0ce7582
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefconversational/ConversationalServiceImpl.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.itest.callablerefconversational;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service that is used to testing the method
+ * ComponentContext.createSelfReference()
+ *
+ * @version $Date$ $Revision$
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+public class ConversationalServiceImpl implements ConversationalService {
+
+ /**
+ * The Conversation ID
+ */
+ private Object m_ConversationID;
+
+ /**
+ * Reference to the ComponentContext.
+ */
+ @Context
+ protected ComponentContext m_Ctx;
+
+ /**
+ * Some user data
+ */
+ private String m_UserData = DEFAULT_USER_DATA;
+
+ /**
+ * Constructor
+ */
+ public ConversationalServiceImpl() {
+ System.out.println("New instance of " + this + " created");
+ }
+
+ /**
+ * Used to inject the Conversation ID
+ *
+ * @param a_ConversationID the Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(Object a_ConversationID) {
+ m_ConversationID = a_ConversationID;
+ System.out.println("Converstation ID set on " + this + " to " + a_ConversationID);
+ }
+
+ /**
+ * Retrieves the conversation ID for this Service
+ *
+ * @return The conversation ID for this Service
+ */
+ public Object getConversationID() {
+ return m_ConversationID;
+ }
+
+ /**
+ * Creates a self reference to this Service
+ *
+ * @return A self reference to this Service
+ */
+ public ServiceReference<ConversationalService> createSelfRef() {
+ return m_Ctx.createSelfReference(ConversationalService.class);
+ }
+
+ /**
+ * Sets some user data on the instance
+ *
+ * @param a_Data Some data
+ *
+ * @See {@link #getUserData()}
+ */
+ public void setUserData(String a_Data) {
+ m_UserData = a_Data;
+ }
+
+ /**
+ * Gets some user data on the instance
+ *
+ * @return Some data
+ *
+ * @See {@link #setUserData(String)}
+ */
+ public String getUserData() {
+ return m_UserData;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java
new file mode 100644
index 0000000000..ab21421c4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.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.callablerefreturn;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Alpha
+{
+ boolean run();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java
new file mode 100644
index 0000000000..5b5984b164
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.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.itest.callablerefreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.Conversation;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class AlphaImpl implements Alpha {
+ @Reference
+ public Beta beta;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ public boolean run() {
+ CallableReference<Gamma> gammaRef = null;
+ try {
+ Object conversationId1 = null;
+ Object conversationId2 = null;
+
+ // it is expected that this call returns a reference to Gamma that
+ // reuses the established Conversation
+ gammaRef = beta.getRef();
+
+ // no Conversation exists
+ Conversation con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId1 = con.getConversationID();
+ }
+
+ // this call should reuse a Conversation, but as none exists it
+ // creates a new conversation
+ gammaRef.getService().doSomething();
+ con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId2 = con.getConversationID();
+ }
+
+ if ((conversationId1 == null) || (conversationId2 == null)) {
+ return false;
+ }
+
+ boolean testPassed = conversationId1.equals(conversationId2);
+ return testPassed;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ } finally {
+ if (gammaRef != null) {
+ gammaRef.getService().stop();
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java
new file mode 100644
index 0000000000..223c467f47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.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.callablerefreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Beta
+{
+ CallableReference<Gamma> getRef();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java
new file mode 100644
index 0000000000..ed4e66bec3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.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.itest.callablerefreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class BetaImpl implements Beta
+{
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ public Gamma gamma;
+
+ public CallableReference<Gamma> getRef()
+ {
+ ServiceReference<Gamma> gammaRef = componentContext.getServiceReference(Gamma.class, "gamma");
+ gammaRef.getService().start();
+ return gammaRef;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java
new file mode 100644
index 0000000000..e32051373f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.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.callablerefreturn;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Conversational
+public interface Gamma
+{
+ void start();
+
+ void doSomething();
+
+ @EndsConversation
+ void stop();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java
new file mode 100644
index 0000000000..adf5a1c1ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.callablerefreturn;
+
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class GammaImpl implements Gamma
+{
+ @ConversationID
+ protected String conversationId;
+
+
+ public void start()
+ {
+ System.out.println("Gamma:start(), conversationId=" + conversationId);
+ }
+
+
+ public void doSomething()
+ {
+ System.out.println("Gamma:doSomething(), conversationId=" + conversationId);
+ }
+
+
+ public void stop()
+ {
+ System.out.println("Gamma:stop(), conversationId=" + conversationId);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceConversationalTest.composite b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceConversationalTest.composite
new file mode 100644
index 0000000000..0bf8f7ef1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceConversationalTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="CallableReferenceConversation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="ConversationalService" promote="ConversationalComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.callablerefconversational.ConversationalService" />
+ </service>
+
+ <component name="ConversationalComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefconversational.ConversationalServiceImpl" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite
new file mode 100644
index 0000000000..5b3add1e61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://test"
+ name="test">
+
+ <component name="Alpha">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefreturn.AlphaImpl"/>
+ <reference name="beta" target="Beta"/>
+ </component>
+
+ <component name="Beta">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefreturn.BetaImpl"/>
+ <reference name="gamma" target="Gamma"/>
+ </component>
+
+ <component name="Gamma">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefreturn.GammaImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceTest.composite b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceTest.composite
new file mode 100644
index 0000000000..49b75f56e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/CallableReferenceTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="InnerReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.callableref.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="cServiceReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite
new file mode 100644
index 0000000000..9216f44191
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite
@@ -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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="CompositeA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <!--service name="AComponentService" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.callableref.AComponent" />
+ <binding.sca uri="http://localhost:8084/AComponentService"/>
+ </service-->
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.AComponentImpl" />
+ <service name="AComponent">
+ <binding.sca uri="http://localhost:8084/AComponent"/>
+ </service>
+ <reference name="bReference">
+ <binding.sca uri="http://localhost:8085/BComponent" />
+ </reference>
+ <reference name="cReference">
+ <binding.sca uri="http://localhost:8085/CComponent" />
+ </reference>
+ <reference name="cServiceReference">
+ <binding.sca uri="http://localhost:8085/CComponent" />
+ </reference>
+ <reference name="dReference1">
+ <binding.sca uri="http://localhost:8085/DComponent" />
+ </reference>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..95021f72a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeA/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" xmlns:foo="http://foo">
+ <deployable composite="foo:CompositeA" />
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite
new file mode 100644
index 0000000000..42d739564c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeB/CompositeB.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="CompositeB" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ <service name="BComponent">
+ <binding.sca uri="http://localhost:8085/BComponent"/>
+ </service>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ <service name="CComponent">
+ <binding.sca uri="http://localhost:8085/CComponent"/>
+ </service>
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ <service name="DComponent">
+ <binding.sca uri="http://localhost:8085/DComponent"/>
+ </service>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..2edda61601
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/main/resources/nodeB/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" xmlns:foo="http://foo">
+ <deployable composite="foo:CompositeB" />
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceConversationalTestCase.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceConversationalTestCase.java
new file mode 100644
index 0000000000..a9cbb5d0a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceConversationalTestCase.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.itest.callableref;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.callablerefconversational.ConversationalService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * Simple test case that creates a ServiceReference to a Conversational Component
+ * using ComponentContext.createSelfReference()
+ * <p>
+ * This test case is for TUSCANY-2208
+ *
+ * @version $Date$ $Revision$
+ */
+public class CallableReferenceConversationalTestCase {
+ private static SCADomain domain;
+ private static ConversationalService acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CallableReferenceConversationalTest.composite");
+ Assert.assertNotNull(domain);
+ acomponent = domain.getService(ConversationalService.class, "ConversationalComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ /**
+ * This is a dummy test so that this Unit Test has a test so it will build.
+ * Once TUSCANY-2208 is fixed, this dummy test method can be removed
+ */
+ @Test
+ public void dummyTestRemoveWhenTuscany2208IsFixed() {
+ }
+
+ /**
+ * Tests creating Self References and validate them with Conversation IDs
+ */
+ // Disabled until TUSCANY-2208 is fixed
+ // @Test
+ public void testCreateSelfRefUsingConvID() {
+ Assert.assertNotNull(acomponent);
+
+ final Object origConvID = acomponent.getConversationID();
+ Assert.assertNotNull(origConvID);
+ final ServiceReference<ConversationalService> ref = acomponent.createSelfRef();
+ Assert.assertNotNull(ref);
+
+ final ConversationalService resolvedRef = ref.getService();
+ Assert.assertNotNull(resolvedRef);
+ final Object newConvID = resolvedRef.getConversationID();
+ Assert.assertNotNull(newConvID);
+
+ Assert.assertEquals(origConvID, newConvID);
+ }
+
+ /**
+ * Tests creating Self References and validate them with user specified data
+ */
+ // Disabled until TUSCANY-2208 is fixed
+ // @Test
+ public void testCreateSelfRefUsingUserData() {
+ Assert.assertNotNull(acomponent);
+
+ final String origUserData = acomponent.getUserData();
+ Assert.assertEquals(ConversationalService.DEFAULT_USER_DATA, origUserData);
+
+ final String userData = "Some new user data set at " + System.currentTimeMillis();
+ acomponent.setUserData(userData);
+
+ final ServiceReference<ConversationalService> ref = acomponent.createSelfRef();
+ Assert.assertNotNull(ref);
+
+ final ConversationalService resolvedRef = ref.getService();
+ Assert.assertNotNull(resolvedRef);
+ final String newUserData = resolvedRef.getUserData();
+ Assert.assertNotNull(newUserData);
+
+ Assert.assertEquals(userData, newUserData);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
new file mode 100644
index 0000000000..ba9020811c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.callableref;
+
+
+import static junit.framework.Assert.assertEquals;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class CallableReferenceRemoteTestCase {
+
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+
+ System.out.println("Setting up nodes");
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ nodeA = nodeFactory.createSCANode(new File("src/main/resources/nodeA/CompositeA.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/nodeA").toURL().toString()));
+
+
+ nodeB = nodeFactory.createSCANode(new File("src/main/resources/nodeB/CompositeB.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/nodeB").toURL().toString()));
+
+
+ nodeA.start();
+ nodeB.start();
+
+ acomponent = ((SCAClient)nodeA).getService(AComponent.class, "AComponent/AComponent");
+
+ } catch (Throwable ex) {
+ System.out.println(ex.toString());
+ // Print detailed cause information.
+ ex.printStackTrace();
+ StringBuffer sb = new StringBuffer();
+ Throwable cause = ex.getCause();
+ while ( cause != null ) {
+ sb.append( " " );
+ System.out.println( sb.toString() + "Cause: " + cause );
+ if (cause instanceof java.lang.reflect.InvocationTargetException)
+ System.out.println( sb.toString() + "Target Exception: " + ((java.lang.reflect.InvocationTargetException)cause).getTargetException() );
+ cause = cause.getCause();
+ }
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the nodes and hence the domains they contain
+ nodeA.stop();
+ nodeB.stop();
+ }
+
+ //@Test
+ public void testKeepServerRunning1() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testBCast() {
+ assertEquals("BComponent", acomponent.fooB1());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testCServiceReference() {
+ assertEquals("CComponent", acomponent.fooC1());
+ }
+
+ @Test
+ public void testDReferenceString() {
+ assertEquals("DAComponent", acomponent.fooStringD());
+ }
+
+ @Test
+ public void testDReference() {
+ assertEquals("DAComponent", acomponent.fooD());
+ }
+
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.invokeDReference();
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java
new file mode 100644
index 0000000000..f2d8fe5d64
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.callableref;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.callablerefreturn.Alpha;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CallableReferenceReturnTestCase {
+ private static SCADomain domain;
+ private static Alpha alpha;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CallableReferenceReturnTest.composite");
+ alpha = domain.getService(Alpha.class, "Alpha");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testCallableReferenceReturn() {
+ Assert.assertTrue(alpha.run());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java
new file mode 100644
index 0000000000..d785a6a397
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.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.itest.callableref;
+
+import static junit.framework.Assert.assertEquals;
+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 CallableReferenceTestCase {
+ private static SCADomain domain;
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CallableReferenceTest.composite");
+ acomponent = domain.getService(AComponent.class, "AComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testBCast() {
+ assertEquals("BComponent", acomponent.fooB1());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testCServiceReference() {
+ assertEquals("CComponent", acomponent.fooC1());
+ }
+
+ @Test
+ public void testDReference() {
+ assertEquals("DAComponent", acomponent.fooD());
+ }
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.invokeDReference();
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-api/pom.xml b/sca-java-1.x/branches/sca-android/itest/callback-api/pom.xml
new file mode 100644
index 0000000000..0175bef27f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-api/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <was.ant.script>${basedir}/../build-was-integration.xml</was.ant.script>
+ <was.python.script>${basedir}/../wasAdmin.py</was.python.script>
+ </properties>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java
new file mode 100644
index 0000000000..de17ba2f0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ *
+ */
+public interface CallBackApiCallBack {
+ /**
+ * This function is defined in CallBackApiClientImpl
+ */
+ public void callBackMessage(String aString);
+
+ /**
+ * This function is defined in CallBackApiClientImpl
+ */
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java
new file mode 100644
index 0000000000..5fd4a71466
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackApiClient {
+ /**
+ * This function is defined in CallBackApiClientImpl
+ */
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java
new file mode 100644
index 0000000000..274984abb3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.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();
+
+ /**
+ * This test calls function test 3a,3a1,3b,3c
+ */
+ 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();
+
+ test3a1();
+
+ // 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;
+ }
+
+ /**
+ * This test is the basic callback where the target calls back prior to returning to the client.
+ */
+
+ private void test3a() {
+ aCallBackService.knockKnock("Knock Knock");
+ int count = 0;
+
+ //
+ // If we can't 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());
+
+ }
+
+ /**
+ * This test is the basic callback where the target calls back prior to returning to the client.
+ */
+ private void test3a1() {
+ aCallBackService.knockKnockByRef("Knock Knock");
+ int count = 0;
+
+ //
+ // If we can't 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());
+
+ }
+
+ /**
+ * This test is the basic callback where the target does not call back to the client
+ */
+ private void test3b() {
+ aCallBackService.noCallBack("No Reply Desired");
+ Assert.assertEquals("CallBackApiITest - test3b", 1, 1);
+ return;
+ }
+
+ /**
+ * This test is the basic callback where the target calls back multiple times to the client
+ */
+
+ private void test3c() {
+ aCallBackService.multiCallBack("Call me back 3 times");
+ int count = 0;
+
+ //
+ // If we can't 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;
+ }
+
+ /**
+ * This function returns a string
+ *
+ * @param void
+ * @return String result string
+ */
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ /**
+ * This function set the returnMessage string
+ *
+ * @param String
+ */
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ /**
+ * This function returns the callBackCount variable
+ *
+ * @return Integer callBackCount variable
+ */
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ /**
+ * This function increments callBackCount variable by 1
+ */
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ /**
+ * This function prints a message synched with setReturnMessage function
+ *
+ * @param String
+ */
+ public void callBackMessage(String aString) {
+ System.out.println("Entering callback callBackMessage: " + aString);
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ monitor.notify();
+ }
+ }
+
+ /**
+ * This function prints a message synched with incrementCallBackCount function
+ *
+ * @param String
+ */
+ 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-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java
new file mode 100644
index 0000000000..33de1e7739
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.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;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(CallBackApiCallBack.class)
+/**
+ *
+ */
+public interface CallBackApiService {
+ /**
+ * This function is defined in CallBackApiServiceImpl
+ */
+ public void knockKnock(String aString);
+
+ /**
+ * This function is defined in CallBackApiServiceImpl
+ */
+ public void knockKnockByRef(String aString);
+
+ /**
+ * This function is defined in CallBackApiServiceImpl
+ */
+ public void noCallBack(String aString);
+
+ /**
+ * This function is defined in CallBackApiServiceImpl
+ */
+ public void multiCallBack(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java
new file mode 100644
index 0000000000..61e2c7ee8f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.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.test;
+
+import org.osoa.sca.CallableReference;
+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(CallBackApiService.class)
+public class CallBackApiServiceImpl implements CallBackApiService {
+
+ @Context
+ protected ComponentContext componentContext;
+ /**
+ * Object of CallBackApiCallBack class
+ */
+ private CallBackApiCallBack callback;
+
+ @Callback
+ protected CallableReference<CallBackApiCallBack> callbackRef;
+
+ /**
+ * This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function and calls the
+ * callBackMessage function.
+ *
+ * @param aString String passed by a function call
+ */
+
+ 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;
+
+ }
+
+ /**
+ * This function calls the callBackMessage function. <br>
+ * The reference to this function is received from Call back reference to the class CallBackApiService.
+ *
+ * @param aString String passed by a function call
+ */
+ public void knockKnockByRef(String aString) {
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+ callbackRef.getService().callBackMessage("Who's There");
+ System.out.println("CallBackApiServiceImpl response sent");
+ return;
+
+ }
+
+ /**
+ * This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function. <br>
+ * This function then places multiple callBack using the callbackIncrement function defined in
+ * callBack.ApiServiceImpl
+ *
+ * @param aString String passed by a function call
+ */
+ 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;
+
+ }
+
+ /**
+ * This function does not callBack any function.
+ *
+ * @param aString String passed by a function call
+ */
+ public void noCallBack(String aString) {
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+
+ return;
+
+ }
+
+ /**
+ * This function get an object of CallBackApiServiceImpl from the present componentContext
+ *
+ * @param void
+ */
+ private CallBackApiCallBack getCallBackInterface() {
+ System.out.println("CallBackApiServiceImpl getting request context");
+ RequestContext rc = componentContext.getRequestContext();
+ System.out.println("CallBackApiServiceImpl getting callback from request context");
+ callback = rc.getCallback();
+ System.out.println("CallBackApiServiceImpl returning callback");
+ return callback;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/resources/CallBackApiTest.composite b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/resources/CallBackApiTest.composite
new file mode 100644
index 0000000000..946c4862ee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..19eb25631e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-api/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://callback"
+ xmlns:t="http://callback">
+ <deployable composite="t:CallBackApiTest" />
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java b/sca-java-1.x/branches/sca-android/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java
new file mode 100644
index 0000000000..9471049c74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackApiTestCase extends TestCase {
+
+ private static SCADomain domain;
+ private CallBackApiClient aCallBackClient;
+
+ /**
+ * This function uses the Instance of CallBackApiClient.class <br>
+ * This function calls the run function defined in the CallBackApiClinet Interface <br>
+ * which in turn executes the following test cases. <br>
+ * 1. Basic callback patterns <br>
+ * 2. Test in which the target does not call back to the client <br>
+ * 3. Test in which the target calls back multiple times to the client.
+ */
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ /**
+ * This function creates the SCADomain instance and gets an Instance of CallBackApiClient.class
+ */
+ @Override
+ protected void setUp() throws Exception {
+ if (domain == null) {
+ domain = SCADomain.newInstance("CallBackApiTest.composite");
+ }
+
+ aCallBackClient = domain.getService(CallBackApiClient.class, "CallBackApiClient");
+ }
+
+ /**
+ * This function destroys the SCADomain instance that was created in setUp()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-basic/pom.xml b/sca-java-1.x/branches/sca-android/itest/callback-basic/pom.xml
new file mode 100644
index 0000000000..1108a4ce37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-basic/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <was.ant.script>${basedir}/../build-was-integration.xml</was.ant.script>
+ <was.python.script>${basedir}/../wasAdmin.py</was.python.script>
+ </properties>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java b/sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java
new file mode 100644
index 0000000000..5e9d3d6821
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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
+/**
+ *
+ */
+public interface CallBackBasicCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java
new file mode 100644
index 0000000000..e0e6d7eb8c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 can't 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 can't 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-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-basic/src/main/resources/CallBackBasicTest.composite b/sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/resources/CallBackBasicTest.composite
new file mode 100644
index 0000000000..c506956088
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..adf28214f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-basic/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://callback"
+ xmlns:t="http://callback">
+ <deployable composite="t:CallBackBasicTest" />
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java b/sca-java-1.x/branches/sca-android/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java
new file mode 100644
index 0000000000..32c26a348a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.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;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackBasicTestCase extends TestCase {
+
+ private static SCADomain domain;
+ private CallBackBasicClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ if( domain==null ) {
+ 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-android/itest/callback-complex-type/pom.xml b/sca-java-1.x/branches/sca-android/itest/callback-complex-type/pom.xml
new file mode 100644
index 0000000000..371b72242d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java b/sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java
new file mode 100644
index 0000000000..9fddb850ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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
+/**
+ *
+ */
+public interface CallBackCTypeCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java
new file mode 100644
index 0000000000..d2b03fcde7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 can't 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 can't 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-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.java b/sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.java
new file mode 100644
index 0000000000..33d1afaecd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.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;
+
+//FIXME Fix this test case
+public class CallBackCTypeTestCaseFIXME extends TestCase {
+
+ private SCADomain domain;
+ private CallBackCTypeClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackCTypeClient.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackCTypeClient.class, "CallBackCTypeClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-id/pom.xml b/sca-java-1.x/branches/sca-android/itest/callback-id/pom.xml
new file mode 100644
index 0000000000..e8da0dfc2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java b/sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java
new file mode 100644
index 0000000000..b14560a8c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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
+/**
+ *
+ */
+public interface CallBackIdCallBack {
+
+ public void callBackMessage(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java
new file mode 100644
index 0000000000..59c9c3d069
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.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 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 ServiceReference<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 = aCallBackService.getCallbackID();
+ aCallBackService.getService().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";
+ aCallBackService.setCallbackID(origCallBackId);
+
+ aCallBackService.getService().knockKnock("Knock Knock - Test2");
+ int count = 0;
+
+ //
+ // If we can't 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-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java
new file mode 100644
index 0000000000..8b0a4b69cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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);
+
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackIdServiceImpl response sent");
+ return;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-id/src/main/resources/CallBackIdClient.composite b/sca-java-1.x/branches/sca-android/itest/callback-id/src/main/resources/CallBackIdClient.composite
new file mode 100644
index 0000000000..c9a6ba6258
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.java b/sca-java-1.x/branches/sca-android/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.java
new file mode 100644
index 0000000000..771fbb8ff7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.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 CallBackIdTestCase extends TestCase {
+
+ private SCADomain domain;
+ private CallBackIdClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackIdClient.composite");
+
+ aCallBackClient = domain.getService(CallBackIdClient.class, "CallBackIdClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/pom.xml b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/pom.xml
new file mode 100644
index 0000000000..43fc9e2ec3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-multiple-wires</artifactId>
+ <name>Apache Tuscany SCA Callback With Mutiple Wires Test</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java
new file mode 100644
index 0000000000..7c80d222fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/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 org.apache.tuscany.sca.test.callback;
+
+/**
+ * The client interface
+ */
+public interface MyClient {
+
+ void aClientMethod();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java
new file mode 100644
index 0000000000..df91f3d268
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.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.callback;
+
+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 MyClientImpl1 implements MyClient, MyServiceCallback {
+
+ private MyService myService;
+ static String result;
+
+ @Reference
+ public void setMyService(MyService myService) {
+ this.myService = myService;
+ }
+
+ public void aClientMethod() {
+ myService.someMethod("-> someMethod1");
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("Work thread " + Thread.currentThread());
+ System.out.println("Result: " + result);
+ MyClientImpl1.result = result;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java
new file mode 100644
index 0000000000..a0a9564002
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.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.callback;
+
+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 MyClientImpl2 implements MyClient, MyServiceCallback {
+
+ private MyService myService;
+ static String result;
+
+ @Reference
+ public void setMyService(MyService myService) {
+ this.myService = myService;
+ }
+
+ public void aClientMethod() {
+ myService.someMethod("-> someMethod2");
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("Work thread " + Thread.currentThread());
+ System.out.println("Result: " + result);
+ MyClientImpl2.result = result;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java
new file mode 100644
index 0000000000..cfd601f546
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/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 org.apache.tuscany.sca.test.callback;
+
+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-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java
new file mode 100644
index 0000000000..f198efae51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/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 org.apache.tuscany.sca.test.callback;
+
+/**
+ * The callback interface for {@link MyService}.
+ */
+public interface MyServiceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java
new file mode 100644
index 0000000000..d19b3fe355
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.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.callback;
+
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+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 {
+
+ @Context
+ protected RequestContext requestContext;
+
+ public void someMethod(String arg) {
+ // invoke the callback
+ try {
+ MyServiceCallback myServiceCallback = requestContext.getCallback();
+ myServiceCallback.receiveResult(arg + " -> receiveResult");
+ } catch(RuntimeException e) {
+ System.out.println("RuntimeException invoking receiveResult: " + e.toString());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite
new file mode 100644
index 0000000000..3dae3ca3a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.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"
+ targetNamespace="http://callback"
+ name="CallbackMultiWireTest">
+
+ <component name="MyClientComponent1">
+ <implementation.java class="org.apache.tuscany.sca.test.callback.MyClientImpl1"/>
+ <reference name="myService" target="MyServiceComponent"/>
+ </component>
+
+ <component name="MyClientComponent2">
+ <implementation.java class="org.apache.tuscany.sca.test.callback.MyClientImpl2"/>
+ <reference name="myService" target="MyServiceComponent"/>
+ </component>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.callback.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java
new file mode 100644
index 0000000000..3c83e4bedd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.callback;
+
+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 CallbackMultiWireTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private MyClient myClient1;
+ private MyClient myClient2;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("CallbackMultiWireTest.composite");
+ myClient1 = scaDomain.getService(MyClient.class, "MyClientComponent1");
+ myClient2 = scaDomain.getService(MyClient.class, "MyClientComponent2");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ System.out.println("Main thread " + Thread.currentThread());
+ myClient1.aClientMethod();
+ myClient2.aClientMethod();
+ System.out.println("Sleeping ...");
+ Thread.sleep(300);
+ assertEquals("-> someMethod1 -> receiveResult", MyClientImpl1.result);
+ assertEquals("-> someMethod2 -> receiveResult", MyClientImpl2.result);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-separatethread/pom.xml b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/pom.xml
new file mode 100644
index 0000000000..7cfc5ce992
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-separatethread</artifactId>
+ <name>Apache Tuscany SCA Callback Using Separate Thread Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.java b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.java
new file mode 100644
index 0000000000..f812a39058
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.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.itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the client interface for the call backs in a separate thread tests
+ */
+@Remotable
+public interface CallBackSeparateThreadClient {
+
+ /**
+ * This tests call back patterns using separate threads.
+ */
+ void runTests();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java
new file mode 100644
index 0000000000..e861f8a3d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.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.itest;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is the client implementation for the call backs in a separate thread tests
+ */
+@Service(CallBackSeparateThreadClient.class)
+public class CallBackSeparateThreadClientImpl implements CallBackSeparateThreadClient, EventProcessorCallBack {
+ /**
+ * Used to sleep for 60 seconds.
+ */
+ private static final int SIXTY_SECONDS = 60 * 1000;
+
+ /**
+ * Counts the number of one second call backs
+ */
+ private static final AtomicInteger oneSecondCallbackCount = new AtomicInteger();
+
+ /**
+ * Counts the number of five second call backs
+ */
+ private static final AtomicInteger fiveSecondCallbackCount = new AtomicInteger();
+
+ /**
+ * This is our injected reference to the EventProcessorService
+ */
+ @Reference
+ protected EventProcessorService aCallBackService;
+
+ /**
+ * This tests call back patterns using separate threads.
+ */
+ public void runTests() {
+ // Register for 1 second call back
+ registerFor1SecondCallback();
+
+ // Wait for a few 1 second call backs
+ System.out.println("Waiting for some 1 second calls");
+ waitForSome1SecondCallbacks();
+
+ // Register for 5 second call back
+ registerFor5SecondCallback();
+
+ // Wait for a few 1 second call backs
+ System.out.println("Waiting for some 1 second calls");
+ waitForSome1SecondCallbacks();
+
+ // Wait for a few 5 second call backs
+ System.out.println("Waiting for some 5 second calls");
+ waitForSome5SecondCallbacks();
+
+ System.out.println("Done");
+ }
+
+ /**
+ * Waits for some one second call backs to be fired
+ */
+ private void waitForSome1SecondCallbacks() {
+ // Reset the one second call back count
+ oneSecondCallbackCount.set(0);
+
+ // Wait until we have 10 1 second call backs or 60 seconds has passed
+ final long start = System.currentTimeMillis();
+ do {
+ if (oneSecondCallbackCount.get() >= 10) {
+ System.out.println("Received enough 1 second notifications");
+ return;
+ }
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ Assert.fail("Unexpeceted exception " + e);
+ }
+ }
+ while (System.currentTimeMillis() - start < SIXTY_SECONDS);
+
+ // If we get to here then we did not receive enough events
+ Assert.fail("Did not receive enough 1 second events");
+ }
+
+ /**
+ * Waits for some five second call backs to be fired
+ */
+ private void waitForSome5SecondCallbacks() {
+ // Reset the five second call back count
+ fiveSecondCallbackCount.set(0);
+
+ // Wait until we have 4 5 second call backs or 60 seconds has passed
+ final long start = System.currentTimeMillis();
+ do
+ {
+ if (fiveSecondCallbackCount.get() >= 4) {
+ System.out.println("Received enough 5 second notifications");
+ return;
+ }
+
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e)
+ {
+ Assert.fail("Unexpeceted exception " + e);
+ }
+ }
+ while (System.currentTimeMillis() - start < SIXTY_SECONDS);
+
+ // If we get to here then we did not receive enough events
+ Assert.fail("Did not receive enough 5 second events");
+ }
+
+ /**
+ * Register to receive one second call backs
+ */
+ private void registerFor1SecondCallback() {
+ aCallBackService.registerForEvent("ONE");
+ return;
+ }
+
+ /**
+ * Register to receive five second call backs
+ */
+ private void registerFor5SecondCallback() {
+ aCallBackService.registerForEvent("FIVE");
+ }
+
+ /**
+ * Method that is called when an Event is delivered.
+ *
+ * @param aEventName The name of the Event
+ * @param aEventData The Event data
+ */
+ public void eventNotification(String aEventName, Object aEventData) {
+ // System.out.println("Received Event : " + aEventName + " " + aEventData);
+
+ if (aEventName.equals("ONE")) {
+ final int newValue = oneSecondCallbackCount.incrementAndGet();
+ //System.out.println("Received total of " + newValue + " 1 second call backs");
+ } else if (aEventName.equals("FIVE")) {
+ final int newValue = fiveSecondCallbackCount.incrementAndGet();
+ //System.out.println("Received total of " + newValue + " 5 second call backs");
+ }
+ else
+ System.out.println("Unknown event type of " + aEventName);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.java b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.java
new file mode 100644
index 0000000000..ae41f596fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.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 org.osoa.sca.annotations.Remotable;
+
+/**
+ * The call back interface for the EventProcessorService that is implemented
+ * by the client to receive event notifications
+ */
+@Remotable
+public interface EventProcessorCallBack {
+ /**
+ * Call back notifying client of an Event
+ *
+ * @param aEventName The name of the Event
+ * @param aEventData The data for the Event
+ */
+ void eventNotification(String aEventName, Object aEventData);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java
new file mode 100644
index 0000000000..c22b8cceec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * Sample Event Processor Service
+ */
+@Conversational
+@Callback(EventProcessorCallBack.class)
+@Remotable
+public interface EventProcessorService {
+
+ /**
+ * Registers the client to receive notifications for the specified event
+ *
+ * @param aEventName The name of the Event to register
+ */
+ void registerForEvent(String aEventName);
+
+ /**
+ * Unregisters the client so it no longer receives notifications for the specified event
+ *
+ * @param aEventName The name of the Event to unregister
+ */
+ void unregisterForEvent(String aEventName);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java
new file mode 100644
index 0000000000..4d672b3a8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.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.itest;
+
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Sample Event Processor Service Implementation
+ */
+@Service(EventProcessorService.class)
+@Scope("CONVERSATION")
+public class EventProcessorServiceImpl implements EventProcessorService {
+
+ /**
+ * Reference to the call back
+ */
+ @Callback
+ protected CallableReference<EventProcessorCallBack> clientCallback;
+
+ /**
+ * This map contains the call backs for each of the registered Event names
+ */
+ private final Map<String, CallableReference<EventProcessorCallBack>> eventListeners;
+
+ /**
+ * The list of all Event Generators we create
+ */
+ private final EventGenerator[] allEventGenerators;
+
+ /**
+ * Constructor. Starts the Event Generators
+ */
+ public EventProcessorServiceImpl() {
+ eventListeners = new ConcurrentHashMap<String, CallableReference<EventProcessorCallBack>>();
+
+ // We will simulate an Event generator
+ allEventGenerators = new EventGenerator[2];
+ allEventGenerators[0] = new EventGenerator("ONE", 1); // Generate the SECOND event every second
+ allEventGenerators[1] = new EventGenerator("FIVE", 5); // Generate the FIVE event every 5 seconds
+ }
+
+ /**
+ * Registers the client to receive notifications for the specified event
+ *
+ * @param aEventName The name of the Event to register
+ */
+ public void registerForEvent(String aEventName)
+ {
+ // Register for the Event
+ eventListeners.put(aEventName, clientCallback);
+
+ // Send the "register" started event to the client
+ receiveEvent(aEventName, "SameThread: Registered to receive notifications for " + aEventName);
+ }
+
+ /**
+ * Unregisters the client so it no longer receives notifications for the specified event
+ *
+ * @param aEventName The name of the Event to unregister
+ */
+ public void unregisterForEvent(String aEventName)
+ {
+ // Send the "register" started event to the client
+ receiveEvent(aEventName, "SameThread: Unregister from receiving notifications for " + aEventName);
+
+ eventListeners.remove(aEventName);
+ }
+
+ /**
+ * This method is called whenever the EventProcessorService receives an Event
+ *
+ * @param aEventName The name of the Event received
+ * @param aEventData The Event data
+ */
+ private void receiveEvent(String aEventName, Object aEventData)
+ {
+ // Get the listener for the Event
+ final CallableReference<EventProcessorCallBack> callback = eventListeners.get(aEventName);
+ if (callback == null)
+ {
+ //System.out.println("No registered listeners for " + aEventName);
+ return;
+ }
+
+ // Trigger the call back
+ // System.out.println("Notifying " + callback + " of event " + aEventName);
+ callback.getService().eventNotification(aEventName, aEventData);
+ // System.out.println("Done notify " + callback + " of event " + aEventName);
+ }
+
+ /**
+ * Shuts down the Event Processor
+ */
+ @Destroy
+ public void shutdown()
+ {
+ System.out.println("Shutting down the EventProcessor");
+
+ // Clear list of call back locations as we don't want to send any more notifications
+ eventListeners.clear();
+
+ // Stop the Event Generators
+ for (EventGenerator generator : allEventGenerators)
+ {
+ generator.stop();
+ }
+ }
+
+ /**
+ * Utility class for generating Events
+ */
+ private class EventGenerator
+ {
+ /**
+ * The Timer we are using to generate the events
+ */
+ private final Timer timer = new Timer();
+
+ /**
+ * Constructor
+ *
+ * @param aEventName The name of the Event to generate
+ * @param frequencyInSeconds How frequently we should generate the Events
+ */
+ private EventGenerator(String aEventName, int frequencyInSeconds)
+ {
+ timer.schedule(new EventGeneratorTimerTask(aEventName),
+ frequencyInSeconds * 1000, frequencyInSeconds * 1000);
+ }
+
+ /**
+ * Stop this Event Generator
+ */
+ private void stop()
+ {
+ timer.cancel();
+ }
+
+ /**
+ * The TimerTask that is invoked by the Timer for the EventGenerator
+ */
+ private class EventGeneratorTimerTask extends TimerTask
+ {
+ /**
+ * The name of the Event we should generate
+ */
+ private final String eventName;
+
+ /**
+ * Constructor
+ *
+ * @param aEventName The name of the Event we should generate
+ */
+ private EventGeneratorTimerTask(String aEventName)
+ {
+ eventName = aEventName;
+ }
+
+ /**
+ * Timer calls this method and it will generate an Event
+ */
+ @Override
+ public void run()
+ {
+ // System.out.println("Generating new event " + eventName);
+ receiveEvent(eventName, "Separate Thread Notification: " + UUID.randomUUID().toString());
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite
new file mode 100644
index 0000000000..e111e5074c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://callback" name="CallBackSeparateThreadTest">
+
+ <component name="CallBackSeparateThreadClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.CallBackSeparateThreadClientImpl"/>
+ <reference name="aCallBackService" target="EventProcessorService"/>
+ </component>
+
+ <component name="EventProcessorService">
+ <implementation.java class="org.apache.tuscany.sca.itest.EventProcessorServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java
new file mode 100644
index 0000000000..f7e7be2133
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.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.itest;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This test case will attempt to trigger a call back using a separate thread
+ */
+public class CallBackSeparateThreadTestCase extends TestCase {
+
+ /**
+ * The SCADomain we are using
+ */
+ private SCADomain domain;
+
+ /**
+ * The client the tests should use
+ */
+ private CallBackSeparateThreadClient aCallBackClient;
+
+ /**
+ * Run the call back in separate thread tests
+ */
+ public void testCallBackSeparateThread() {
+ aCallBackClient.runTests();
+ }
+
+ /**
+ * Load the Call back in separate thread composite and look up the client.
+ */
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackSeparateThreadTest.composite");
+ aCallBackClient = domain.getService(CallBackSeparateThreadClient.class, "CallBackSeparateThreadClient");
+ }
+
+ /**
+ * Shutdown the SCA domain
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-callback/pom.xml b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/pom.xml
new file mode 100644
index 0000000000..a9883a4253
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java
new file mode 100644
index 0000000000..3b9599f53f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 boolean setCallbackIllegally(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java
new file mode 100644
index 0000000000..48752f2ea1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import junit.framework.Assert;
+
+public class CallBackSetCallbackBadCallback {
+
+ 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-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java
new file mode 100644
index 0000000000..ad0e0603a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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
+/**
+ *
+ */
+public interface CallBackSetCallbackCallback {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java
new file mode 100644
index 0000000000..66e4d3fc05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.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.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 ServiceReference<CallBackSetCalbackService> aCallBackService;
+ @Reference
+ protected ServiceReference<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 execution.
+ */
+
+ 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 exception 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();
+
+ aCallBackService.setCallback(callBack);
+
+ aCallBackService.getService().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());
+
+ aCallBackService.setCallback(null); // leave this in the default state for next test
+
+ }
+
+ 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.getService().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 implement
+ // the callback interface. However because this callback service is
+ // stateless the expected
+ // result is an appropriate exception.
+ //
+
+ try {
+ aCallBackService.setCallback(new CallBackSetCallbackObjectCallback());
+ aCallBackService.getService().knockKnock("Knock Knock");
+ }
+ //
+ // This should catch an appropriate exception.
+ //
+ catch (IllegalArgumentException goodEx) {
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallback - Test6", true, correctException);
+
+ }
+
+ private void test10() {
+
+ //
+ // The appropriate exception should be thrown and caught on the service side.
+ // If this happens, the setCallbackIllegally() method will return true.
+ // If not, this method will return false.
+ //
+
+ aCallBackService.setCallback(callBack); // ensure no client-side exception
+
+ boolean result = aCallBackService.getService().setCallbackIllegally
+ ("Try to set callback on your own service reference");
+
+ Assert.assertEquals("CallBackSetCallback - Test10", true, result);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java
new file mode 100644
index 0000000000..4a6c9dbaa6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.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;
+
+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
+ protected CallBackSetCallbackCallback 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 boolean setCallbackIllegally(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() message received: " + aString);
+
+ boolean exceptionProduced = false;
+ RequestContext requestContext = null;
+ ServiceReference serviceRef = null;
+
+ try {
+ requestContext = context.getRequestContext();
+ serviceRef = (ServiceReference) requestContext.getServiceReference();
+ serviceRef.setCallback(serviceRef);
+ } catch (ClassCastException goodEx) {
+ exceptionProduced = true;
+ System.out.println("Test10 appropriate exception caught during setCallback to own service reference");
+ } catch (Exception badEx) {
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() " + badEx.toString());
+ badEx.printStackTrace();
+ }
+
+ // Return a flag indicating whether we got the exception we are looking for
+ return exceptionProduced;
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.java b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.java
new file mode 100644
index 0000000000..496ae0b1a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.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;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+//FIXME Fix this test case
+public class CallBackSetCallbackTestCase extends TestCase {
+
+ private SCADomain domain;
+ private CallBackSetCallbackClient aCallBackClient;
+
+ public void testCallBackSetCallback() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackSetCallbackTest.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackSetCallbackClient.class,
+ "CallBackSetCallbackClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/pom.xml b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/pom.xml
new file mode 100644
index 0000000000..23fa07b2ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java
new file mode 100644
index 0000000000..d97c69eaed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+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");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java
new file mode 100644
index 0000000000..a704fd0ece
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Conversational;
+
+// @Remotable
+@Conversational
+/**
+ *
+ */
+public interface CallBackSetCallbackConvCallback {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java
new file mode 100644
index 0000000000..5d692e7728
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+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 {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected CallBackSetCallbackConvService aCallBackService;
+
+ private CallBackSetCallbackConvObjectCallback aCallbackObject = null;
+
+ 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 Serializable. Verify successful
+ // execution.
+ //
+
+ aCallbackObject = new CallBackSetCallbackConvObjectCallback();
+ aCallbackObject.incrementCallBackCount();
+
+ ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef
+ = componentContext.cast(aCallBackService);
+ aCallBackServiceRef.setCallback(aCallbackObject);
+ aCallBackService.knockKnock("Knock Knock 7");
+
+ 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 implement
+ // the callback interface. The expected result is an appropriate
+ // exception.
+ //
+
+ try {
+ ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef
+ = componentContext.cast(aCallBackService);
+ aCallBackServiceRef.setCallback(new CallBackSetCallbackConvBadCallback());
+ aCallBackService.knockKnock("Knock Knock 8");
+ }
+
+ //
+ // This should catch an appropriate exception.
+ //
+
+ catch (IllegalArgumentException goodEx)
+ {
+ System.out.println("correct exception " + goodEx);
+ 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 implement
+ // the callback interface but does not implement Serializable. Verify
+ // an appropriate exception
+ // is thrown.
+ //
+
+ try {
+ ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef
+ = componentContext.cast(aCallBackService);
+ aCallBackServiceRef.setCallback(new CallBackSetCallbackConvNonSerCallback());
+ aCallBackService.knockKnock("Knock Knock 9");
+ }
+ //
+ // This should catch an appropriate exception.
+ //
+ catch (IllegalArgumentException goodEx)
+ {
+ System.out.println("correct exception " + goodEx);
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallbackConv - Test9", true, correctException);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java
new file mode 100644
index 0000000000..75a4a3a6a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.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;
+
+import junit.framework.Assert;
+
+public class CallBackSetCallbackConvNonSerCallback implements CallBackSetCallbackConvCallback {
+
+ private int callBackCount = 0;
+
+ public CallBackSetCallbackConvNonSerCallback() {
+ super();
+ }
+
+ public synchronized void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public synchronized int getCount() {
+ return callBackCount;
+ }
+
+ public void callBackMessage(String aString) {
+ //
+ // This callback method should never be called.
+ //
+ System.out.println("Entering CallBackSetCallbackConvNonSerCallback callBackMessage: " + aString);
+ Assert.fail("CallBackSetCallbackConvNonSerCallback: callbackMessage called");
+ }
+
+ public void callBackIncrement(String aString) {
+ //
+ // This callback method should never be called.
+ //
+ System.out.println("Entering callbackIncrement: " + aString);
+ this.incrementCallBackCount();
+ Assert.fail("CallBackSetCallbackConvNonSerCallback: callbackIncrement called");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java
new file mode 100644
index 0000000000..e7a3b144f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import java.io.Serializable;
+
+public class CallBackSetCallbackConvObjectCallback implements CallBackSetCallbackConvCallback, Serializable
+{
+ private int callBackCount = 0;
+
+ public CallBackSetCallbackConvObjectCallback() {
+ super();
+ }
+
+ public synchronized void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public synchronized int getCount() {
+ return 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-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java
new file mode 100644
index 0000000000..692b6dfc35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.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.Conversational;
+
+// @Remotable
+@Conversational
+@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-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java
new file mode 100644
index 0000000000..bca94ce407
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.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;
+
+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
+ protected CallBackSetCallbackConvCallback callback;
+ @Context
+ protected ComponentContext context;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackSetCallbackConvServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ callback.callBackIncrement("This should do it");
+ System.out.println("CallBackSetCallbackConvServiceImpl response sent");
+
+ }
+
+ 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-android/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java
new file mode 100644
index 0000000000..45bdaea9ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.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 CallBackSetCallbackConvTestCase extends TestCase {
+
+ private SCADomain domain;
+ private CallBackSetCallbackConvClient aCallBackClient;
+
+ public void testCallBackSetCallback() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackSetCallbackConvTest.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackSetCallbackConvClient.class,
+ "CallBackSetCallbackConvClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/component-type/pom.xml b/sca-java-1.x/branches/sca-android/itest/component-type/pom.xml
new file mode 100644
index 0000000000..33a735a418
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-component-type</artifactId>
+ <name>Apache Tuscany SCA Component Type Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
+
diff --git a/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..188451ebac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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-android/itest/component-type/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..8b6fe066a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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-android/itest/component-type/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..08afd922b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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/CalculatorService");
+
+ // 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-android/itest/component-type/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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-android/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..1209ac128a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.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 calculator;
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ 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-android/itest/component-type/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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-android/itest/component-type/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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-android/itest/component-type/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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-android/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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-android/itest/component-type/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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-android/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..77b128ab8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/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-android/itest/component-type/src/main/resources/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..b229787657
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent/AddService"/>
+ <reference name="subtractService" target="SubtractServiceComponent/SubtractService"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent/MultiplyService"/>
+ <reference name="divideService" target="DivideServiceComponent/DivideService"/>
+ </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-android/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType
new file mode 100644
index 0000000000..00c48e5a35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType
@@ -0,0 +1,27 @@
+<?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="AddService">
+ <interface.java interface="calculator.AddService"/>
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType
new file mode 100644
index 0000000000..74bedc0a98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType
@@ -0,0 +1,43 @@
+<?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="addService">
+ <interface.java interface="calculator.AddService"/>
+ </reference>
+
+ <reference name="subtractService">
+ <interface.java interface="calculator.SubtractService"/>
+ </reference>
+
+ <reference name="multiplyService">
+ <interface.java interface="calculator.MultiplyService"/>
+ </reference>
+
+ <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-android/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType
new file mode 100644
index 0000000000..289fcc3e11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType
@@ -0,0 +1,27 @@
+<?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="DivideService">
+ <interface.java interface="calculator.DivideService"/>
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType
new file mode 100644
index 0000000000..2d8a879cda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType
@@ -0,0 +1,27 @@
+<?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="MultiplyService">
+ <interface.java interface="calculator.MultiplyService"/>
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType
new file mode 100644
index 0000000000..6214955141
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType
@@ -0,0 +1,27 @@
+<?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="SubtractService">
+ <interface.java interface="calculator.SubtractService"/>
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/component-type/src/test/java/calculator/CalculatorTestCase.java b/sca-java-1.x/branches/sca-android/itest/component-type/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..08fc8e33bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/component-type/src/test/java/calculator/CalculatorTestCase.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 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;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("Calculator.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorService");
+ }
+
+ @Override
+ 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-android/itest/contribution-classloader/contribution-classes/build-jar.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/build-jar.xml
new file mode 100644
index 0000000000..299ce6864f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/build-jar.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 name="JarCreator">
+
+ <target name="create-jar">
+
+ <mkdir dir="${jar.dir}"/>
+
+ <copy file="target/classes/META-INF/${sca.contribution}" tofile="target/classes/META-INF/sca-contribution.xml"/>
+
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ <!-- include name="${files.list}"/-->
+ </fileset>
+ </jar>
+
+ <delete file="target/classes/META-INF/sca-contribution.xml"/>
+ </target>
+
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/pom.xml
new file mode 100644
index 0000000000..53416eb338
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/pom.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-classloader-classes</artifactId>
+ <name>Apache Tuscany Contribution ClassLoader Test : Contribution Classes</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>itest-contribution-classloader-classes</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-jar</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChain.jar" />
+ <property name="sca.contribution" value="supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/supplychain.composite \
+ supplychain/warehouse/JavaWarehouseComponentImpl.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CompleteSupplyChain.jar" />
+ <property name="sca.contribution" value="complete-supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/supplychain.composite \
+ supplychain/customer/* \
+ supplychain/retailer/* \
+ supplychain/warehouse/* \
+ supplychain/shipper/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Customer.jar" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Retailer.jar" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Shipper.jar" />
+ <property name="sca.contribution" value="shipper-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/shipper/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Warehouse.jar" />
+ <property name="sca.contribution" value="warehouse-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/warehouse/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="IllegalSupplyChain1.jar" />
+ <property name="sca.contribution" value="illegal1-supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/illegalsupplychain.composite \
+ supplychain/warehouse/JavaWarehouseComponentImpl.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="IllegalSupplyChain2.jar" />
+ <property name="sca.contribution" value="illegal2-supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/illegalsupplychain.composite \
+ supplychain/warehouse/JavaWarehouseComponentImpl.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="IllegalCustomer.jar" />
+ <property name="sca.contribution" value="illegal-customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/illegal/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CustomerInterface.jar" />
+ <property name="sca.contribution" value="customer-interface-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CustomerImpl.jar" />
+ <property name="sca.contribution" value="customer-impl-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/JavaCustomerComponentImpl.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..814c38777a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.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 supplychain.customer;
+
+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);
+
+ public int outstandingOrderCount();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..e4daf0ec02
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private static int outstandingOrderCount;
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ System.out.println("Created " + this.getClass().getName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ public void purchaseGoods() {
+ outstandingOrderCount++;
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrderCount--;
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public int outstandingOrderCount() {
+ return outstandingOrderCount;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..e4b3bc7048
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.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 supplychain.illegal;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+import supplychain.retailer.JavaRetailerComponentImpl;
+import supplychain.retailer.Retailer;
+import supplychain.warehouse.JavaWarehouseComponentImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private static int outstandingOrderCount;
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ System.out.println("Created " + this.getClass().getName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ public void purchaseGoods() {
+
+ Retailer retailerImpl = new JavaRetailerComponentImpl();
+ System.out.println("Created a retailer from Customer " + retailerImpl);
+
+ Warehouse warehouseImpl = new JavaWarehouseComponentImpl();
+ System.out.println("Created a warehouse from Customer " + warehouseImpl);
+
+ outstandingOrderCount++;
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrderCount--;
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public int outstandingOrderCount() {
+ return outstandingOrderCount;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..698aa2aa5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (POJO implementation).
+ */
+@Service(Retailer.class)
+@Scope("STATELESS")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public JavaRetailerComponentImpl() {
+ System.out.println("Created " + this.getClass().getName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+
+ public Warehouse getWarehouse() {
+ return warehouse;
+ }
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/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.retailer;
+
+/**
+ * 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-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..9e01f00a79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.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 supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (POJO implementation).
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ public JavaShipperComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ @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-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/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.shipper;
+
+/**
+ * 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-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..cdd12d589d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.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 supplychain.warehouse;
+
+import org.osoa.sca.annotations.Scope;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (POJO implementation).
+ */
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public JavaWarehouseComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ 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-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/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.warehouse;
+
+/**
+ * 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-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..714d1826e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+
+ <deployable composite="supplychain:supplychain"/>
+
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.xml
new file mode 100644
index 0000000000..7f7dc969e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.xml
new file mode 100644
index 0000000000..7f7dc969e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml
new file mode 100644
index 0000000000..8a2bec308f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.xml
new file mode 100644
index 0000000000..c77c4c1c7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.customer"/>
+ <export.java package="supplychain.illegal"/>
+ <import.java package="supplychain.retailer"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..210a68011f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..d118cceef9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+
+ <import.java package="supplychain.customer"/>
+ <import.java package="supplychain.illegal"/>
+ <import.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml
new file mode 100644
index 0000000000..d37b6659da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml
new file mode 100644
index 0000000000..77b28d9023
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.shipper"/>
+ <import.java package="supplychain.customer"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..8ec290a831
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+
+ <deployable composite="supplychain:supplychain"/>
+
+ <import.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml
new file mode 100644
index 0000000000..1398416978
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite
new file mode 100644
index 0000000000..db1f0d34e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.illegal.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite
new file mode 100644
index 0000000000..5be79b741a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.customer.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType
new file mode 100644
index 0000000000..a76fae8090
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="JavaWarehouseComponentImpl">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/pom.xml
new file mode 100644
index 0000000000..5c22d215be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-classloader-test</artifactId>
+ <name>Apache Tuscany Contribution Classloader tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-monitor-logging</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </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-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java
new file mode 100644
index 0000000000..692f16f6f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.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.sca.test.contribution;
+
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URLClassLoader;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ *
+ * Contribution ClassLoading integration tests
+ */
+
+public class ContributionTestCase {
+
+ private SupplyChain supplyChain;
+
+
+ @Before
+ public void setUp() throws Exception {
+ supplyChain = new SupplyChain();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ supplyChain.tearDown();
+
+ }
+
+
+ /**
+ * Test static ClassLoading for classes that are visible from contribution
+ *
+ * @throws Exception
+ */
+ public void staticClassLoadingTestForVisibleClasses() throws Exception {
+
+ Contribution customerContribution = supplyChain.getContribution("Customer");
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class<?> customerClass = customerClassRef.getJavaClass();
+
+ Class customerClassFromContribution = customerContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Assert.assertEquals(customerClass, customerClassFromContribution);
+
+ Object customer = supplyChain.getCustomer(customerClass);
+
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+
+ m = customerClass.getMethod("outstandingOrderCount");
+
+ int retries = 10;
+ int outstandingCount = 1;
+ while (retries-- > 0) {
+
+ outstandingCount = (int)(Integer)m.invoke(customer);
+ if (outstandingCount == 0)
+ break;
+ else
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(0, outstandingCount);
+
+
+ }
+
+
+ /**
+ * Test dynamic ClassLoading for classes that are visible from contribution
+ *
+ * @throws Exception
+ */
+ public void dynamicClassLoadingTestForVisibleClasses() throws Exception {
+
+ Contribution customerContribution = supplyChain.getContribution("Customer");
+ Contribution retailerContribution = supplyChain.getContribution("Retailer");
+ Contribution warehouseContribution = supplyChain.getContribution("Warehouse");
+ Contribution shipperContribution = supplyChain.getContribution("Shipper");
+ Contribution supplyChainContribution = supplyChain.getContribution("SupplyChain");
+
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class customerClass = customerClassRef.getJavaClass();
+
+ Class customerClassFromContribution = customerContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Assert.assertEquals(customerClass, customerClassFromContribution);
+
+ Object customer = supplyChain.getCustomer(customerClass);
+ Assert.assertTrue(customerClass.isInstance(customer));
+
+ ClassReference retailerClassRef = new ClassReference("supplychain.retailer.Retailer");
+ retailerClassRef = retailerContribution.getModelResolver().resolveModel(ClassReference.class, retailerClassRef);
+ Class retailerClass = retailerClassRef.getJavaClass();
+
+ Class retailerClassFromContribution = retailerContribution.getClassLoader().loadClass("supplychain.retailer.Retailer");
+ Assert.assertEquals(retailerClass, retailerClassFromContribution);
+
+ Class retailerClassFromCustomer = customerContribution.getClassLoader().loadClass("supplychain.retailer.Retailer");
+ Assert.assertEquals(retailerClass, retailerClassFromCustomer);
+
+ ClassReference warehouseClassRef = new ClassReference("supplychain.warehouse.Warehouse");
+ warehouseClassRef = warehouseContribution.getModelResolver().resolveModel(ClassReference.class, warehouseClassRef);
+ Class warehouseClass = warehouseClassRef.getJavaClass();
+
+ Class warehouseClassFromContribution = warehouseContribution.getClassLoader().loadClass("supplychain.warehouse.Warehouse");
+ Assert.assertEquals(warehouseClass, warehouseClassFromContribution);
+
+ Class warehouseClassFromRetailer = retailerContribution.getClassLoader().loadClass("supplychain.warehouse.Warehouse");
+ Assert.assertEquals(warehouseClass, warehouseClassFromRetailer);
+
+ ClassReference shipperClassRef = new ClassReference("supplychain.shipper.Shipper");
+ shipperClassRef = shipperContribution.getModelResolver().resolveModel(ClassReference.class, shipperClassRef);
+ Class shipperClass = shipperClassRef.getJavaClass();
+
+ Class shipperClassFromContribution = shipperContribution.getClassLoader().loadClass("supplychain.shipper.Shipper");
+ Assert.assertEquals(shipperClass, shipperClassFromContribution);
+
+ Class shipperClassFromWarehouse = shipperContribution.getClassLoader().loadClass("supplychain.shipper.Shipper");
+ Assert.assertEquals(shipperClass, shipperClassFromWarehouse);
+
+ Class customerClassFromShipper = shipperContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Assert.assertEquals(customerClass, customerClassFromShipper);
+
+ Class customerClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Assert.assertEquals(customerClass, customerClassFromSupplyChain);
+ Class retailerClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.retailer.Retailer");
+ Assert.assertEquals(retailerClass, retailerClassFromSupplyChain);
+ Class warehouseClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.warehouse.Warehouse");
+ Assert.assertEquals(warehouseClass, warehouseClassFromSupplyChain);
+ Class shipperClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.shipper.Shipper");
+ Assert.assertEquals(shipperClass, shipperClassFromSupplyChain);
+
+ }
+
+ /**
+ * Test dynamic ClassLoading for classes that are visible from contribution
+ *
+ * @throws Exception
+ */
+ public void dynamicClassLoadingTestForNonImportedClasses() throws Exception {
+
+ Contribution customerContribution = supplyChain.getContribution("Customer");
+ Contribution shipperContribution = supplyChain.getContribution("Shipper");
+
+ Class customerClass = customerContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Class shipperClass = shipperContribution.getClassLoader().loadClass("supplychain.shipper.Shipper");
+
+ try {
+ customerClass.getClassLoader().loadClass("supplychain.warehouse.Warehouse");
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+ try {
+ customerClass.getClassLoader().loadClass("supplychain.shipper.JavaShipperComponentImpl");
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+
+ try {
+ Class.forName("supplychain.warehouse.Warehouse", true, customerClass.getClassLoader());
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+ try {
+ Class.forName("supplychain.shipper.JavaShipperComponentImpl", true, customerClass.getClassLoader());
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+
+ try {
+ shipperClass.getClassLoader().loadClass("supplychain.warehouse.JavaWarehouseComponentImpl");
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+ try {
+ shipperClass.getClassLoader().loadClass("supplychain.retailer.Retailer");
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+
+ try {
+ Class.forName("supplychain.warehouse.JavaWarehouseComponentImpl", true, shipperClass.getClassLoader());
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+ try {
+ Class.forName("supplychain.retailer.Retailer", true, shipperClass.getClassLoader());
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+
+
+ }
+
+
+ /**
+ * This test ensures that classes from imported packages can be statically loaded
+ * from other contributions even though the classes are not on CLASSPATH or on the
+ * parent ClassLoader, or the thread context ClassLoader.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testValidStaticClassLoading() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader());
+
+ staticClassLoadingTestForVisibleClasses();
+ }
+
+ /**
+ * This test ensures that all imported classes are loaded from the exporting contributions
+ * rather than the parent classLoader. If any of the interface classes were incorrectly loaded
+ * through the parent ClassLoader, LinkageError should result.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testValidStaticClassLoadingWithContributionsInParentClassLoader() throws Exception {
+
+
+ URLClassLoader parentClassLoader = new URLClassLoader(
+ supplyChain.getContributionURLs(),
+ this.getClass().getClassLoader());
+
+ supplyChain.setUp(parentClassLoader);
+
+ staticClassLoadingTestForVisibleClasses();
+ }
+
+
+ /**
+ * This test ensures that classes from imported packages can be dynamically loaded from
+ * other contributions even though the classes are not on CLASSPATH or on the
+ * parent ClassLoader, or the thread context ClassLoader.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testValidDynamicClassLoading() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader());
+
+ dynamicClassLoadingTestForVisibleClasses();
+ }
+
+ /**
+ * This test ensures that all imported classes are dynamically loaded from the exporting
+ * contributions rather than the parent classLoader. If any of the interface classes were
+ * incorrectly loaded through the parent, NoClassDefFoundError or LinkageError should result.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testValidDynamicClassLoadingWithContributionsInParentClassLoader() throws Exception {
+
+
+ URLClassLoader parentClassLoader = new URLClassLoader(
+ supplyChain.getContributionURLs(),
+ this.getClass().getClassLoader());
+
+ supplyChain.setUp(parentClassLoader);
+
+ dynamicClassLoadingTestForVisibleClasses();
+ }
+
+ @Test
+ public void testIllegalStaticClassLoading1() throws Exception {
+ // FIXME we have commented this code as we are not throwing exceptions anymore
+ // need to deal with monitor logs to catch the errors.
+
+ /*try {
+ supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_ILLEGAL_1);
+
+ Assert.fail("Composite containing unresolved references resolved incorrectly");
+ } catch (ContributionResolveException e) {
+ }*/
+ }
+
+ @Test
+ public void testIllegalStaticClassLoading2() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_ILLEGAL_2);
+
+ Contribution customerContribution = supplyChain.getContribution("Customer");
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class<?> customerClass = customerClassRef.getJavaClass();
+
+ Object customer = supplyChain.getCustomer(customerClass);
+
+ try {
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ Assert.fail("Classloading exception not thrown as expected");
+ } catch (InvocationTargetException e) {
+
+ Throwable cause = e.getCause();
+ Assert.assertTrue(cause instanceof NoClassDefFoundError);
+ Assert.assertTrue(cause.getMessage().indexOf("JavaWarehouseComponentImpl") > -1); }
+
+ }
+
+ /**
+ * This test ensures that classes from imported packages can be dynamically loaded from
+ * other contributions even though the classes are not on CLASSPATH or on the
+ * parent ClassLoader, or the thread context ClassLoader.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testIllegalDynamicClassLoading() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader());
+
+ dynamicClassLoadingTestForNonImportedClasses();
+ }
+
+
+ /**
+ * Self-contained contribution containing composites, componentType files and implementations
+ * should not require import/export statements for these files to find each other or for Tuscany
+ * to load these files.
+ * @throws Exception
+ */
+ @Test
+ public void testSelfContainedContribution() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_SELFCONTAINED);
+
+ staticClassLoadingTestForVisibleClasses();
+ }
+
+ @Test
+ public void testContributionsWithSplitPackage() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_SPLITPACKAGE);
+
+ staticClassLoadingTestForVisibleClasses();
+
+ dynamicClassLoadingTestForNonImportedClasses();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.java
new file mode 100644
index 0000000000..1ec7aaaa3a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.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.test.contribution;
+
+
+import java.io.File;
+import java.net.URL;
+import java.util.Hashtable;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.junit.Assert;
+
+/*
+ *
+ * Contribution ClassLoading integration tests
+ */
+
+public class SupplyChain {
+
+ public static final int SUPPLYCHAIN = 0;
+ public static final int SUPPLYCHAIN_ILLEGAL_1 = 1;
+ public static final int SUPPLYCHAIN_ILLEGAL_2 = 2;
+ public static final int SUPPLYCHAIN_SELFCONTAINED = 3;
+ public static final int SUPPLYCHAIN_SPLITPACKAGE = 4;
+
+ private String folderName = "../contribution-classes/target/classes";
+
+ private String customerJarName = "Customer";
+ private String retailerJarName = "Retailer";
+ private String warehouseJarName = "Warehouse";
+ private String shipperJarName = "Shipper";
+ private String supplychainJarName = "SupplyChain";
+ private String illegalSupplyChain1JarName = "IllegalSupplyChain1";
+ private String illegalSupplyChain2JarName = "IllegalSupplyChain2";
+ private String illegalCustomerJarName = "IllegalCustomer";
+ private String completeSupplychainJarName = "CompleteSupplyChain";
+ private String customerInterfaceJarName = "CustomerInterface";
+ private String customerImplJarName = "CustomerImpl";
+
+
+ private EmbeddedSCADomain domain;
+ private ContributionService contributionService;
+ private int supplyChainVersion;
+
+ private Hashtable<String, Contribution> contributions = new Hashtable<String, Contribution>();
+
+ private URL customerContribURL;
+ private URL retailerContribURL;
+ private URL warehouseContribURL;
+ private URL shipperContribURL;
+ private URL supplyChainContribURL;
+ private URL illegalSupplyChain1ContribURL;
+ private URL illegalSupplyChain2ContribURL;
+ private URL illegalCustomerContribURL;
+ private URL completeSupplyChainContribURL;
+ private URL customerInterfaceContribURL;
+ private URL customerImplContribURL;
+
+ public SupplyChain() throws Exception {
+
+ customerContribURL = new File(folderName + "/" + customerJarName + ".jar").toURI().toURL();
+ retailerContribURL = new File(folderName + "/" + retailerJarName + ".jar").toURI().toURL();
+ warehouseContribURL = new File(folderName + "/" + warehouseJarName + ".jar").toURI().toURL();
+ shipperContribURL = new File(folderName + "/" + shipperJarName + ".jar").toURI().toURL();
+ supplyChainContribURL = new File(folderName + "/" + supplychainJarName + ".jar").toURI().toURL();
+ illegalSupplyChain1ContribURL = new File(folderName + "/" + illegalSupplyChain1JarName + ".jar").toURI().toURL();
+ illegalSupplyChain2ContribURL = new File(folderName + "/" + illegalSupplyChain2JarName + ".jar").toURI().toURL();
+ illegalCustomerContribURL = new File(folderName + "/" + illegalCustomerJarName + ".jar").toURI().toURL();
+ completeSupplyChainContribURL = new File(folderName + "/" + completeSupplychainJarName + ".jar").toURI().toURL();
+ customerInterfaceContribURL = new File(folderName + "/" + customerInterfaceJarName + ".jar").toURI().toURL();
+ customerImplContribURL = new File(folderName + "/" + customerImplJarName + ".jar").toURI().toURL();
+ }
+
+ public void setUp(ClassLoader parentClassLoader) throws Exception {
+ this.setUp(parentClassLoader, SUPPLYCHAIN);
+ }
+
+ public void setUp(ClassLoader parentClassLoader, int supplyChainVersion) throws Exception {
+
+ this.supplyChainVersion = supplyChainVersion;
+
+ Thread.currentThread().setContextClassLoader(parentClassLoader);
+
+ //Create an embedded SCA domain
+ domain = new EmbeddedSCADomain(parentClassLoader, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ this.contributionService = domain.getContributionService();
+
+ addContributions(supplyChainVersion);
+ }
+
+ protected void addContributions(int supplyChainVersion) throws Exception {
+
+ Contribution contribution;
+
+ if (supplyChainVersion != SUPPLYCHAIN_SELFCONTAINED) {
+ contribution = contributionService.contribute("Shipper", shipperContribURL, true);
+ contributions.put("Shipper", contribution);
+ contribution = contributionService.contribute("Warehouse", warehouseContribURL, true);
+ contributions.put("Warehouse", contribution);
+ contribution = contributionService.contribute("Retailer", retailerContribURL, true);
+ contributions.put("Retailer", contribution);
+ }
+
+ switch (supplyChainVersion) {
+ case SUPPLYCHAIN:
+ contribution = contributionService.contribute("Customer", customerContribURL, true);
+ contributions.put("Customer", contribution);
+
+ contribution = contributionService.contribute("SupplyChain", supplyChainContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ case SUPPLYCHAIN_ILLEGAL_1:
+ contribution = contributionService.contribute("Customer", customerContribURL, true);
+ contributions.put("Customer", contribution);
+
+ contribution = contributionService.contribute("SupplyChain", illegalSupplyChain1ContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ case SUPPLYCHAIN_ILLEGAL_2:
+ contribution = contributionService.contribute("Customer", illegalCustomerContribURL, true);
+ contributions.put("Customer", contribution);
+
+ contribution = contributionService.contribute("SupplyChain", illegalSupplyChain2ContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ case SUPPLYCHAIN_SELFCONTAINED:
+ contribution = contributionService.contribute("SupplyChain", completeSupplyChainContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ case SUPPLYCHAIN_SPLITPACKAGE:
+ contribution = contributionService.contribute("Customer", customerInterfaceContribURL, true);
+ contributions.put("Customer", contribution);
+
+ contribution = contributionService.contribute("CustomerImpl", customerImplContribURL, true);
+ contributions.put("CustomerImpl", contribution);
+
+ contribution = contributionService.contribute("SupplyChain", supplyChainContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ }
+
+ // SUPPLYCHAIN_ILLEGAL_1 should throw an exception when the composite is resolved, and hence
+ // should not get this far.
+ Assert.assertTrue(supplyChainVersion != SUPPLYCHAIN_ILLEGAL_1);
+
+
+ for (Contribution c : contributions.values()) {
+
+ for (Composite deployable : c.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : contributions.get("SupplyChain").getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void tearDown() throws Exception {
+
+ if (domain == null)
+ return;
+
+ for (String contributionURI : contributions.keySet()) {
+ contributionService.remove(contributionURI);
+ }
+
+
+ if (contributions.get("SupplyChain") != null) {
+ // Stop Components from my composite
+ for (Composite deployable : contributions.get("SupplyChain").getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+ public Contribution getContribution(String uri) {
+ if (supplyChainVersion == SUPPLYCHAIN_SELFCONTAINED)
+ return contributions.get("SupplyChain");
+ else
+ return contributions.get(uri);
+ }
+
+ public Object getCustomer(Class<?> customerClass) {
+ return domain.getService(customerClass, "CustomerComponent");
+ }
+
+ public URL[] getContributionURLs() {
+ return new URL[] {
+ customerContribURL,
+ retailerContribURL,
+ warehouseContribURL,
+ shipperContribURL,
+ supplyChainContribURL
+ };
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCaseFIXME.java b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCaseFIXME.java
new file mode 100644
index 0000000000..b123951ef6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCaseFIXME.java
@@ -0,0 +1,381 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.ServiceReference;
+
+/*
+ *
+ * Contribution ClassLoading integration tests
+ */
+
+//FIXME This test case needs some serious rework!
+// First it is very dependent on the names of the Tuscany runtime JARs
+// and this is going to be difficult to maintain
+// Second its usage of reflection requires the Tuscany implementation classes
+// to be made public and this breaks isolation between modules.
+public class TuscanyClassloadingTestCaseFIXME {
+
+ // private static final int SCA_API = 1;
+ // private static final int TUSCANY_CORE_SPI = 2;
+ // private static final int TUSCANY_RUNTIME = 3;
+ // private static final int TUSCANY_EXTENSIONS = 4;
+ // private static final int TUSCANY_DEPENDENCIES = 0;
+
+ private static final String[] scaApiJars = {"sca-api"};
+ private static final String[] tuscanyCoreSpiJars =
+ {"core-spi", "interface", "interface-java", "interface-wsdl", "assembly", "policy", "databinding",
+ "contribution", "definitions"};
+ private static final String[] tuscanyRuntimeJars =
+ {
+
+ "binding-sca-xml", "binding-sca", "assembly-java-dsl", "assembly-xml", "assembly-xsd", "contribution-impl",
+ "contribution-java", "contribution-namespace", "core-databinding", "core-spring", "core", "definitions-xml",
+ "domain-api", "domain-impl", "domain", "extension-helper", "host-embedded", "interface-java-xml",
+ "interface-wsdl-xml", "java2wsdl", "node-api", "node-impl", "node", "osgi-runtime", "policy-logging",
+ "policy-security", "policy-transaction", "policy-xml", "wsdl2java"};
+ private static final String[] tuscanyExtensionJars =
+ {"binding-dwr", "binding-ejb", "binding-feed", "binding-http", "binding-jms", "binding-jsonrpc",
+ "binding-notification", "binding-rmi", "binding-sca-axis2", "binding-ws-axis2", "binding-ws-xml",
+ "binding-ws", "databinding-axiom", "databinding-fastinfoset", "databinding-jaxb", "databinding-json",
+ "databinding-saxon", "databinding-sdo-axiom", "databinding-sdo", "databinding-xmlbeans", "host-http",
+ "host-jetty", "host-rmi", "host-tomcat", "host-webapp", "implementation-das.jar", "implementation-data.jar",
+ "implementation-java-runtime", "implementation-java-xml", "implementation-java",
+ "implementation-node-runtime", "implementation-node-xml", "implementation-node",
+ "implementation-notification", "implementation-osgi", "implementation-resource", "implementation-script",
+ "implementation-spring", "implementation-xquery", "contribution-osgi"};
+
+ private Class<?> embeddedDomainClass;
+ Object domain;
+
+ @Before
+ public void setUp() throws Exception {
+
+ embeddedDomainClass = getEmbeddedDomainClass();
+
+ Constructor c = embeddedDomainClass.getConstructor(ClassLoader.class, String.class);
+ // Create an embedded domain
+ domain = c.newInstance(embeddedDomainClass.getClassLoader(), "http://localhost");
+
+ // Start the domain
+ invokeNoArgsMethod(domain, "start");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ // Stop the domain
+ invokeNoArgsMethod(domain, "stop");
+
+ }
+
+ /**
+ * Create a ClassLoader hierarchy for Tuscany runtime
+ * Dependencies <- SCA-API <- Core-SPI+ Runtime <- Extensions
+ * Load the embedded SCA domain class using the runtime ClassLoader
+ *
+ * @return embedded SCA domain class
+ * @throws Exception
+ */
+ private Class<?> getEmbeddedDomainClass() throws Exception {
+
+ URL[] scaApiUrls;
+ URL[] runtimeUrls;
+ URL[] extensionUrls;
+ URL[] dependencyUrls;
+
+ // When the test is run under Eclipse, the ClassLoader for the test is
+ // sun.misc.Launcher$AppClassLoader. The first code path is taken.
+ // When the test is run under Maven, the ClassLoader for the test is
+ // org.apache.maven.surefire.booter.IsolatedClassLoader, which is a subclass
+ // of URLClassLoader. The second code path is taken.
+ if (!(this.getClass().getClassLoader() instanceof URLClassLoader)) {
+ String classPath = System.getProperty("java.class.path");
+ String[] classPathEntries = classPath.split(System.getProperty("path.separator"));
+ HashSet<String> dependentJars = new HashSet<String>();
+ for (int i = 0; i < classPathEntries.length; i++) {
+ dependentJars.add(classPathEntries[i]);
+ }
+
+ scaApiUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars, scaApiJars);
+ runtimeUrls =
+ getTuscanyClassLoaderURLs(classPathEntries, dependentJars, tuscanyCoreSpiJars, tuscanyRuntimeJars);
+ extensionUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars, tuscanyExtensionJars);
+ dependencyUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars);
+ } else {
+ HashSet<URL> dependentJars = new HashSet<URL>();
+ URL[] classPathEntries = ((URLClassLoader)this.getClass().getClassLoader()).getURLs();
+ for (int i = 0; i < classPathEntries.length; i++) {
+ dependentJars.add(classPathEntries[i]);
+ }
+ scaApiUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars, scaApiJars);
+ runtimeUrls =
+ getTuscanyClassLoaderURLs(classPathEntries, dependentJars, tuscanyCoreSpiJars, tuscanyRuntimeJars);
+ extensionUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars, tuscanyExtensionJars);
+ dependencyUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars);
+
+ }
+
+ boolean useSingleClassLoader =
+ (scaApiUrls == null || scaApiUrls.length == 0) || (runtimeUrls == null || runtimeUrls.length == 0)
+ || (extensionUrls == null || extensionUrls.length == 0)
+ || (dependencyUrls == null || dependencyUrls.length == 0);
+
+ if (useSingleClassLoader) {
+ return EmbeddedSCADomain.class;
+ } else {
+
+ ClassLoader dependencyLoader = new URLClassLoader(dependencyUrls, null);
+ ClassLoader scaApiLoader = new URLClassLoader(scaApiUrls, dependencyLoader);
+ ClassLoader runtimeClassLoader = new URLClassLoader(runtimeUrls, scaApiLoader);
+ ClassLoader extensionClassLoader = new URLClassLoader(extensionUrls, runtimeClassLoader);
+
+ Class<?> serviceDiscoveryClass = runtimeClassLoader.loadClass(ServiceDiscovery.class.getName());
+ Method getInstanceMethod = serviceDiscoveryClass.getMethod("getInstance");
+ Object serviceDiscoveryObj = getInstanceMethod.invoke(null);
+ Method registerClassLoaderMethod =
+ serviceDiscoveryClass.getMethod("registerClassLoader", ClassLoader.class);
+ registerClassLoaderMethod.invoke(serviceDiscoveryObj, extensionClassLoader);
+
+ Thread.currentThread().setContextClassLoader(extensionClassLoader);
+
+ return runtimeClassLoader.loadClass(EmbeddedSCADomain.class.getName());
+
+ }
+
+ }
+
+ /**
+ * From the list of entries in the test ClassLoader, match
+ * Tuscany jars corresponding to a ClassLoader, and return the list
+ * of matching entries as URLs.
+ * This method is used when the test is run under eclipse, using CLASSPATH
+ * based application ClassLoader.
+ *
+ * @param classPathEntries List of entries on CLASSPATH
+ * @param dependentJars Complete set of jars, remove jars corresponding to this
+ * ClassLoader from the set.
+ * @param jars List of Tuscany jars corresponding to this ClassLoader
+ * @return Matching URLs for the ClassLoader
+ * @throws IOException
+ */
+ private URL[] getTuscanyClassLoaderURLs(String[] classPathEntries, HashSet<String> dependentJars, String[]... jars)
+ throws IOException {
+
+ String pathSeparator = System.getProperty("file.separator");
+ HashSet<String> classPathEntrySet;
+
+ if (jars.length == 0)
+ classPathEntrySet = dependentJars;
+ else {
+ classPathEntrySet = new HashSet<String>();
+
+ for (int i = 0; i < classPathEntries.length; i++) {
+
+ String classPathEntry = classPathEntries[i];
+ for (int j = 0; j < jars.length; j++) {
+ String[] jarList = jars[j];
+ if (jarList != null) {
+ for (int k = 0; k < jarList.length; k++) {
+ String jarName = "tuscany-" + jarList[k];
+ String alternateJarName = "modules" + pathSeparator + jarList[k];
+ if (classPathEntry.indexOf(jarName) >= 0 || classPathEntry.indexOf(alternateJarName) >= 0) {
+ classPathEntrySet.add(classPathEntry);
+ dependentJars.remove(classPathEntry);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ ArrayList<URL> urls = new ArrayList<URL>();
+
+ for (String fileName : classPathEntrySet) {
+ File file = new File((String)fileName);
+ if (!file.exists()) {
+ throw new FileNotFoundException(fileName);
+
+ } else {
+ urls.add(file.toURL());
+
+ }
+ }
+
+ return (URL[])urls.toArray(new URL[urls.size()]);
+ }
+
+ /**
+ * From the list of URLs of the test ClassLoader, match
+ * Tuscany jars corresponding to a ClassLoader, and return the matching URLs
+ * This method is used when the test is run under Maven. The test ClassLoader is
+ * org.apache.maven.surefire.booter.IsolatedClassLoader, which is a subclass
+ * of URLClassLoader
+ *
+ * @param classPathEntries List of URLs from the test ClassLoader
+ * @param dependentJars Complete set of jars, remove jars corresponding to this
+ * ClassLoader from the set.
+ * @param jars List of Tuscany jars corresponding to this ClassLoader
+ * @return Matching URLs for the ClassLoader
+ * @throws IOException
+ */
+ private URL[] getTuscanyClassLoaderURLs(URL[] classPathEntries, HashSet<URL> dependentJars, String[]... jars)
+ throws IOException {
+
+ String pathSeparator = System.getProperty("file.separator");
+ HashSet<URL> classPathEntrySet;
+
+ if (jars.length == 0)
+ classPathEntrySet = dependentJars;
+ else {
+ classPathEntrySet = new HashSet<URL>();
+
+ for (int i = 0; i < classPathEntries.length; i++) {
+
+ URL classPathEntry = classPathEntries[i];
+ String classPathEntryStr = classPathEntry.getPath();
+ for (int j = 0; j < jars.length; j++) {
+ String[] jarList = jars[j];
+ if (jarList != null) {
+ for (int k = 0; k < jarList.length; k++) {
+ String jarName = "tuscany-" + jarList[k];
+ String alternateJarName = "modules" + pathSeparator + jarList[k];
+ if (classPathEntryStr.indexOf(jarName) >= 0 || classPathEntryStr.indexOf(alternateJarName) >= 0) {
+ classPathEntrySet.add(classPathEntry);
+ dependentJars.remove(classPathEntry);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ return (URL[])classPathEntrySet.toArray(new URL[classPathEntrySet.size()]);
+ }
+
+ private Object invokeNoArgsMethod(Object obj, String methodName) throws Exception {
+
+ return obj.getClass().getMethod(methodName).invoke(obj);
+ }
+
+ private Object invokeOneArgMethod(Object obj, String methodName, Class argType, Object arg) throws Exception {
+
+ return obj.getClass().getMethod(methodName, argType).invoke(obj, arg);
+ }
+
+ /**
+ *
+ * Load Tuscany runtime using multiple ClassLoaders, and run supplychain
+ * test.
+ *
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void test() throws Exception {
+
+ ClassLoader runtimeClassloader = embeddedDomainClass.getClassLoader();
+
+ if (runtimeClassloader == this.getClass().getClassLoader()) {
+ System.out.println("Runtime and test loaded using the same classloader " + runtimeClassloader);
+ } else {
+ System.out
+ .println("Running test using separate Tuscany classloaders, runtime classloader=" + runtimeClassloader);
+ ClassLoader apiClassLoader =
+ runtimeClassloader.loadClass(ServiceReference.class.getName()).getClassLoader();
+ Assert.assertTrue(apiClassLoader != runtimeClassloader);
+
+ try {
+ runtimeClassloader.loadClass("org.apache.tuscany.sca.implementation.java.JavaImplementation");
+ Assert.fail("Loaded extension class incorrectly from runtimeClassLoader");
+ } catch (ClassNotFoundException e) {
+ }
+
+ }
+
+ // Contribute supplychain (as single contribution)
+ Object contributionService = invokeNoArgsMethod(domain, "getContributionService");
+ Method contributeMethod =
+ contributionService.getClass().getMethod("contribute", String.class, URL.class, boolean.class);
+
+ String folderName = "../contribution-classes/target/classes";
+ String supplychainJarName = "CompleteSupplyChain";
+ URL supplyChainContribURL = new File(folderName + "/" + supplychainJarName + ".jar").toURL();
+ Object contribution = contributeMethod.invoke(contributionService, "SupplyChain", supplyChainContribURL, true);
+
+ Object composite = ((List)invokeNoArgsMethod(contribution, "getDeployables")).get(0);
+ Object domainComposite = invokeNoArgsMethod(domain, "getDomainComposite");
+ List includes = (List)invokeNoArgsMethod(domainComposite, "getIncludes");
+ includes.add(composite);
+ //Object compositeBuilder = invokeNoArgsMethod(domain, "getCompositeBuilder");
+ Object compositeActivator = invokeNoArgsMethod(domain, "getCompositeActivator");
+
+ Class compositeClass = embeddedDomainClass.getClassLoader().loadClass(Composite.class.getName());
+ invokeOneArgMethod(domain, "buildComposite", compositeClass, composite);
+ invokeOneArgMethod(compositeActivator, "activate", compositeClass, composite);
+ invokeOneArgMethod(compositeActivator, "start", compositeClass, composite);
+
+ // Get customer service
+ Method getClassLoaderMethod = contribution.getClass().getMethod("getClassLoader");
+ ClassLoader classLoader = (ClassLoader)getClassLoaderMethod.invoke(contribution);
+
+ Class customerClass = classLoader.loadClass("supplychain.customer.Customer");
+ Method getServiceMethod = embeddedDomainClass.getMethod("getService", Class.class, String.class);
+ Object customer = getServiceMethod.invoke(domain, customerClass, "CustomerComponent");
+
+ // Invoke purchaseGoods
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ m = customerClass.getMethod("outstandingOrderCount");
+
+ int retries = 10;
+ int outstandingCount = 1;
+ while (retries-- > 0) {
+
+ outstandingCount = (int)(Integer)m.invoke(customer);
+ if (outstandingCount == 0)
+ break;
+ else
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(0, outstandingCount);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-classloader/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/pom.xml
new file mode 100644
index 0000000000..4007f0115c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-classloader/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-classloader</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Contribution ClassLoader Integration Tests</name>
+
+ <modules>
+ <module>contribution-classes</module>
+ <module>contribution-test</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/pom.xml
new file mode 100644
index 0000000000..4aea1320f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/pom.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-composite</artifactId>
+ <name>Apache Tuscany SCA Contribution Export Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </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-android/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java
new file mode 100644
index 0000000000..e65422136f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.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 hello;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the Hello service.
+ */
+@Remotable
+public interface Hello {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java
new file mode 100644
index 0000000000..5369c18497
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.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 hello;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(Hello.class)
+public class HelloImpl implements Hello {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..3c14560a56
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-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://hello"
+ xmlns:hello="http://hello">
+ <deployable composite="hello:hello"/>
+ <export namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/resources/hello.composite b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/resources/hello.composite
new file mode 100644
index 0000000000..636b7111d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/main/resources/hello.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello"
+ name="hello">
+
+ <service name="HelloService" promote="HelloServiceComponent"/>
+
+ <component name="HelloServiceComponent">
+ <implementation.java class="hello.HelloImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java
new file mode 100644
index 0000000000..72b77564d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.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.test.contribution;
+
+import hello.Hello;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+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 org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ // Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ URL helloURL = getContributionURL(Hello.class);
+
+ // File helloContrib = new File("./target/classes/");
+ // URL helloURL = helloContrib.toURL();
+ Contribution consumerContribution =
+ contributionService.contribute("http://import-export/hello", helloURL, false);
+ Composite consumerComposite = consumerContribution.getDeployables().get(0);
+ domain.getDomainComposite().getIncludes().add(consumerComposite);
+ domain.buildComposite(consumerComposite);
+
+ // Start Components from my composite
+ domain.getCompositeActivator().activate(consumerComposite);
+ domain.getCompositeActivator().start(consumerComposite);
+ }
+
+ private URL getContributionURL(Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cls.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ public void testHello() throws IOException {
+ Hello hello = domain.getService(Hello.class, "HelloServiceComponent");
+ assertNotNull(hello);
+ assertEquals(hello.getGreetings("lresende"), "Hello lresende");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/pom.xml
new file mode 100644
index 0000000000..24346c6d1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/pom.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-java</artifactId>
+ <name>Apache Tuscany SCA Contribution Java Export Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </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-android/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..74d22ed830
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..dc33dfa560
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <export.java package="helloworld"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType
new file mode 100644
index 0000000000..5a14b41650
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.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="helloworld.HelloWorldService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/pom.xml
new file mode 100644
index 0000000000..ed399193df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-resource</artifactId>
+ <name>Apache Tuscany SCA Contribution Resource Export Integration Tests</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..f11eacb416
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ xmlns:helloworld="http://store">
+ <export.resource uri="ufservices/store.html"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html
new file mode 100644
index 0000000000..1ff281373a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html
@@ -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.
+-->
+<html>
+<head>
+<title>Store</TITLE>
+</head>
+
+<body>
+<h1>Sample Store Page</h1>
+</body>
+</html>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/pom.xml
new file mode 100644
index 0000000000..af619849ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-wsdl</artifactId>
+ <name>Apache Tuscany SCA Contribution WSDL Export Integration Tests</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b7394ec14b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <export namespace="http://helloworld"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl
new file mode 100644
index 0000000000..9b31363e1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl
@@ -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.
+-->
+
+<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 xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns2="http://helloworld2"
+ targetNamespace="http://helloworld"
+ elementFormDefault="qualified">
+
+ <xsd:import namespace="http://helloworld2" schemaLocation="helloworld.xsd" />
+
+ <element name="getGreetings" type="tns2:getGreetingsType"/>
+ <element name="getGreetingsResponse" type="tns2:getGreetingsResponseType"/>
+
+ </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:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd
new file mode 100644
index 0000000000..d3c83b08c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.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 targetNamespace="http://helloworld2"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://helloworld2">
+
+ <complexType name="getGreetingsType">
+ <sequence>
+ <element name="name" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="getGreetingsResponseType">
+ <sequence>
+ <element name="getGreetingsReturn" type="string"/>
+ </sequence>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/pom.xml
new file mode 100644
index 0000000000..6decf86182
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-composite</artifactId>
+ <name>Apache Tuscany SCA Contribution Import Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-composite</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </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-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..966f56d7d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.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 hello.Hello;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+ @Reference
+ protected Hello helloServiceRef;
+
+ public String getGreetings(String name) {
+ return helloServiceRef.getGreetings(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..3d43290380
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/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-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..74d22ed830
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..9f3f5be452
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello">
+ <deployable composite="helloworld:helloworldws"/>
+ <import namespace="http://hello"/>
+ <!-- import namespace="http://hello" location="http://import-export/contrib-composite"/ -->
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl
new file mode 100644
index 0000000000..9b31363e1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl
@@ -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.
+-->
+
+<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 xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns2="http://helloworld2"
+ targetNamespace="http://helloworld"
+ elementFormDefault="qualified">
+
+ <xsd:import namespace="http://helloworld2" schemaLocation="helloworld.xsd" />
+
+ <element name="getGreetings" type="tns2:getGreetingsType"/>
+ <element name="getGreetingsResponse" type="tns2:getGreetingsResponseType"/>
+
+ </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:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd
new file mode 100644
index 0000000000..d3c83b08c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworld.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 targetNamespace="http://helloworld2"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://helloworld2">
+
+ <complexType name="getGreetingsType">
+ <sequence>
+ <element name="name" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="getGreetingsResponseType">
+ <sequence>
+ <element name="getGreetingsReturn" type="string"/>
+ </sequence>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..e2f852ff7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.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://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello"
+ name="helloworldws">
+
+ <component name="SourceHelloServiceComponent">
+ <implementation.composite name="hello:hello"/>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <reference name="helloServiceRef" target="SourceHelloServiceComponent/HelloService"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java
new file mode 100644
index 0000000000..1176a89143
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.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.test.contribution;
+
+import hello.Hello;
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.URL;
+
+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 org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloWorldContribution;
+ private Contribution compositeContribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ //Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ // File compositeContribLocation = new File("../export-composite/target/classes");
+ // URL compositeContribURL = compositeContribLocation.toURL();
+ URL compositeContribURL = getContributionURL(Hello.class);
+ compositeContribution =
+ contributionService.contribute("http://import-export/export-composite", compositeContribURL, false);
+ for (Composite deployable : compositeContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+// File helloWorldContribLocation = new File("./target/classes/");
+// URL helloWorldContribURL = helloWorldContribLocation.toURL();
+ URL helloWorldContribURL = getContributionURL(HelloWorldService.class);
+ helloWorldContribution =
+ contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ private URL getContributionURL(Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cls.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/helloworld");
+ contributionService.remove("http://import-export/export-composite");
+
+ //Stop Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/pom.xml
new file mode 100644
index 0000000000..ee11269c71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-java</artifactId>
+ <name>Apache Tuscany SCA Contribution Java Import Java Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </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-android/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..4cdcc1fd0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/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-android/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..224e2c4d79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/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://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <deployable composite="helloworld:helloworldws"/>
+ <import.java package="helloworld"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..9b650e4acc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/main/resources/helloworldws.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"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java
new file mode 100644
index 0000000000..431988cc04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.contribution;
+
+import helloworld.HelloWorldImpl;
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+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 org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloWorldContribution;
+ private Contribution javaContribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ //Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ //File javaContribLocation = new File("../export-java/target/classes");
+ //URL javaContribURL = javaContribLocation.toURL();
+ URL javaContribURL = getContributionURL(HelloWorldService.class);
+ javaContribution = contributionService.contribute("http://import-export/export-java", javaContribURL, false);
+ for (Composite deployable : javaContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ //File helloWorldContribLocation = new File("./target/classes/");
+ //URL helloWorldContribURL = helloWorldContribLocation.toURL();
+ URL helloWorldContribURL = getContributionURL(HelloWorldImpl.class);
+ helloWorldContribution = contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ private URL getContributionURL(Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cls.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ public void testPing() throws IOException {
+ HelloWorldService helloWorldService =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+ assertEquals("Hello test", helloWorldService.getGreetings("test"));
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/helloworld");
+ contributionService.remove("http://import-export/export-java");
+
+ // Stop Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/pom.xml
new file mode 100644
index 0000000000..d3ea4f42dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/pom.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-resource</artifactId>
+ <name>Apache Tuscany SCA Contribution Resource Import Java Integration Tests</name>
+
+<dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-resource</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-resource</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </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-android/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ac6d7becb3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/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://store"
+ xmlns:store="http://store">
+ <deployable composite="store:store"/>
+ <import.resource uri="ufservices/store.html"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/main/resources/store.composite b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/main/resources/store.composite
new file mode 100644
index 0000000000..bb5a7b764f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/main/resources/store.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ xmlns:helloworld="http://store"
+ name="store">
+
+ <component name="store">
+ <tuscany:implementation.resource location="ufservices/store.html"/>
+ <service name="Resource">
+ <tuscany:binding.http uri="http://127.0.0.1:8085"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java
new file mode 100644
index 0000000000..1b7542b7d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.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.test.contribution;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.URL;
+
+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 org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class StoreTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution storeContribution;
+ private Contribution resourceContribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ //Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ URL javaContribURL = getContributionURL(cl, "ufservices/store.html");
+ resourceContribution = contributionService.contribute("http://import-export/export-resource", javaContribURL, false);
+ for (Composite deployable : resourceContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ URL storeContributionURL = getContributionURL(cl, "store.composite");
+
+ storeContribution =
+ contributionService.contribute("http://import-export/store", storeContributionURL, false);
+ for (Composite deployable : storeContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : storeContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/store");
+ contributionService.remove("http://import-export/export-resource");
+
+ // Stop Components from my composite
+ for (Composite deployable : storeContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+
+ /**
+ * Utility methods
+ */
+
+
+ private URL getContributionURL(ClassLoader cl, Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cl.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ private URL getContributionURL(ClassLoader cl, String uri) throws MalformedURLException {
+ URL url = cl.getResource(uri);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - uri.length());
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/pom.xml
new file mode 100644
index 0000000000..38e69bd152
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-wsdl</artifactId>
+ <name>Apache Tuscany SCA Contribution WSDL Import Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-wsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </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-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..4cdcc1fd0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-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 "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..3d43290380
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/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-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..74d22ed830
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..d46fe0b57c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/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://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <deployable composite="helloworld:helloworldws"/>
+ <import namespace="http://helloworld" location="http://import-export/export-wsdl"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..5008a2ea5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/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 uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java
new file mode 100644
index 0000000000..5c40606e50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.contribution;
+
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.URL;
+
+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 org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution wsdlContribution;
+ private Contribution consumerContribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ // File wsdlContribLocation = new File("../export-wsdl/target/classes");
+ // URL wsdlContribURL = wsdlContribLocation.toURL();
+ URL wsdlContribURL = getContributionURL(getClass().getClassLoader(), "helloworld.wsdl");
+ wsdlContribution = contributionService.contribute("http://import-export/export-wsdl", wsdlContribURL, false);
+ for (Composite deployable : wsdlContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // File helloWorldContribLocation = new File("./target/classes/");
+ // URL helloWorldContribURL = helloWorldContribLocation.toURL();
+ URL helloWorldContribURL = getContributionURL(HelloWorldService.class);
+ consumerContribution =
+ contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
+ for (Composite deployable : consumerContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : consumerContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ private URL getContributionURL(Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cls.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ private URL getContributionURL(ClassLoader cl, String flag) throws MalformedURLException {
+ URL url = cl.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length());
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ // System.out.println(url);
+ return url;
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/helloworld");
+ contributionService.remove("http://import-export/export-wsdl");
+
+ // Stop Components from my composite
+ for (Composite deployable : consumerContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-import-export/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/pom.xml
new file mode 100644
index 0000000000..070263ea32
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-import-export/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-export</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Contribution Import/Export Integration Tests</name>
+
+ <modules>
+ <module>export-composite</module>
+ <module>export-java</module>
+ <module>export-resource</module>
+ <module>export-wsdl</module>
+ <module>import-composite</module>
+ <module>import-java</module>
+ <module>import-resource</module>
+ <module>import-wsdl</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/pom.xml
new file mode 100644
index 0000000000..a87e983bb3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-multiple</artifactId>
+ <name>Apache Tuscany SCA Multiple Contribution Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/hello/Hello.java b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/hello/Hello.java
new file mode 100644
index 0000000000..7e574a7db3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/hello/Hello.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 hello;
+
+/**
+ * This is the business interface of the Hello service.
+ */
+public interface Hello {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/hello/HelloImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/hello/HelloImpl.java
new file mode 100644
index 0000000000..ff9f6e75f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/hello/HelloImpl.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 hello;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(Hello.class)
+public class HelloImpl implements Hello {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..c062afaed0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.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 hello.Hello;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+ @Reference
+ protected Hello helloServiceRef;
+
+ public String getGreetings(String name) {
+ return helloServiceRef.getGreetings(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..5251fc0a45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionCycleTestCaseFIXME.java b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionCycleTestCaseFIXME.java
new file mode 100644
index 0000000000..ec5123eb2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionCycleTestCaseFIXME.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 test;
+
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+import junit.framework.TestCase;
+
+/**
+ * Test multiple contributions scenario
+ *
+ * FIXME This test case causes a StackOverflowException instead of
+ * reporting an error when a composite is not found, as there's a
+ * dependency cycle in the test contributions and the model resolvers
+ * do not handle import cycles properly.
+ *
+ */
+public class ContributionCycleTestCaseFIXME extends TestCase {
+
+ private String helloContribution_dir = "target/test-classes/contribution-cycle-export";
+ private String helloWorldContribution_one_dir = "target/test-classes/contribution-cycle-import";
+
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloContribution;
+ private Contribution helloWorldContribution_one;
+
+ protected void setUp() throws Exception {
+ URL helloContribution_URL = new java.io.File(helloContribution_dir).toURI().toURL();
+ URL helloWorldContribution_one_URL = new java.io.File(helloWorldContribution_one_dir).toURI().toURL();
+
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ // Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ helloContribution =
+ contributionService.contribute("http://contribution-multiple/helloworld", helloContribution_URL, false);
+
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ helloWorldContribution_one =
+ contributionService.contribute("http://contribution-multiple/helloworld_one", helloWorldContribution_one_URL, false);
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService_one =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent_one/HelloWorldService");
+ assertNotNull(helloWorldService_one);
+
+ assertEquals("Hello Smith", helloWorldService_one.getGreetings("Smith"));
+
+ }
+
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://contribution-multiple/helloworld");
+ contributionService.remove("http://contribution-multiple/helloworld_one");
+
+ // Stop Components from my composite
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ // domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionMultipleTestCaseFIXME.java b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionMultipleTestCaseFIXME.java
new file mode 100644
index 0000000000..133c98f357
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionMultipleTestCaseFIXME.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package test;
+
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+import junit.framework.TestCase;
+
+/**
+ * Test multiple contribution scenario
+ * Contributed by TUSCANY-1718
+ */
+public class ContributionMultipleTestCaseFIXME extends TestCase {
+
+ private String helloContribution_dir = "target/test-classes/contribution-export";
+ private String helloWorldContribution_one_dir = "target/test-classes/contribution-import-one";
+ private String helloWorldContribution_two_dir = "target/test-classes/contribution-import-two";
+
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloContribution;
+ private Contribution helloWorldContribution_one;
+ private Contribution helloWorldContribution_two;
+
+ protected void setUp() throws Exception {
+ URL helloContribution_URL = new java.io.File(helloContribution_dir).toURI().toURL();
+ URL helloWorldContribution_one_URL = new java.io.File(helloWorldContribution_one_dir).toURI().toURL();
+ URL helloWorldContribution_two_URL = new java.io.File(helloWorldContribution_two_dir).toURI().toURL();
+
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ // Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ helloContribution =
+ contributionService.contribute("http://contribution-multiple/helloworld", helloContribution_URL, false);
+
+ helloWorldContribution_one =
+ contributionService.contribute("http://contribution-multiple/helloworld_one", helloWorldContribution_one_URL, false);
+
+ helloWorldContribution_two =
+ contributionService.contribute("http://contribution-multiple/helloworld_two", helloWorldContribution_two_URL, false);
+
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ }
+
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ }
+
+ for (Composite deployable : helloWorldContribution_two.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ }
+
+ domain.buildComposite(domain.getDomainComposite());
+ domain.getCompositeActivator().activate(domain.getDomainComposite());
+ domain.getCompositeActivator().start(domain.getDomainComposite());
+
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService_one =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent_one/HelloWorldService");
+ assertNotNull(helloWorldService_one);
+
+ assertEquals("Hello Smith", helloWorldService_one.getGreetings("Smith"));
+
+ HelloWorldService helloWorldService_two =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent_two/HelloWorldService");
+ assertNotNull(helloWorldService_two);
+
+ assertEquals("Hello Smith", helloWorldService_two.getGreetings("Smith"));
+
+ }
+
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://contribution-multiple/helloworld");
+ contributionService.remove("http://contribution-multiple/helloworld_one");
+ contributionService.remove("http://contribution-multiple/helloworld_two");
+
+ // Stop Components from my composite
+ for (Composite deployable : helloWorldContribution_two.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ // domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java
new file mode 100644
index 0000000000..790b6fed98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package test;
+
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+import junit.framework.TestCase;
+
+/**
+ * Test multiple contribution scenario
+ * Contributed by TUSCANY-1756
+ */
+public class ContributionTestCase extends TestCase {
+
+ private String helloContribution_dir = "target/test-classes/contribution-export";
+ //private String helloWorldContribution_one_dir = "target/test-classes/contribution-import-one";
+ private String helloWorldContribution_two_dir = "target/test-classes/contribution-import-two";
+
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloContribution;
+ //private Contribution helloWorldContribution_one;
+ private Contribution helloWorldContribution_two;
+
+ protected void setUp() throws Exception {
+ URL helloContribution_URL = new java.io.File(helloContribution_dir).toURI().toURL();
+ //URL helloWorldContribution_one_URL = new java.io.File(helloWorldContribution_one_dir).toURI().toURL();
+ URL helloWorldContribution_two_URL = new java.io.File(helloWorldContribution_two_dir).toURI().toURL();
+
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ // Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ helloContribution =
+ contributionService.contribute("http://contribution-multiple/helloworld", helloContribution_URL, false);
+
+ //helloWorldContribution_one =
+ // contributionService.contribute("http://contribution-multiple/helloworld_one", helloWorldContribution_one_URL, false);
+
+ helloWorldContribution_two =
+ contributionService.contribute("http://contribution-multiple/helloworld_two", helloWorldContribution_two_URL, false);
+
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ //for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ // domain.getDomainComposite().getIncludes().add(deployable);
+ // domain.buildComposite(deployable);
+ //}
+
+ for (Composite deployable : helloWorldContribution_two.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ //for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ // domain.getCompositeActivator().activate(deployable);
+ // domain.getCompositeActivator().start(deployable);
+ //}
+
+ for (Composite deployable : helloWorldContribution_two.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ }
+
+ public void testServiceCall() throws IOException {
+ //HelloWorldService helloWorldService_one =
+ //domain.getService(HelloWorldService.class, "HelloWorldServiceComponent_one/HelloWorldService");
+ //assertNotNull(helloWorldService_one);
+
+ //assertEquals("Hello Smith", helloWorldService_one.getGreetings("Smith"));
+
+ HelloWorldService helloWorldService_two =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent_two/HelloWorldService");
+ assertNotNull(helloWorldService_two);
+
+ assertEquals("Hello Smith", helloWorldService_two.getGreetings("Smith"));
+
+ }
+
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://contribution-multiple/helloworld");
+ //contributionService.remove("http://contribution-multiple/helloworld_one");
+ contributionService.remove("http://contribution-multiple/helloworld_two");
+
+ // Stop Components from my composite
+ for (Composite deployable : helloWorldContribution_two.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ //for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ // domain.getCompositeActivator().stop(deployable);
+ // domain.getCompositeActivator().deactivate(deployable);
+ //}
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ // domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-export/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-export/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8b76783c3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-export/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://hello"
+ xmlns:hello="http://hello">
+ <deployable composite="hello:hello"/>
+ <export namespace="http://hello"/>
+ <import namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-export/hello.composite b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-export/hello.composite
new file mode 100644
index 0000000000..aeeab337fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-export/hello.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello"
+ name="hello">
+
+ <service name="HelloService" promote="HelloServiceComponent"/>
+
+ <component name="HelloServiceComponent">
+ <implementation.java class="hello.HelloImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-import/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-import/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..bfbf74373a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-import/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://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello">
+ <deployable composite="helloworld:helloworld_one"/>
+ <import namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-import/helloworld_one.composite b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-import/helloworld_one.composite
new file mode 100644
index 0000000000..7a8003577e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-cycle-import/helloworld_one.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"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello"
+ name="helloworld_one">
+
+ <component name="SourceHelloServiceComponent_one">
+ <implementation.composite name="hello:helloexport"/>
+ </component>
+
+ <component name="HelloWorldServiceComponent_one">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <reference name="helloServiceRef" target="SourceHelloServiceComponent_one/HelloService"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..bea6f39932
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-export/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://hello"
+ xmlns:hello="http://hello">
+ <deployable composite="hello:hello"/>
+ <export namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite
new file mode 100644
index 0000000000..aeeab337fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello"
+ name="hello">
+
+ <service name="HelloService" promote="HelloServiceComponent"/>
+
+ <component name="HelloServiceComponent">
+ <implementation.java class="hello.HelloImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..bfbf74373a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-one/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://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello">
+ <deployable composite="helloworld:helloworld_one"/>
+ <import namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.composite b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.composite
new file mode 100644
index 0000000000..45cb504ea4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.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"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello"
+ name="helloworld_one">
+
+ <component name="SourceHelloServiceComponent_one">
+ <implementation.composite name="hello:hello"/>
+ </component>
+
+ <component name="HelloWorldServiceComponent_one">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <reference name="helloServiceRef" target="SourceHelloServiceComponent_one/HelloService"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-two/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-two/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..cbabdcd4fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-two/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://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello">
+ <deployable composite="helloworld:helloworld_two"/>
+ <import namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-two/helloworld_two.composite b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-two/helloworld_two.composite
new file mode 100644
index 0000000000..4c9225de34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution-multiple/src/test/resources/contribution-import-two/helloworld_two.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"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello"
+ name="helloworld_two">
+
+ <component name="SourceHelloServiceComponent_two">
+ <implementation.composite name="hello:hello"/>
+ </component>
+
+ <component name="HelloWorldServiceComponent_two">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <reference name="helloServiceRef" target="SourceHelloServiceComponent_two/HelloService"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution/pom.xml b/sca-java-1.x/branches/sca-android/itest/contribution/pom.xml
new file mode 100644
index 0000000000..1c219cbd6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution</artifactId>
+ <name>Apache Tuscany SCA Contribution Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..4e72f92fda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/AddService.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 calculator;
+
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in AddServiceImpl Class
+ */
+public interface AddService {
+
+ /**
+ * This is an add method which takes 2 parameters of double type and returns the sum of two parameters
+ */
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9c635e3c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..40ca4d9b0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..f288af0174
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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;
+
+/**
+ * This is a Calculator service interface. All the methods which are to be accessed as a service are declared in this
+ * interface but not the implementation of those methods.
+ */
+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-android/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..ae4ed12b7b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..ad99418f5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/DivideService.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 calculator;
+
+/**
+ * This is an interface for Divide Service which has divide method declared which is implemented in DivideServiceImpl
+ * class
+ */
+public interface DivideService {
+
+ /**
+ * This is a divide method which takes 2 parameters of double type and returns the result of division
+ */
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..8c33862f6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..3987b0a54f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/MultiplyService.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;
+
+/**
+ * This is an interface for Multiply Service which has multiply method declared which is implemented in
+ * MultiplyServiceImpl class
+ */
+public interface MultiplyService {
+
+ /**
+ * This is a multiply method which takes 2 parameters of double type and returns the result of multiplication of the
+ * two parameters
+ */
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..c7fbc73c00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..25e0ed6ca7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/SubtractService.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;
+
+/**
+ * This is an interface for Subtract Service which has subtract method declared which is implemented in
+ * SubtractServiceImpl class
+ */
+
+public interface SubtractService {
+
+ /**
+ * This is a subtract method which takes 2 parameters of double type and returns the result of subtraction.
+ */
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1a7f145ad8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/main/resources/ContributionTest.composite b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/resources/ContributionTest.composite
new file mode 100644
index 0000000000..d814e439e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/main/resources/calculator/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/resources/calculator/Calculator.composite
new file mode 100644
index 0000000000..657a2f95d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/main/resources/calculator/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/resources/calculator/sca-contribution.xml
new file mode 100644
index 0000000000..e95796d83a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution/src/main/resources/calculator/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java
new file mode 100644
index 0000000000..97b2e5d6ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.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.test.contribution;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * 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 ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private ContributionService contributionService;
+
+ /**
+ * setUp() is a method in JUnit Frame Work which is executed before all others methods in the class extending
+ * unit.framework.TestCase. So this method is used to create a test Embedded SCA Domain, to start the SCA Domain and
+ * to get a reference to the contribution service
+ */
+
+ @Override
+ protected void setUp() throws Exception {
+ //Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ //get a reference to the contribution service
+ contributionService = domain.getContributionService();
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contrututionId with the value retrieved from the SCA runtime.
+ */
+ public void testContributeJAR() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ //URL contributionLocation = new URL("file:/D:/dev/Opensource/Apache/Tuscany/source/java/sca/samples/calculator/target/sample-calculator.jar");
+ String contributionId = CONTRIBUTION_001_ID;
+ contributionService.contribute(contributionId, contributionLocation, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contrututionId with the value retrieved from the SCA runtime using
+ * contributionService.
+ */
+ public void testStoreContributionPackageInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ contributionService.contribute(contributionId, contributionLocation, 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());
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contrututionId with the value retrieved from the SCA runtime using
+ * contributionService.
+ */
+ public void testStoreContributionStreamInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+
+ InputStream contributionStream = contributionLocation.openStream();
+ try {
+ contributionService.contribute(contributionId, contributionLocation, contributionStream);
+ } 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());
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contributionId1,contributionId2 with the value retrieved from the SCA
+ * runtime using contributionService.
+ */
+ public void testStoreDuplicatedContributionInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId1 = CONTRIBUTION_001_ID;
+ contributionService.contribute(contributionId1, contributionLocation, true);
+ assertNotNull(contributionService.getContribution(contributionId1));
+ String contributionId2 = CONTRIBUTION_002_ID;
+ contributionService.contribute(contributionId2, contributionLocation, true);
+ assertNotNull(contributionService.getContribution(contributionId2));
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contributionId with the value retrieved from the SCA runtime using
+ * contributionService.
+ */
+ public void testContributeFolder() throws Exception {
+ final 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);
+
+ // Requires permission to read user.dir property. Requires PropertyPermision in security policy.
+ URL contributionFolderURL;
+ try {
+ contributionFolderURL = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
+ public URL run() throws IOException {
+ return rootContributionFolder.toURL();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (IOException)e.getException();
+ }
+ contributionService.contribute(contributionId, contributionFolderURL, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contributionId, artifactId with the value retrieved from the SCA runtime
+ * using contributionService.
+ */
+ public void testAddDeploymentComposites() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ Contribution contribution = contributionService.contribute(contributionId, contributionLocation, 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());
+
+ Artifact artifact = null;
+ contribution = contributionService.getContribution(contributionId);
+ String id = artifactId.toString();
+ for (Artifact 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-android/itest/contribution/src/test/resources/deployables/sample-calculator.jar b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/itest/contribution/src/test/resources/repository/sample-calculator.jar b/sca-java-1.x/branches/sca-android/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-android/itest/contribution/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/pom.xml b/sca-java-1.x/branches/sca-android/itest/conversations-ws/pom.xml
new file mode 100644
index 0000000000..87827c86dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-conversations-ws</artifactId>
+ <name>Apache Tuscany SCA Conversations Over binding.ws Integration Tests</name>
+
+ <dependencies>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.java
new file mode 100644
index 0000000000..9cd88620e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.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.itest.conversational;
+
+public class BusinessException extends Exception {
+
+ private String message;
+
+ public BusinessException() {
+ super();
+ }
+
+ public BusinessException(String message) {
+ super(message);
+ setMessage(message);
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java
new file mode 100644
index 0000000000..53dadc3dc7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+@Conversational
+public interface ConversationIdService {
+
+ String getCIDField();
+ String getCIDSetter();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
new file mode 100644
index 0000000000..cb7a032e85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing conversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ // public void init();
+
+ // public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws BusinessException;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
new file mode 100644
index 0000000000..2532346349
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromInjectedReference2();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public String runConversationCallingEndedConversationCheckConversationId();
+ public String runConversationCallingEndedConversationCallbackCheckConversationId();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
new file mode 100644
index 0000000000..8f008fa711
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java
new file mode 100644
index 0000000000..1e36ce6917
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.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.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ //public void businessException() throws BusinessException;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ //public void businessExceptionCallback() throws BusinessException;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java
new file mode 100644
index 0000000000..b4d3fe3d71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.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.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(NonConversationalCallback.class)
+public interface ConversationalServiceNonConversationalCallback {
+
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws BusinessException;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws BusinessException;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java
new file mode 100644
index 0000000000..ed3a01c10b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.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.itest.conversational;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing conversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface NonConversationalCallback {
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws BusinessException;
+
+ public String endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
new file mode 100644
index 0000000000..1603916cca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="1 seconds")
+public class ConversationAgeComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws BusinessException {
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
new file mode 100644
index 0000000000..accc1eee27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationIdService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationIdService.class)
+@Scope("CONVERSATION")
+public class ConversationIdComponentImpl implements ConversationIdService {
+
+ @ConversationID
+ public String cid;
+
+ private String setterCid;
+
+ public String getCIDField() {
+ return cid;
+ }
+ public String getCIDSetter() {
+ return setterCid;
+ }
+
+
+ @ConversationID
+ public void setCID(String cid) {
+ this.setterCid = cid;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
new file mode 100644
index 0000000000..90f6de86ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class ConversationMaxIdleComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws BusinessException {
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
new file mode 100644
index 0000000000..3f7a90b3dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
@@ -0,0 +1,322 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConversationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConversationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConversationId;
+ }
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+// conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+// conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
new file mode 100644
index 0000000000..ab91498132
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
@@ -0,0 +1,311 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulNonConversationalCallbackImpl implements ConversationalClient, NonConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+// conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+// conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
new file mode 100644
index 0000000000..e4f83656de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
@@ -0,0 +1,318 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ // now test the second reference
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConfersationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConfersationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConfersationId;
+ }
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+// conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+// conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
new file mode 100644
index 0000000000..8fe7c5b6ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java
new file mode 100644
index 0000000000..9f4857f703
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.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.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("REQUEST")
+public class ConversationalServiceRequestImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
new file mode 100644
index 0000000000..4b06251414
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws BusinessException {
+ calls.append("businessException,");
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java
new file mode 100644
index 0000000000..be039748fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalServiceNonConversationalCallback.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulNonConversationalCallbackImpl implements ConversationalServiceNonConversationalCallback {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected NonConversationalCallback nonConversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ nonConversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ nonConversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return nonConversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ nonConversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return nonConversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java
new file mode 100644
index 0000000000..42f2f1a603
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.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.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java
new file mode 100644
index 0000000000..a852aeda56
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.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.itest.conversational.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessScopeImpl implements ConversationalService {
+
+ @ConversationID
+ protected String cid;
+
+ static Map<String, Integer> state = new HashMap<String, Integer>();
+
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String endConversation() {
+ state.remove(cid);
+ return cid;
+ }
+
+ public String endConversationCallback() {
+ // TODO Auto-generated method stub
+ return null;
+
+ }
+
+ public void incrementCount() {
+ state.put(cid, Integer.valueOf(state.get(cid)+1));
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void incrementCountCallback() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void init() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void initializeCount(int count) {
+ state.put(cid, Integer.valueOf(count));
+ }
+
+ public void initializeCountCallback(int count) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public int retrieveCount() {
+ return state.get(cid);
+ }
+
+ public int retrieveCountCallback() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..d5a1ff7410
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/Conversational/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" xmlns:conv="http://conversations">
+ <deployable composite="conv:ConversationalITest" />
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/Conversational/conversational.composite b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/Conversational/conversational.composite
new file mode 100644
index 0000000000..c4da99145d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/Conversational/conversational.composite
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/ConversationalStatelessClientStatelessService"/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/ConversationalStatelessClientStatefulService"/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStateful">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/ConversationalStatefulClientStatelessService"/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful">
+ <binding.ws/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/ConversationalStatefulClientStatefulService"/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStateful">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatelessClientRequestService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceRequest">
+ <binding.ws/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/ConversationalStatelessClientRequestService"/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceRequest">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatefulClientNonConversationalCallbackStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl"/>
+ <reference name="conversationalService" target="ConversationalServiceStatefulNonConversationalCallback">
+ <binding.ws/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/ConversationalStatefulClientNonConversationalCallbackStatefulService"/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStatefulNonConversationalCallback">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ <service name="ConversationalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws uri="http://localhost:8085/ConversationalServiceStateful"/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessScopeImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStatelessSL">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl"/>
+ <service name="ConversationalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws uri="http://localhost:8085/ConversationalServiceStatelessSL"/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+ <component name="ConversationalServiceRequest">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl"/>
+ <service name="ConversationalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws uri="http://localhost:8085/ConversationalServiceRequest"/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+ <component name="ConversationalServiceStatefulNonConversationalCallback">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl"/>
+ <service name="ConversationalServiceNonConversationalCallback">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.NonConversationalCallback" />
+ <binding.ws uri="http://localhost:8085/ConversationalServiceStatefulNonConversationalCallback"/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl
new file mode 100644
index 0000000000..20a92c9dc7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl
@@ -0,0 +1,383 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://conversational.itest.sca.tuscany.apache.org"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns0="http://conversational.itest.sca.tuscany.apache.org"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:ns1="http://org.apache.axis2/xsd">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://conversational.itest.sca.tuscany.apache.org" xmlns:ns="http://conversational.itest.sca.tuscany.apache.org">
+ <xs:element name="retrieveCountResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ </xs:element>
+ <xs:element name="retrieveCountCallbackResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="endConversationResponse">
+
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="endConversationCallbackResponse">
+ <xs:complexType>
+ <xs:sequence>
+
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="initializeCount">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" type="xs:int"/>
+ </xs:sequence>
+
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="initializeCountCallback">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="retrieveCount"><xs:complexType/></xs:element><xs:element name="endConversation"><xs:complexType/></xs:element><xs:element name="endConversationCallback"><xs:complexType/></xs:element><xs:element name="incrementCountCallback"><xs:complexType/></xs:element><xs:element name="incrementCountCallbackResponse"><xs:complexType/></xs:element><xs:element name="incrementCount"><xs:complexType/></xs:element><xs:element name="incrementCountResponse"><xs:complexType/></xs:element><xs:element name="initializeCountCallbackResponse"><xs:complexType/></xs:element><xs:element name="initializeCountResponse"><xs:complexType/></xs:element><xs:element name="retrieveCountCallback"><xs:complexType/></xs:element></xs:schema>
+ </wsdl:types>
+ <wsdl:message name="initializeCountCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:initializeCountCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="retrieveCountCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:retrieveCountCallback">
+ </wsdl:part>
+
+ </wsdl:message>
+ <wsdl:message name="incrementCountRequest">
+ <wsdl:part name="parameters" element="ns0:incrementCount">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="incrementCountCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:incrementCountCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="retrieveCountCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:retrieveCountCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="retrieveCountResponse">
+ <wsdl:part name="parameters" element="ns0:retrieveCountResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="endConversationResponse">
+
+ <wsdl:part name="parameters" element="ns0:endConversationResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="endConversationCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:endConversationCallback">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="incrementCountCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:incrementCountCallback">
+
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="retrieveCountRequest">
+ <wsdl:part name="parameters" element="ns0:retrieveCount">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="initializeCountRequest">
+ <wsdl:part name="parameters" element="ns0:initializeCount">
+ </wsdl:part>
+
+ </wsdl:message>
+ <wsdl:message name="initializeCountResponse">
+ <wsdl:part name="parameters" element="ns0:initializeCountResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="endConversationCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:endConversationCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="endConversationRequest">
+ <wsdl:part name="parameters" element="ns0:endConversation">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="initializeCountCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:initializeCountCallback">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="incrementCountResponse">
+
+ <wsdl:part name="parameters" element="ns0:incrementCountResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="ConversationalServicePortType">
+ <wsdl:operation name="retrieveCount">
+ <wsdl:input message="ns0:retrieveCountRequest" wsaw:Action="urn:retrieveCount">
+ </wsdl:input>
+ <wsdl:output message="ns0:retrieveCountResponse" wsaw:Action="urn:retrieveCountResponse">
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="endConversation">
+ <wsdl:input message="ns0:endConversationRequest" wsaw:Action="urn:endConversation">
+ </wsdl:input>
+ <wsdl:output message="ns0:endConversationResponse" wsaw:Action="urn:endConversationResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="endConversationCallback">
+ <wsdl:input message="ns0:endConversationCallbackRequest" wsaw:Action="urn:endConversationCallback">
+
+ </wsdl:input>
+ <wsdl:output message="ns0:endConversationCallbackResponse" wsaw:Action="urn:endConversationCallbackResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="incrementCountCallback">
+ <wsdl:input message="ns0:incrementCountCallbackRequest" wsaw:Action="urn:incrementCountCallback">
+ </wsdl:input>
+ <wsdl:output message="ns0:incrementCountCallbackResponse" wsaw:Action="urn:incrementCountCallbackResponse">
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="incrementCount">
+ <wsdl:input message="ns0:incrementCountRequest" wsaw:Action="urn:incrementCount">
+ </wsdl:input>
+ <wsdl:output message="ns0:incrementCountResponse" wsaw:Action="urn:incrementCountResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCountCallback">
+ <wsdl:input message="ns0:initializeCountCallbackRequest" wsaw:Action="urn:initializeCountCallback">
+
+ </wsdl:input>
+ <wsdl:output message="ns0:initializeCountCallbackResponse" wsaw:Action="urn:initializeCountCallbackResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCount">
+ <wsdl:input message="ns0:initializeCountRequest" wsaw:Action="urn:initializeCount">
+ </wsdl:input>
+ <wsdl:output message="ns0:initializeCountResponse" wsaw:Action="urn:initializeCountResponse">
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="retrieveCountCallback">
+ <wsdl:input message="ns0:retrieveCountCallbackRequest" wsaw:Action="urn:retrieveCountCallback">
+ </wsdl:input>
+ <wsdl:output message="ns0:retrieveCountCallbackResponse" wsaw:Action="urn:retrieveCountCallbackResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="ConversationalServiceSOAP11Binding" type="ns0:ConversationalServicePortType">
+
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="retrieveCount">
+ <soap:operation soapAction="urn:retrieveCount" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="endConversation">
+ <soap:operation soapAction="urn:endConversation" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="endConversationCallback">
+ <soap:operation soapAction="urn:endConversationCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="incrementCountCallback">
+ <soap:operation soapAction="urn:incrementCountCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="incrementCount">
+ <soap:operation soapAction="urn:incrementCount" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="initializeCountCallback">
+ <soap:operation soapAction="urn:initializeCountCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="initializeCount">
+ <soap:operation soapAction="urn:initializeCount" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="retrieveCountCallback">
+ <soap:operation soapAction="urn:retrieveCountCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ConversationalServiceHttpBinding" type="ns0:ConversationalServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="retrieveCount">
+ <http:operation location="ConversationalService/retrieveCount"/>
+ <wsdl:input>
+ <mime:content part="retrieveCount" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="retrieveCount" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="endConversation">
+ <http:operation location="ConversationalService/endConversation"/>
+ <wsdl:input>
+ <mime:content part="endConversation" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="endConversation" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="endConversationCallback">
+ <http:operation location="ConversationalService/endConversationCallback"/>
+ <wsdl:input>
+ <mime:content part="endConversationCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="endConversationCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="incrementCountCallback">
+ <http:operation location="ConversationalService/incrementCountCallback"/>
+ <wsdl:input>
+ <mime:content part="incrementCountCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="incrementCountCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="incrementCount">
+ <http:operation location="ConversationalService/incrementCount"/>
+ <wsdl:input>
+ <mime:content part="incrementCount" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="incrementCount" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCountCallback">
+ <http:operation location="ConversationalService/initializeCountCallback"/>
+ <wsdl:input>
+ <mime:content part="initializeCountCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="initializeCountCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCount">
+ <http:operation location="ConversationalService/initializeCount"/>
+ <wsdl:input>
+ <mime:content part="initializeCount" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="initializeCount" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="retrieveCountCallback">
+ <http:operation location="ConversationalService/retrieveCountCallback"/>
+ <wsdl:input>
+ <mime:content part="retrieveCountCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="retrieveCountCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ConversationalService">
+ <wsdl:port name="ConversationalServiceSOAP11port_http" binding="ns0:ConversationalServiceSOAP11Binding">
+ <soap:address location="http://localhost:8085/ConversationalServiceStateful"/>
+ </wsdl:port>
+
+ <wsdl:port name="ConversationalServiceHttpport" binding="ns0:ConversationalServiceHttpBinding">
+ <http:address location="http://localhost:8085/ConversationalServiceStateful"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..73d078674c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/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" xmlns:conv="http://conversations">
+ <deployable composite="conv:ConversationalWSDLITest" />
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite
new file mode 100644
index 0000000000..9c6b0a2b34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationalWSDLITest">
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful">
+ <binding.ws wsdlElement="http://conversational.itest.sca.tuscany.apache.org#wsdl.port(ConversationalService/ConversationalServiceSOAP11port_http)"/>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStateful">
+ <binding.ws wsdlElement="http://conversational.itest.sca.tuscany.apache.org#wsdl.port(ConversationalService/ConversationalServiceSOAP11port_http)"/>
+ </reference>
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ <service name="ConversationalService">
+ <binding.ws wsdlElement="http://conversational.itest.sca.tuscany.apache.org#wsdl.port(ConversationalService/ConversationalServiceSOAP11port_http)"/>
+ </service>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java
new file mode 100644
index 0000000000..9df966ebc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+
+import java.io.File;
+
+
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationWSDLTestCase {
+
+ private SCANode node;
+ private ConversationalClient conversationalStatelessClientStatefulService;
+
+ @Before
+ public void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/ConversationalWSDL/conversationalWSDL.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/ConversationalWSDL").toURL().toString()));
+
+
+ node.start();
+
+ conversationalStatelessClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class, "ConversationalStatelessClientStatefulService");
+
+
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ node.stop();
+ conversationalStatelessClientStatefulService = null;
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testKeepServerRunning() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java
new file mode 100644
index 0000000000..ebd1e55dac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class NonConversationalCallbackTestCase {
+
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/Conversational/conversational.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/Conversational").toURL().toString()));
+
+
+ node.start();
+
+ conversationalStatelessClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateful client non conversational callback stateful service tests
+ // ==================================================================
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals("MyConversation3", id);
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java
new file mode 100644
index 0000000000..2c16145f54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+import java.io.File;
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RequestScopeTestCase {
+
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/Conversational/conversational.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/Conversational").toURL().toString()));
+
+
+ node.start();
+
+ conversationalStatelessClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client request scope service tests
+ // ============================================
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference2();
+ Assert.assertEquals(1, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromServiceReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientRequestService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientRequestService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceRequestImpl.calls = new StringBuffer();
+ conversationalStatelessClientRequestService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,",
+ ConversationalServiceRequestImpl.calls.toString());
+ //init,initializeCount,init,incrementCount,init,retrieveCount,init,endConversation,
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ int count = conversationalStatelessClientRequestService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessRequestConversationHavingPassedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessException() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java
new file mode 100644
index 0000000000..4166e6acdf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.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.itest.conversational;
+
+import java.io.File;
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatefulStatefulTestCase {
+
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/Conversational/conversational.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/Conversational").toURL().toString()));
+
+
+ node.start();
+
+ conversationalStatelessClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java
new file mode 100644
index 0000000000..6023b7cd53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.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.itest.conversational;
+
+import java.io.File;
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatefulStatelessTestCase {
+
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/Conversational/conversational.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/Conversational").toURL().toString()));
+
+
+ node.start();
+
+ conversationalStatelessClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java
new file mode 100644
index 0000000000..fb3a3cec6f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.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.itest.conversational;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatelessStatefulTestCase {
+
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/Conversational/conversational.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/Conversational").toURL().toString()));
+
+
+ node.start();
+
+ conversationalStatelessClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java
new file mode 100644
index 0000000000..5fbe2c3f69
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.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.itest.conversational;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatelessStatelessTestCase {
+
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/Conversational/conversational.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/Conversational").toURL().toString()));
+
+
+ node.start();
+
+ conversationalStatelessClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = ((SCAClient)node).getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+
+ // stateless client stateless service tests
+ // ========================================
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/pom.xml b/sca-java-1.x/branches/sca-android/itest/conversations/pom.xml
new file mode 100644
index 0000000000..68e771f2d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-conversations</artifactId>
+ <name>Apache Tuscany SCA Conversations Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/Record.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/Record.java
new file mode 100644
index 0000000000..a3b83dfc14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/Record.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;
+
+import java.io.Serializable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Record implements Serializable {
+ public String id;
+ public String conversationId;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/TestResult.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/TestResult.java
new file mode 100644
index 0000000000..8e98b9cbd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/TestResult.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+import java.util.Hashtable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestResult {
+ public static Hashtable<Object, Boolean> results = new Hashtable<Object, Boolean>();
+ private static int completed = 0;
+ public static synchronized void updateCompleted() {
+ ++completed;
+ }
+
+ public static synchronized int getCompleted() {
+ return completed;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.java
new file mode 100644
index 0000000000..e7583c339a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Conversational
+public interface AService {
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ String getState();
+
+ /**
+ * Returns the state for the other service that this service is using
+ *
+ * @return The state for the other service that this service is using
+ */
+ String getStateOnB();
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ void setState(String aState);
+
+ /**
+ * Sets the state for the other service that this service is using
+ *
+ * @param aState The state for the other service that this service is using
+ */
+ void setStateOnB(String aState);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Alpha.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Alpha.java
new file mode 100644
index 0000000000..bc4a5fc571
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Alpha.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.conversational;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@Remotable
+public interface Alpha {
+ @OneWay
+ void run(int param);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.java
new file mode 100644
index 0000000000..77d7f4c007
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple conversational Service
+ */
+@Conversational
+public interface BService {
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ String getState();
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ void setState(String aState);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Beta.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Beta.java
new file mode 100644
index 0000000000..e422938b27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Beta.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.itest.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@Remotable
+public interface Beta {
+ CallableReference<Gamma> getRef(int param);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java
new file mode 100644
index 0000000000..a6dbf56797
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Conversational
+public interface CService {
+
+ String getState();
+
+ void setState(String aState);
+
+ Object getConversationID();
+
+ Object getConversationObjectConversationId();
+
+ void setConversationID(String theID);
+
+ void endConversation();
+
+ void endConversationViaAnnotatedMethod();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.java
new file mode 100644
index 0000000000..3f04e9f09e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.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.conversational;
+
+public interface Constants {
+
+ String A_INITIAL_VALUE = "Initial Value of A";
+ String B_INITIAL_VALUE = "Initial Value of B";
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java
new file mode 100644
index 0000000000..53dadc3dc7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+@Conversational
+public interface ConversationIdService {
+
+ String getCIDField();
+ String getCIDSetter();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
new file mode 100644
index 0000000000..8cad88d2f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing conversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
new file mode 100644
index 0000000000..2532346349
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromInjectedReference2();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public String runConversationCallingEndedConversationCheckConversationId();
+ public String runConversationCallingEndedConversationCallbackCheckConversationId();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
new file mode 100644
index 0000000000..8f008fa711
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java
new file mode 100644
index 0000000000..546382cfd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java
new file mode 100644
index 0000000000..f1a21cc18f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(NonConversationalCallback.class)
+public interface ConversationalServiceNonConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java
new file mode 100644
index 0000000000..74afbfb763
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.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.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Simple conversational Service
+ */
+@Conversational
+public interface DService {
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ String getState();
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ void setState(String aState);
+
+ @EndsConversation
+ void endConversationViaAnnotatedMethod();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Gamma.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Gamma.java
new file mode 100644
index 0000000000..5f97b16088
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Gamma.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.itest.conversational;
+
+import org.apache.tuscany.sca.itest.Record;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@Remotable
+@Conversational
+public interface Gamma {
+ void start(int param);
+
+ boolean hasNext();
+
+ Record next();
+
+ @EndsConversation
+ void stop();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java
new file mode 100644
index 0000000000..3ce3e3ada7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.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.conversational;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing conversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface NonConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public String endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java
new file mode 100644
index 0000000000..95c9c7ae6e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.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.itest.conversational.impl;
+
+import java.lang.reflect.Proxy;
+import org.apache.tuscany.sca.core.invocation.JDKInvocationHandler;
+
+import org.apache.tuscany.sca.itest.conversational.AService;
+import org.apache.tuscany.sca.itest.conversational.BService;
+import org.apache.tuscany.sca.itest.conversational.Constants;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService {
+
+ /**
+ * The state
+ */
+ private String state = Constants.A_INITIAL_VALUE;
+
+ /**
+ * The reference to the other service
+ */
+ private BService b;
+
+ /**
+ * Constructor
+ *
+ */
+ public AServiceImpl() {
+ System.out.println("---> AServiceImpl constructor for " + this);
+ }
+
+ /**
+ * Inject the reference to the other service
+ * @param aB The other service.
+ */
+ @Reference(name="b")
+ public void setB(BService aB) {
+ System.out.println("---> Setting reference to B on " + this + " to " + aB);
+ this.b = aB;
+ }
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Returns the state for the other service that this service is using
+ *
+ * @return The state for the other service that this service is using
+ */
+ public String getStateOnB() {
+ return b.getState();
+ }
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ public void setState(String aState) {
+ this.state = aState;
+ }
+
+ /**
+ * Sets the state for the other service that this service is using
+ *
+ * @param aState The state for the other service that this service is using
+ */
+ public void setStateOnB(String aState) {
+ b.setState(aState);
+ }
+
+ /**
+ * Sets the conversation ID for this service
+ * @param id The Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(String id) {
+ System.out.println("Conversation ID for " + this + " is set to " + id);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AlphaImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AlphaImpl.java
new file mode 100644
index 0000000000..a5f37f7a52
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AlphaImpl.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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.Record;
+import org.apache.tuscany.sca.itest.TestResult;
+import org.apache.tuscany.sca.itest.conversational.Alpha;
+import org.apache.tuscany.sca.itest.conversational.Beta;
+import org.apache.tuscany.sca.itest.conversational.Gamma;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@Service(Alpha.class)
+@Scope("COMPOSITE")
+public class AlphaImpl implements Alpha {
+ @Reference
+ public Beta beta;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ public void run(int param) {
+ CallableReference<Gamma> gammaRef = null;
+ boolean testPassed = true;
+ try {
+ gammaRef = beta.getRef(param);
+ while (gammaRef.getService().hasNext()) {
+ Record record = gammaRef.getService().next();
+ if (!record.conversationId.equals(gammaRef.getConversation().getConversationID())) {
+ // Record returned is not from this conversation.
+ testPassed = false;
+ }
+ }
+ } catch (Exception ex) {
+ testPassed = false;
+ ex.printStackTrace();
+ } finally {
+ TestResult.updateCompleted();
+ if (gammaRef != null) {
+ TestResult.results.put(gammaRef.getConversation()
+ .getConversationID(), testPassed);
+ gammaRef.getService().stop();
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java
new file mode 100644
index 0000000000..c1e27641ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.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.itest.conversational.impl;
+
+
+import org.apache.tuscany.sca.itest.conversational.BService;
+import org.apache.tuscany.sca.itest.conversational.Constants;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service
+ */
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService {
+
+ /**
+ * The state for this service
+ */
+ private String state = Constants.B_INITIAL_VALUE;
+
+ /**
+ * Constructor
+ */
+ public BServiceImpl() {
+ System.out.println("---> BServiceImpl constructor for " + this);
+ }
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ public void setState(String aState) {
+ this.state = aState;
+ }
+
+ /**
+ * Sets the conversation ID for this service
+ * @param id The Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(String id) {
+ System.out.println("Conversation ID for " + this + " is set to " + id);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BetaImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BetaImpl.java
new file mode 100644
index 0000000000..900b8f743f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BetaImpl.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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.Beta;
+import org.apache.tuscany.sca.itest.conversational.Gamma;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@Service(Beta.class)
+@Scope("COMPOSITE")
+public class BetaImpl implements Beta {
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ public Gamma gamma;
+
+ public CallableReference<Gamma> getRef(int param) {
+ ServiceReference<Gamma> gammaRef = componentContext
+ .getServiceReference(Gamma.class, "gamma");
+ Gamma g = gammaRef.getService();
+ g.start(param);
+ return gammaRef;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java
new file mode 100644
index 0000000000..b21f956bd9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.CService;
+import org.apache.tuscany.sca.itest.conversational.DService;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Service(CService.class)
+@Scope("CONVERSATION")
+public class CServiceImpl implements CService {
+
+ private ServiceReference<DService> dServiceRef;
+
+ @Reference(name = "d")
+ public void setD(ServiceReference<DService> servRef) {
+ this.dServiceRef = servRef;
+ }
+
+ public String getState() {
+ return dServiceRef.getService().getState();
+ }
+
+ public void setState(String aState) {
+ dServiceRef.getService().setState(aState);
+ }
+
+
+ /*
+ * When the coversationId is set manually the client may access the
+ * conversation id that will be used by the reference using
+ * ServiceReference.getConversationId()
+ */
+ public Object getConversationID() {
+ return dServiceRef.getConversationID();
+ }
+
+ /*
+ * Whether the conversation ID is chosen by the client or is generated by
+ * the system, the client may access the conversation ID by calling
+ * Conversation.getConversationID().
+ */
+ public Object getConversationObjectConversationId() {
+ // TODO Auto-generated method stub
+ if (dServiceRef.getConversation() != null){
+ return dServiceRef.getConversation().getConversationID();
+ } else {
+ return null;
+ }
+ }
+
+ public void endConversation() {
+ dServiceRef.getConversation().end();
+ }
+
+ public void endConversationViaAnnotatedMethod() {
+ dServiceRef.getService().endConversationViaAnnotatedMethod();
+ }
+
+ public void setConversationID(String theID) {
+ dServiceRef.setConversationID(theID);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
new file mode 100644
index 0000000000..9deef312ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="1 seconds")
+public class ConversationAgeComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws Exception {
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
new file mode 100644
index 0000000000..cffa76186a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationIdService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationIdService.class)
+@Scope("CONVERSATION")
+public class ConversationIdComponentImpl implements ConversationIdService {
+
+ @ConversationID
+ public String cid;
+
+ private String setterCid;
+
+ public String getCIDField() {
+ return cid;
+ }
+ public String getCIDSetter() {
+ return setterCid;
+ }
+
+
+ @ConversationID
+ public void setCID(String cid) {
+ this.setterCid = cid;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
new file mode 100644
index 0000000000..1272c7ab7f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class ConversationMaxIdleComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws Exception {
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
new file mode 100644
index 0000000000..847b038881
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
@@ -0,0 +1,321 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConversationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConversationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConversationId;
+ }
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
new file mode 100644
index 0000000000..b77e4c0194
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulNonConversationalCallbackImpl implements ConversationalClient, NonConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
new file mode 100644
index 0000000000..5b3906fc2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
@@ -0,0 +1,317 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ // now test the second reference
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConfersationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConfersationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConfersationId;
+ }
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
new file mode 100644
index 0000000000..8fe7c5b6ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java
new file mode 100644
index 0000000000..9a25f0f59a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.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.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("REQUEST")
+public class ConversationalServiceRequestImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
new file mode 100644
index 0000000000..efcbdff06f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java
new file mode 100644
index 0000000000..8454b3846b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalServiceNonConversationalCallback.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulNonConversationalCallbackImpl implements ConversationalServiceNonConversationalCallback {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected NonConversationalCallback nonConversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ nonConversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ nonConversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return nonConversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ nonConversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return nonConversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java
new file mode 100644
index 0000000000..07186c91e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.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.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("STATELESS")
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java
new file mode 100644
index 0000000000..344aa99dff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessScopeImpl implements ConversationalService {
+
+ @ConversationID
+ protected String cid;
+
+ static Map<String, Integer> state = new HashMap<String, Integer>();
+
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String endConversation() {
+ state.remove(cid);
+ return cid;
+ }
+
+ public String endConversationCallback() {
+ // TODO Auto-generated method stub
+ return null;
+
+ }
+
+ public void incrementCount() {
+ state.put(cid, Integer.valueOf(state.get(cid)+1));
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void incrementCountCallback() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void init() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void initializeCount(int count) {
+ state.put(cid, Integer.valueOf(count));
+ }
+
+ public void initializeCountCallback(int count) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public int retrieveCount() {
+ return state.get(cid);
+ }
+
+ public int retrieveCountCallback() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java
new file mode 100644
index 0000000000..8d79bb75e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.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.itest.conversational.impl;
+
+
+import org.apache.tuscany.sca.itest.conversational.Constants;
+import org.apache.tuscany.sca.itest.conversational.DService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service
+ */
+@Service(DService.class)
+@Scope("CONVERSATION")
+public class DServiceImpl implements DService {
+
+ /**
+ * The state for this service
+ */
+ private String state = "Initial state value";
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ public void setState(String aState) {
+ this.state = aState;
+ }
+
+ /**
+ * Sets the conversation ID for this service
+ * @param id The Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(String id) {
+ System.out.println ("Setting conversation ID at service = " + id );
+ }
+
+ public void endConversationViaAnnotatedMethod() {
+ System.out.println ("Annotated Ends Conversation");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/GammaImpl.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/GammaImpl.java
new file mode 100644
index 0000000000..d1b769216b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/GammaImpl.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.itest.conversational.impl;
+
+import java.util.ArrayList;
+
+import org.apache.tuscany.sca.itest.Record;
+import org.apache.tuscany.sca.itest.conversational.Gamma;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@Service(Gamma.class)
+@Scope("CONVERSATION")
+public class GammaImpl implements Gamma {
+ @ConversationID
+ public String conversationId;
+
+ private ArrayList<Record> list;
+
+ public void start(int param) {
+ list = new ArrayList<Record>();
+ fillList(param, conversationId);
+ }
+
+ public boolean hasNext() {
+ return !list.isEmpty();
+ }
+
+ public Record next() {
+ return list.remove(0);
+ }
+
+ public void stop() {
+ list = null;
+ }
+
+ private void fillList(int param, String cid) {
+ for (int i = 0; i < param; i++) {
+ Record record = new Record();
+ record.id = "id_" + i;
+ record.conversationId = cid;
+ list.add(record);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/ConversationAge.composite b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/ConversationAge.composite
new file mode 100644
index 0000000000..abd1c35ced
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/ConversationAge.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ConversationalIdTest">
+
+ <component name="ConversationAgeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationAgeComponentImpl"/>
+ </component>
+
+ <component name="ConversationIdleComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationMaxIdleComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/ConversationUniqueId.composite b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/ConversationUniqueId.composite
new file mode 100644
index 0000000000..831449a079
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/ConversationUniqueId.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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationUniqueIdTest">
+
+ <component name="Alpha">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.AlphaImpl"/>
+ <service name="Alpha">
+ <binding.sca />
+ </service>
+ <reference name="beta" target="Beta">
+ <binding.sca/>
+ </reference>
+ </component>
+
+ <component name="Beta">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.BetaImpl"/>
+ <service name="Beta">
+ <binding.sca />
+ </service>
+ <reference name="gamma" target="Gamma">
+ <binding.sca />
+ </reference>
+ </component>
+
+ <component name="Gamma">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.GammaImpl"/>
+ <service name="Gamma">
+ <binding.sca/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversationId.composite b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversationId.composite
new file mode 100644
index 0000000000..e61eb08194
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversationId.composite
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ConversationalIdTest">
+
+ <component name="ConversationIdComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationIdComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversationLifetime.composite b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversationLifetime.composite
new file mode 100644
index 0000000000..3b79dc43d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversationLifetime.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://conversations"
+ name="conversationLifetimeTest">
+
+ <component name="ConversationalCComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.CServiceImpl"/>
+ <reference name="d" target="ConversationalDComponent" />
+ </component>
+
+ <component name="ConversationalDComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.DServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversational.composite b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversational.composite
new file mode 100644
index 0000000000..4da3ce74d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/main/resources/conversational.composite
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ <reference name="conversationalService2" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ <reference name="conversationalService2" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalStatelessClientRequestService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceRequest"/>
+ <reference name="conversationalService2" target="ConversationalServiceRequest"/>
+ </component>
+
+ <component name="ConversationalStatefulClientNonConversationalCallbackStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatefulNonConversationalCallback"/>
+ <reference name="conversationalService2" target="ConversationalServiceStatefulNonConversationalCallback"/>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessScopeImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStatelessSL">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl"/>
+ </component>
+
+ <component name="ConversationalServiceRequest">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStatefulNonConversationalCallback">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl"/>
+ </component>
+
+ <component name="ConversationalAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.AServiceImpl"/>
+ <reference name="b" target="ConversationalBComponent" />
+ </component>
+
+ <component name="ConversationalBComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.BServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java
new file mode 100644
index 0000000000..3e750bdd1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.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.itest.conversational;
+
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationIdTestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversationId.composite");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testConversationId() {
+ ConversationIdService service =
+ domain.getService(ConversationIdService.class, "ConversationIdComponent");
+ Assert.assertNotNull(service.getCIDField());
+ Assert.assertNotNull(service.getCIDSetter());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java
new file mode 100644
index 0000000000..326a833a42
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.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.sca.itest.conversational;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationLifetimeTestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversationLifetime.composite");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ /**
+ * Following a clarification re. the wording of the Java Common Annotations and APIs 1.00 Specification
+ * (see TUSCANY-2055) the following is accepted to be the intended operation
+ *
+ * Whether the conversation ID is chosen by the user or is generated by the system, the client
+ * may access the conversation ID by calling getConversationID() on the current conversation object.
+ *
+ * ServiceReference.getConversationID() - Returns the id supplied by the user that will be associated with
+ * future conversations initiated through this reference, or null if no ID has been set by the user.
+ *
+ * ServiceReference.setConversationID(Object conversationId) - Set an ID, supplied by the user, to associate with any future conversation
+ * started through this reference. If the value supplied is null then the id will be generated
+ * by the implementation. Throws an IllegalStateException if a conversation is currently
+ * associated with this reference.
+ *
+ */
+
+ /**
+ * Verify that ServiceReference.getConversationID() returns null before a conversation
+ * ID has been set manually.
+ */
+ @Test
+ public void getConversationID() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ Assert.assertNull(service.getConversationID());
+ }
+
+ /**
+ * Verify that ServiceReference.getConversationID() returns any value previous set through the
+ * setConversationID() API.
+ */
+ @Test
+ public void getConversationID2() {
+ String userProvidedID = "A conversation ID";
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.setConversationID(userProvidedID);
+ service.getState();
+ Assert.assertEquals(service.getConversationID(), userProvidedID);
+ }
+
+ /**
+ * Whether the conversation ID is chosen by the user or is generated by the system, the client
+ * may access the conversation ID by calling getConversationID() on the current conversation object.
+ * Here test the manually set conversationID
+ */
+ @Test
+ public void getConversationID3() {
+ String userProvidedID = "A conversation ID";
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.setConversationID(userProvidedID);
+ service.getState();
+ Assert.assertEquals(service.getConversationObjectConversationId(), userProvidedID);
+ }
+
+ /**
+ * Whether the conversation ID is chosen by the user or is generated by the system, the client
+ * may access the conversation ID by calling getConversationID() on the current conversation object.
+ * Here test the auto generated conversationId
+ */
+ @Test
+ public void getConversationID4() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ Assert.assertNotNull(service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Specification line 494-495 Verify:
+ * If a method is invoked on a service reference after an
+ * "@EndsConversation" method has been called then a new conversation will
+ * automatically be started.
+ */
+ @Test
+ public void implicitStartNewConversationAfterEnd() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ Object firstID = service.getConversationObjectConversationId();
+ service.endConversationViaAnnotatedMethod();
+ service.getState();
+ Assert.assertNotSame(firstID, service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Specification line 495-495 Verify: If a
+ * method is invoked on a service reference after an "@EndsConversation"
+ * method has been called then a new conversation will automatically be
+ * started. Note: Uses Conversation.end() rather than "@EndsConversation"
+ */
+ @Test
+ public void implicitStartNewConversationAfterEnd2() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ Object firstID = service.getConversationObjectConversationId();
+ service.endConversation();
+ service.getState();
+ Assert.assertNotSame(firstID, service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Specification line 495-497 Verify:
+ * If ServiceReference.getConversationID() is called after the
+ * "@EndsConversation" method is called, but before the next conversation
+ * has been started, it will return null.
+ */
+ @Test
+ public void nullConversationIDAfterEndConversation() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ service.endConversationViaAnnotatedMethod();
+ Assert.assertNull(service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Specification line 495-497 Verify:
+ * If ServiceReference.getConversationID() is called after the
+ * "@EndsConversation" method is called, but before the next conversation
+ * has been started, it will return null. Note: Uses explicit set of Conversation ID
+ */
+ @Test
+ public void nullConversationIDAfterEndConversation1a() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.setConversationID("User provided ID");
+ service.getState();
+ service.endConversationViaAnnotatedMethod();
+ Assert.assertNull(service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Specification line 495-497 Verify: If
+ * ServiceReference.getConversationID() is called after the
+ * "@EndsConversationmethod" is called, but before the next conversation has
+ * been started, it will return null. Note: Uses Conversation.end() rather
+ * than "@EndsConversation"
+ */
+ @Test
+ public void nullConversationIDAfterEndConversation2() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ service.endConversation();
+ Assert.assertNull(service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Specification line 495-497 Verify: If
+ * ServiceReference.getConversationID() is called after the
+ * "@EndsConversationmethod" is called, but before the next conversation has
+ * been started, it will return null. Note: Uses Conversation.end() rather
+ * than "@EndsConversation". Note 2: Uses explicit set of Conversation ID
+ */
+ @Test
+ public void nullConversationIDAfterEndConversation2a() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.setConversationID("User provided ID");
+ service.getState();
+ service.endConversation();
+ Assert.assertNull(service.getConversationObjectConversationId());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationUniqueIdTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationUniqueIdTestCase.java
new file mode 100644
index 0000000000..431962221a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationUniqueIdTestCase.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.itest.conversational;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.TestResult;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationUniqueIdTestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("ConversationUniqueId.composite");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testConversationUniqueId() {
+ Alpha alpha = domain.getService(Alpha.class, "Alpha");
+ int numConversations = 3;
+
+ for(int i = 0; i < numConversations; ++i) {
+ alpha.run(5);
+ }
+
+ // Wait for the conversations to complete
+ while (TestResult.getCompleted() < numConversations) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ Assert.assertEquals(TestResult.results.size(), numConversations);
+ for(Boolean value : TestResult.results.values()) {
+ Assert.assertTrue(value);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java
new file mode 100644
index 0000000000..cc31c77873
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.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.itest.conversational;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.ConversationEndedException;
+
+public class ConversationalAgeTestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval", "2");
+ domain = SCADomain.newInstance("ConversationAge.composite");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ System.clearProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval");
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testMaxAge() throws InterruptedException {
+
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationAgeComponent");
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ conversationalService.initializeCount(42);
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Thread.sleep(500);
+ try {
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ } catch (ConversationEndedException e) {
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAgeExpired() throws InterruptedException {
+
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationAgeComponent");
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ conversationalService.initializeCount(42);
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Thread.sleep(1100);
+ try {
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ Assert.fail();
+ } catch (ConversationEndedException e) {
+ // expected
+ }
+ }
+
+ @Test
+ public void testMaxIdle() throws InterruptedException {
+
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationIdleComponent");
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ conversationalService.initializeCount(42);
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Thread.sleep(1100);
+ try {
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ } catch (ConversationEndedException e) {
+ // expected
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java
new file mode 100644
index 0000000000..8480e04028
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationalJ2SETestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testStatefulConversation() {
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationalServiceStateful");
+
+ conversationalService.initializeCount(1);
+ Assert.assertEquals(1, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(2, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+
+ conversationalService.initializeCount(4);
+ Assert.assertEquals(4, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(5, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ }
+
+ @Test
+ public void testStatelessConversation() {
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationalServiceStateless");
+
+ conversationalService.initializeCount(1);
+ Assert.assertEquals(1, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(2, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ conversationalService.initializeCount(4);
+ Assert.assertEquals(4, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(5, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java
new file mode 100644
index 0000000000..da359bc296
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java
@@ -0,0 +1,649 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.conversational;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ConversationalTestCase {
+
+ private static SCADomain domain;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ domain.close();
+ }
+
+ private void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client stateless service tests
+ // ========================================
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client request scope service tests
+ // ============================================
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference2();
+ Assert.assertEquals(1, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromServiceReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientRequestService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientRequestService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceRequestImpl.calls = new StringBuffer();
+ conversationalStatelessClientRequestService.runConversationCheckingScope();
+ Assert.assertEquals("initializeCount,incrementCount,retrieveCount,endConversation,",
+ ConversationalServiceRequestImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ int count = conversationalStatelessClientRequestService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessRequestConversationHavingPassedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationBusinessException() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client non conversational callback stateful service tests
+ // ==================================================================
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals("MyConversation3", id);
+ }
+
+ private static final String NEW_A_VALUE = "First Instance - TestCode Set state on A";
+ private static final String NEW_B_VALUE = "First Instance - TestCode Set state on B";
+ private static final String SECOND_NEW_A_VALUE = "Second Instance - TestCode Set state on A";
+ private static final String SECOND_NEW_B_VALUE = "Second Instance - TestCode Set state on B";
+
+ @Test
+ public void testMultipleConversations() {
+ //////////
+ // Tests on first instance
+ //////////
+ System.out.println("========= First instance tests =========");
+ AService aService = domain.getService(AService.class, "ConversationalAComponent");
+
+ // Make sure initial values are correct
+ Assert.assertEquals(Constants.A_INITIAL_VALUE, aService.getState());
+ Assert.assertEquals(Constants.B_INITIAL_VALUE, aService.getStateOnB());
+
+ // Set some new values
+ aService.setState(NEW_A_VALUE);
+ aService.setStateOnB(NEW_B_VALUE);
+
+ // Verify the set worked
+ Assert.assertEquals(NEW_A_VALUE, aService.getState());
+ Assert.assertEquals(NEW_B_VALUE, aService.getStateOnB());
+
+
+ //////////
+ // Tests on second instance
+ //////////
+ System.out.println("========= Second instance tests =========");
+
+ // Do another look up
+ AService aService2 = domain.getService(AService.class, "ConversationalAComponent");
+
+ // Make sure initial values are correct on the second instance
+ Assert.assertEquals(Constants.A_INITIAL_VALUE, aService2.getState());
+ Assert.assertEquals(Constants.B_INITIAL_VALUE, aService2.getStateOnB());
+
+ // Set some new values on the second instance
+ aService2.setState(SECOND_NEW_A_VALUE);
+ aService2.setStateOnB(SECOND_NEW_B_VALUE);
+
+ // Verify the set worked on the second instance
+ Assert.assertEquals(SECOND_NEW_A_VALUE, aService2.getState());
+ Assert.assertEquals(SECOND_NEW_B_VALUE, aService2.getStateOnB());
+
+ // Verify the values have not been changed on the first instance
+ Assert.assertEquals(NEW_A_VALUE, aService.getState());
+ Assert.assertEquals(NEW_B_VALUE, aService.getStateOnB());
+
+ System.out.println("========= Done instance tests =========");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/pom.xml b/sca-java-1.x/branches/sca-android/itest/corba/pom.xml
new file mode 100644
index 0000000000..9670e8059f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/pom.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-corba-binding</artifactId>
+ <name>Apache Tuscany SCA CORBA Binding Integration Tests</name>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-corba-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba-jse</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba-jse-tns</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-corba</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+<!--
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</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-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.1.1</version>
+ <executions>
+ <execution>
+ <id>generate-scenariofour-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>
+ ${basedir}/src/test/resources/scenariofour.xsd
+ </schemaFile>
+ <javaPackage>
+ org.apache.tuscany.sca.test.corba.scenariofour
+ </javaPackage>
+ <prefix>ScenarioFour</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-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFiveTestCase.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFiveTestCase.java
new file mode 100644
index 0000000000..46e214eac3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFiveTestCase.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.corba;
+
+import static org.junit.Assert.fail;
+
+import org.apache.tuscany.sca.host.corba.jse.tns.TnsDefaultCorbaHost;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.corba.types.ScenarioFive;
+import org.apache.tuscany.sca.test.corba.types.ScenarioFiveComponent;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ * Tests usage of TNS JSE Corba host
+ */
+public class ScenarioFiveTestCase {
+
+ @Test
+ public void test_providedNameServer() {
+ TestCorbaHost.setCorbaHost(new TnsDefaultCorbaHost());
+ try {
+ // just make sure we can obtain and use the reference with success
+ SCADomain domain = SCADomain.newInstance("ScenarioFive.composite");
+ ScenarioFive scenarioFive =
+ domain.getService(ScenarioFiveComponent.class, "ScenarioFive").getScenarioFive();
+ scenarioFive.doNothing();
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.java
new file mode 100644
index 0000000000..cba8c823e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.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.test.corba;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.corba.jse.DefaultCorbaHost;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.corba.scenariofour.ScenarioFourFactory;
+import org.apache.tuscany.sca.test.corba.scenariofour.ScenarioFourSdo;
+import org.apache.tuscany.sca.test.corba.types.ScenarioFour;
+import org.apache.tuscany.sca.test.corba.types.ScenarioFourComponent;
+import org.apache.tuscany.sca.test.corba.types.ScenarioFourException;
+import org.apache.tuscany.sca.test.corba.types.ScenarioFourStruct;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ * Tests SCA default binding over CORBA binding
+ */
+public class ScenarioFourTestCase {
+
+ // note that those values are also used in resources/*.composite file
+ private static SCADomain domain;
+ private static ScenarioFourComponent scenarioFourComponent;
+ private static ScenarioFour scenarioFour;
+ private static TransientNameServer server;
+ private static final int ORB_INITIAL_PORT = 5080;
+
+ /**
+ * Initial configuration
+ */
+ @BeforeClass
+ public static void setUp() {
+ TestCorbaHost.setCorbaHost(new DefaultCorbaHost());
+ try {
+ server = new TransientNameServer("localhost", ORB_INITIAL_PORT, TransientNameService.DEFAULT_SERVICE_NAME);
+ Thread t = server.start();
+ if (t == null) {
+ Assert.fail("The naming server cannot be started");
+ }
+ // obtain domain
+ domain = SCADomain.newInstance("ScenarioFour.composite");
+ scenarioFourComponent = domain.getService(ScenarioFourComponent.class, "ScenarioFour");
+ scenarioFour = scenarioFourComponent.getScenarioFour();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Test cleanup
+ */
+ @AfterClass
+ public static void tearDown() {
+ server.stop();
+ }
+
+ /**
+ * General tests for passing JAXB objects
+ */
+ @Test
+ public void test_generalJAXB() {
+ try {
+ ScenarioFourStruct input = new ScenarioFourStruct();
+ input.field1 = "Test";
+ input.field2 = 1;
+ input.field3 = new double[1];
+ ScenarioFourStruct output = scenarioFour.setStruct(input);
+ assertTrue(input.equals(output));
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Test for JAXB exceptions
+ */
+ @Test
+ public void test_exceptionsJAXB() {
+ try {
+ scenarioFour.exceptionTest();
+ fail();
+ } catch (ScenarioFourException e) {
+ assertTrue(ScenarioFourException.DEFAULT_CONTENT.equals(e.getContent()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * General test for passing SDO objects
+ */
+ @Test
+ public void test_generalSDO() {
+ try {
+ ScenarioFourSdo scenarioFourSdo = ScenarioFourFactory.INSTANCE.createScenarioFourSdo();
+ scenarioFourSdo.setMessage("Test1");
+ scenarioFourSdo.setSymbol("Test2");
+ ScenarioFourSdo result = scenarioFour.passScenarioFourStruct(scenarioFourSdo);
+ assertTrue(scenarioFourSdo.getMessage().equals(result.getMessage()) && scenarioFourSdo.getSymbol()
+ .equals(result.getSymbol()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests reusing local name server with multiple bindings
+ */
+ @Test
+ public void test_nameServerReuse() {
+ try {
+ ScenarioFour scenarioFour =
+ domain.getService(ScenarioFourComponent.class, "ScenarioFourReuse").getScenarioFour();
+ ScenarioFourStruct struct = new ScenarioFourStruct();
+ scenarioFour.setStruct(struct);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioOneTestCase.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioOneTestCase.java
new file mode 100644
index 0000000000..0135c04495
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioOneTestCase.java
@@ -0,0 +1,371 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.corba;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.corba.jse.DefaultCorbaHost;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.corba.generated.Color;
+import org.apache.tuscany.sca.test.corba.generated.InnerStruct;
+import org.apache.tuscany.sca.test.corba.generated.RichStruct;
+import org.apache.tuscany.sca.test.corba.generated.ScenarioOne;
+import org.apache.tuscany.sca.test.corba.generated.ScenarioOneHelper;
+import org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations;
+import org.apache.tuscany.sca.test.corba.generated.UnexpectedException;
+import org.apache.tuscany.sca.test.corba.generated.WrongColor;
+import org.apache.tuscany.sca.test.corba.types.ScenarioOneServant;
+import org.apache.tuscany.sca.test.corba.types.TColor;
+import org.apache.tuscany.sca.test.corba.types.TInnerStruct;
+import org.apache.tuscany.sca.test.corba.types.TRichStruct;
+import org.apache.tuscany.sca.test.corba.types.TScenarioOne;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.omg.CORBA.ORB;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextHelper;
+
+/**
+ * @version $Rev$ $Date$
+ * This test class contains three main tests:<br>
+ * 1. Tuscany is being used as a consumer of some non-Tuscany CORBA service<br>
+ * 2. Tuscany is being used as a service provider, which will be consumed by
+ * non-Tuscany CORBA client<br>
+ * 3. Tuscany is being used as a service provider, which will be consumed by
+ * Tuscany client<br>
+ * But that's not all, there are some other variations. Tuscany CORBA binding
+ * supports using Java interface generated by IDLJ, also it supports interfaces
+ * provided by user - I combined those cases in each test.<br>
+ */
+public class ScenarioOneTestCase {
+
+ // note that those values are also used in resources/*.composite file
+ private static int ORB_INITIAL_PORT = 5060;
+ private static String SERVICE_NAME = "ScenarioOne";
+
+ private static SCADomain domain;
+
+ private static TransientNameServer server;
+ private static ORB orb;
+
+ /**
+ * Sets up name service, creates and registers traditional CORBA service,
+ * obtains SCADomain
+ */
+ @BeforeClass
+ public static void setUp() {
+ TestCorbaHost.setCorbaHost(new DefaultCorbaHost());
+ try {
+ try {
+ server =
+ new TransientNameServer("localhost", ORB_INITIAL_PORT, TransientNameService.DEFAULT_SERVICE_NAME);
+ Thread t = server.start();
+ if (t == null) {
+ Assert.fail("The naming server cannot be started");
+ }
+ orb = server.getORB();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
+ NamingContext ncRef = NamingContextHelper.narrow(objRef);
+ NameComponent nc = new NameComponent(SERVICE_NAME, "");
+ NameComponent path[] = {nc};
+ ScenarioOne scenarioOne = new ScenarioOneServant();
+ ncRef.rebind(path, scenarioOne);
+ // obtain domain
+ domain = SCADomain.newInstance("ScenarioOne.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Kills previously spawned name service.
+ */
+ @AfterClass
+ public static void tearDown() {
+ server.stop();
+ }
+
+ /**
+ * Creates nicely filled structure for user provided interface.
+ *
+ * @return
+ */
+ private static TRichStruct getTRichStruct() {
+ int[][] intArr = new int[][] { {1, 2}, {3, 4}};
+ TInnerStruct innerStruct = new TInnerStruct(intArr, "Test", TColor.green);
+ String[] strSeq = {"i", "Test"};
+ return new TRichStruct(innerStruct, strSeq, 1);
+
+ }
+
+ /**
+ * Creates nicely filled structure for generated interface.
+ *
+ * @return
+ */
+ private static RichStruct getRichStruct() {
+ int[][] intArr = new int[][] { {1, 2}, {3, 4}};
+ InnerStruct innerStruct2 = new InnerStruct(intArr, "Test", Color.green);
+ String[] strSeq = {"i", "Test"};
+ return new RichStruct(innerStruct2, strSeq, 1);
+ }
+
+ /**
+ * Compares String arrays
+ *
+ * @param arg1
+ * @param arg2
+ * @return
+ */
+ private boolean areSrringArraysEqual(String[] arg1, String[] arg2) {
+ try {
+ for (int i = 0; i < arg1.length; i++) {
+ if (!arg1[i].equals(arg2[i])) {
+ return false;
+ }
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Compares two dimensional int arrays
+ *
+ * @param arg1
+ * @param arg2
+ * @return
+ */
+ private boolean areTwoDimIntArraysEqual(int[][] arg1, int[][] arg2) {
+ try {
+ for (int i = 0; i < arg1.length; i++) {
+ for (int j = 0; j < arg1[i].length; j++) {
+ if (arg1[i][j] != arg2[i][j]) {
+ return false;
+ }
+ }
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+ private boolean equalTo(TInnerStruct arg1, TInnerStruct arg2) {
+ return (arg1.color.value() == arg2.color.value() && arg1.stringField.equals(arg2.stringField) && areTwoDimIntArraysEqual(arg1.twoDimLongSequence,
+ arg2.twoDimLongSequence));
+ }
+
+ private boolean equalTo(InnerStruct arg1, InnerStruct arg2) {
+ return (arg1.color.value() == arg2.color.value() && arg1.stringField.equals(arg2.stringField) && areTwoDimIntArraysEqual(arg1.twoDimLongSequence,
+ arg2.twoDimLongSequence));
+ }
+
+ private boolean equalTo(TRichStruct arg1, TRichStruct arg2) {
+ return (equalTo(arg1.innerStruct, arg2.innerStruct) && arg2.longField == arg1.longField && areSrringArraysEqual(arg1.stringSequence,
+ arg2.stringSequence));
+ }
+
+ private boolean equalTo(RichStruct arg1, RichStruct arg2) {
+ return (equalTo(arg1.innerStruct, arg2.innerStruct) && arg2.longField == arg1.longField && areSrringArraysEqual(arg1.stringSequence,
+ arg2.stringSequence));
+ }
+
+ /**
+ * Helper method used several times for various components. Executes several
+ * tests using Tuscany reference binding. This helper uses generated Java
+ * interface.
+ *
+ * @param componentName
+ */
+ private void testClientUsingGeneratedInterface(String componentName) {
+ ScenarioOneOperations component = domain.getService(ScenarioOneOperations.class, componentName);
+ RichStruct richStruct = getRichStruct();
+
+ try {
+ RichStruct result = component.setRichStruct(richStruct);
+ assertTrue(equalTo(result, richStruct));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+
+ try {
+ richStruct.longField = 0;
+ component.setRichStruct(richStruct);
+ fail();
+ } catch (Exception e) {
+ assertTrue(e instanceof UnexpectedException);
+ }
+
+ try {
+ richStruct.longField = 1;
+ richStruct.innerStruct.color = Color.red;
+ component.setRichStruct(richStruct);
+ } catch (Exception e) {
+ assertTrue(e instanceof WrongColor);
+ }
+ }
+
+ /**
+ * Helper method used several times for various components. Executes several
+ * tests using Tuscany reference binding. This helper uses user provided
+ * Java interface.
+ *
+ * @param componentName
+ */
+ private void testClientUsingUserProvidedInterface(String componentName) {
+ TScenarioOne component = domain.getService(TScenarioOne.class, componentName);
+ TRichStruct tRichStruct = getTRichStruct();
+
+ try {
+ TRichStruct result = component.setRichStruct(tRichStruct);
+ assertTrue(equalTo(result, tRichStruct));
+ } catch (Exception e) {
+ fail();
+ }
+
+ try {
+ tRichStruct.longField = 0;
+ component.setRichStruct(tRichStruct);
+ fail();
+ } catch (Exception e) {
+ assertTrue(e instanceof UnexpectedException);
+ }
+
+ try {
+ tRichStruct.longField = 1;
+ tRichStruct.innerStruct.color = TColor.red;
+ component.setRichStruct(tRichStruct);
+ } catch (Exception e) {
+ assertTrue(e instanceof WrongColor);
+ }
+ }
+
+ public void testServiceUsingGeneratedClient(String serviceName) {
+ try {
+ org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
+ NamingContext ncRef = NamingContextHelper.narrow(objRef);
+ NameComponent nc = new NameComponent(serviceName, "");
+ NameComponent path[] = {nc};
+ ScenarioOne so = ScenarioOneHelper.narrow(ncRef.resolve(path));
+
+ RichStruct richStruct = getRichStruct();
+ RichStruct result = so.setRichStruct(richStruct);
+ assertTrue(equalTo(result, richStruct));
+
+ try {
+ richStruct.innerStruct.color = Color.red;
+ result = so.setRichStruct(richStruct);
+ fail();
+ } catch (Exception e) {
+ assertTrue(e instanceof WrongColor);
+ }
+
+ try {
+ richStruct.innerStruct.color = Color.green;
+ richStruct.longField = 0;
+ result = so.setRichStruct(richStruct);
+ fail();
+ } catch (Exception e) {
+ assertTrue(e instanceof UnexpectedException);
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Service is exposed in traditional way (using CORBA API from JDK).
+ * Reference is obtained from Tuscany.
+ */
+ @Test
+ public void test_TraditionalService_TuscanyClient() {
+
+ // Client is using user provided interface
+ testClientUsingUserProvidedInterface("ScenarioOne");
+
+ // Client is using generated interface
+ testClientUsingGeneratedInterface("ScenarioOneGenerated");
+ }
+
+ /**
+ * Service is exposed by Tuscany. Reference is obtained in traditional way.
+ * (using CORBA API from JDK)
+ *
+ * @throws Exception
+ */
+ @Test
+ public void test_TuscanyService_TraditionalClient() throws Exception {
+
+ // tests service which uses user provided interface
+ testServiceUsingGeneratedClient("ScenarioOneTuscany");
+
+ // tests service which uses generated interface
+ testServiceUsingGeneratedClient("ScenarioOneTuscanyGenerated");
+ }
+
+ /**
+ * Service is exposed by Tuscany. Reference is obtained from Tuscany. There
+ * are 4 combinations (basing on if we are using generated or user provided
+ * interfaces, both on service and reference side).
+ */
+ @Test
+ public void test_TuscanyService_TuscanyClient() {
+
+ // Client is using user provided interface, service is using user
+ // provided interface.
+ testClientUsingUserProvidedInterface("TU2TS1");
+
+ // Client is using user provided interface, service is using generated
+ // interface.
+ testClientUsingUserProvidedInterface("TU2TS2");
+
+ // Client is using generated interface, service is using user provided
+ // interface.
+ testClientUsingGeneratedInterface("TG2TS1");
+
+ // Client is using generated interface, service is using generated
+ // interface.
+ testClientUsingGeneratedInterface("TG2TS2");
+ }
+
+ /**
+ * Tests using reference obtained by corbaname URI
+ */
+ @Test
+ public void test_serviceAndReferenceByURI() {
+ testClientUsingUserProvidedInterface("UriBinding");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioSixTestCase.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioSixTestCase.java
new file mode 100644
index 0000000000..3c12bf1b8c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioSixTestCase.java
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.corba;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.corba.jse.DefaultCorbaHost;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct;
+import org.apache.tuscany.sca.test.corba.generated.InnerUnion;
+import org.apache.tuscany.sca.test.corba.generated.RichUnion;
+import org.apache.tuscany.sca.test.corba.generated.ScenarioSix;
+import org.apache.tuscany.sca.test.corba.generated.ScenarioSixHelper;
+import org.apache.tuscany.sca.test.corba.types.ScenarioSixServant;
+import org.apache.tuscany.sca.test.corba.types.TAnnotatedStruct;
+import org.apache.tuscany.sca.test.corba.types.TInnerUnion;
+import org.apache.tuscany.sca.test.corba.types.TRichUnion;
+import org.apache.tuscany.sca.test.corba.types.TScenarioSix;
+import org.apache.tuscany.sca.test.corba.types.TScenarioSixComponent;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.omg.CORBA.ORB;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextHelper;
+
+/**
+ * Tests using enhanced Java interfaces (annotations)
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScenarioSixTestCase {
+
+ // note that those values are also used in resources/*.composite file
+ private static int ORB_INITIAL_PORT = 5050;
+ private static String SERVICE_NAME = "ScenarioSix";
+ private static String TUSCANY_SERVICE_NAME = "ScenarioSixTuscany";
+
+ private static SCADomain domain;
+
+ private static TransientNameServer server;
+ private static ORB orb;
+
+ /**
+ * Sets up name service, creates and registers traditional CORBA service,
+ * obtains SCADomain
+ */
+ @BeforeClass
+ public static void setUp() {
+ TestCorbaHost.setCorbaHost(new DefaultCorbaHost());
+ try {
+ try {
+ server =
+ new TransientNameServer("localhost", ORB_INITIAL_PORT, TransientNameService.DEFAULT_SERVICE_NAME);
+ Thread t = server.start();
+ if (t == null) {
+ Assert.fail("The naming server cannot be started");
+ }
+ orb = server.getORB();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
+ NamingContext ncRef = NamingContextHelper.narrow(objRef);
+ NameComponent nc = new NameComponent(SERVICE_NAME, "");
+ NameComponent path[] = {nc};
+ ScenarioSix scenarioSix = new ScenarioSixServant();
+ ncRef.rebind(path, scenarioSix);
+ // obtain domain
+ domain = SCADomain.newInstance("ScenarioSix.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Kills previously spawned name service.
+ */
+ @AfterClass
+ public static void tearDown() {
+ server.stop();
+ }
+
+ private boolean areArraysEqual(String[][] arr1, String[][] arr2) {
+ for (int i = 0; i < arr1.length; i++) {
+ for (int j = 0; j < arr1[i].length; j++) {
+ if (!arr1[i][j].equals(arr2[i][j])) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ private String[][] getStringArray() {
+ String[][] result = { {"Hello", "World"}, {"Hi", "Again"}};
+ return result;
+ }
+
+ /**
+ * Tests passing arrays. Tuscany acts as a client, servant object is served
+ * in a traditional way
+ */
+ @Test
+ public void test_arraysPassing_tuscanyAsClient() {
+ try {
+ TScenarioSix ref = domain.getService(TScenarioSixComponent.class, "ScenarioSix").getScenarioSix();
+ String[][] arrayArg = getStringArray();
+ String[][] arrayRes = ref.passStringArray(arrayArg);
+ assertTrue(areArraysEqual(arrayArg, arrayRes));
+ TAnnotatedStruct structArg = new TAnnotatedStruct();
+ structArg.stringArray = getStringArray();
+ TAnnotatedStruct structRes = ref.passAnnotatedStruct(structArg);
+ assertTrue(areArraysEqual(structArg.stringArray, structRes.stringArray));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests passing arrays. Servant object is served by Tuscany and it is
+ * accessed by traditional Corba client
+ */
+ @Test
+ public void test_arraysPassing_tuscanyAsService() {
+ try {
+ org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
+ NamingContext ncRef = NamingContextHelper.narrow(objRef);
+ NameComponent nc = new NameComponent(TUSCANY_SERVICE_NAME, "");
+ NameComponent path[] = {nc};
+ ScenarioSix ref = ScenarioSixHelper.narrow(ncRef.resolve(path));
+ String[][] stringArg = getStringArray();
+ String[][] stringRes = ref.passStringArray(stringArg);
+ assertTrue(areArraysEqual(stringArg, stringRes));
+ AnnotatedStruct structArg = new AnnotatedStruct();
+ structArg.stringArray = getStringArray();
+ AnnotatedStruct structRes = ref.passAnnotatedStruct(structArg);
+ assertTrue(areArraysEqual(structArg.stringArray, structRes.stringArray));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests passing unions. Tuscany acts as a client, servant object is served
+ * in a traditional way
+ */
+ @Test
+ public void test_unionsPassing_tuscanyAsClient() {
+ try {
+ TScenarioSix ref = domain.getService(TScenarioSixComponent.class, "ScenarioSix").getScenarioSix();
+ TRichUnion arg = new TRichUnion();
+ TInnerUnion inner = new TInnerUnion();
+ inner.setY(10f);
+ arg.setIu(inner);
+ TRichUnion result = ref.passRichUnion(arg);
+ assertEquals(arg.getIu().getY(), result.getIu().getY());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ try {
+ TScenarioSix ref = domain.getService(TScenarioSixComponent.class, "ScenarioSix").getScenarioSix();
+ TRichUnion arg = new TRichUnion();
+ arg.setY(15f);
+ TRichUnion result = ref.passRichUnion(arg);
+ assertEquals(arg.getY(), result.getY());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests passing unions. Servant object is served by Tuscany and it is
+ * accessed by traditional Corba client
+ */
+ @Test
+ public void test_unionsPassing_tuscanyAsService() {
+ try {
+ org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
+ NamingContext ncRef = NamingContextHelper.narrow(objRef);
+ NameComponent nc = new NameComponent(TUSCANY_SERVICE_NAME, "");
+ NameComponent path[] = {nc};
+ ScenarioSix ref = ScenarioSixHelper.narrow(ncRef.resolve(path));
+ RichUnion arg = new RichUnion();
+ InnerUnion inner = new InnerUnion();
+ inner.y(20f);
+ arg.iu(inner);
+ RichUnion result = ref.passRichUnion(arg);
+ assertEquals(arg.iu().y(), result.iu().y());
+ arg = new RichUnion();
+ arg.y(15f);
+ result = ref.passRichUnion(arg);
+ assertEquals(arg.y(), result.y());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioThreeTestCase.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioThreeTestCase.java
new file mode 100644
index 0000000000..a738c6f211
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioThreeTestCase.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.corba;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.corba.jse.DefaultCorbaHost;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.corba.types.TScenarioThree;
+import org.apache.tuscany.sca.test.corba.types.TScenarioThreeComponent;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ * Tests various mapping scenarios.
+ */
+public class ScenarioThreeTestCase {
+
+ // note that those values are also used in resources/*.composite file
+ private static int ORB_INITIAL_PORT = 5060;
+ private static SCADomain domain;
+ private static TransientNameServer server;
+
+ /**
+ * Sets up name service, creates and registers traditional CORBA service,
+ * obtains SCADomain
+ */
+ @BeforeClass
+ public static void setUp() {
+ TestCorbaHost.setCorbaHost(new DefaultCorbaHost());
+ try {
+ try {
+ server =
+ new TransientNameServer("localhost", ORB_INITIAL_PORT, TransientNameService.DEFAULT_SERVICE_NAME);
+ Thread t = server.start();
+ if (t == null) {
+ Assert.fail("The naming server cannot be started");
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ // obtain domain
+ domain = SCADomain.newInstance("ScenarioThree.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Kills previously spawned name service.
+ */
+ @AfterClass
+ public static void tearDown() {
+ server.stop();
+ }
+
+ /**
+ * Tests mapping for getters and setters
+ */
+ @Test
+ public void test_getterSetter() {
+ try {
+ TScenarioThree ref =
+ domain.getService(TScenarioThreeComponent.class, "ScenarioThreeReference").getScenarioThree();
+ ref.getIntField();
+ ref.setIntField(1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests mapping the same operation names but with different cases
+ */
+ @Test
+ public void test_nameCase() {
+ try {
+ TScenarioThree ref =
+ domain.getService(TScenarioThreeComponent.class, "ScenarioThreeReference").getScenarioThree();
+ assertEquals(0, ref.caseDifferent());
+ assertEquals(1, ref.CaseDifferent());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests mappings for operations with overloaded names
+ */
+ @Test
+ public void test_overloadedNames() {
+ try {
+ TScenarioThree ref =
+ domain.getService(TScenarioThreeComponent.class, "ScenarioThreeReference").getScenarioThree();
+ ref.overloadedName();
+ ref.overloadedName("");
+ ref.overloadedName("", 0);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioTwoTestCase.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioTwoTestCase.java
new file mode 100644
index 0000000000..008212bdbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioTwoTestCase.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.corba;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.corba.jse.DefaultCorbaHost;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
+import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.corba.generated.ScenarioTwo;
+import org.apache.tuscany.sca.test.corba.generated.ScenarioTwoHelper;
+import org.apache.tuscany.sca.test.corba.types.ScenarioTwoServant;
+import org.apache.tuscany.sca.test.corba.types.TScenarioTwo;
+import org.apache.tuscany.sca.test.corba.types.TScenarioTwoComponent;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.omg.CORBA.ORB;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextHelper;
+
+/**
+ * @version $Rev$ $Date$
+ * Tests attribute get/set mapping using cooperation between traditional CORBA
+ * and Tuscany CORBA
+ */
+public class ScenarioTwoTestCase {
+
+ // note that those values are also used in resources/*.composite file
+ private static int ORB_INITIAL_PORT = 5060;
+
+ private static SCADomain domain;
+
+ private static TransientNameServer server;
+ private static ORB orb;
+ private static String TUSCANY_SERVICE_NAME = "ScenarioTwo";
+ private static String GENERATED_SERVICE_NAME = "ScenarioTwoGenerated";
+
+ /**
+ * Sets up name service, creates and registers traditional CORBA service,
+ * obtains SCADomain
+ */
+ @BeforeClass
+ public static void setUp() {
+ TestCorbaHost.setCorbaHost(new DefaultCorbaHost());
+ try {
+ try {
+ server =
+ new TransientNameServer("localhost", ORB_INITIAL_PORT, TransientNameService.DEFAULT_SERVICE_NAME);
+ Thread t = server.start();
+ if (t == null) {
+ Assert.fail("The naming server cannot be started");
+ }
+ orb = server.getORB();
+ org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
+ NamingContext ncRef = NamingContextHelper.narrow(objRef);
+ NameComponent nc = new NameComponent(GENERATED_SERVICE_NAME, "");
+ NameComponent path[] = {nc};
+ ScenarioTwo scenarioTwo = new ScenarioTwoServant();
+ ncRef.rebind(path, scenarioTwo);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ Assert.fail(e.getMessage());
+ }
+ // obtain domain
+ domain = SCADomain.newInstance("ScenarioTwo.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Kills previously spawned name service.
+ */
+ @AfterClass
+ public static void tearDown() {
+ server.stop();
+ }
+
+ /**
+ * Tests using objects attribute (which is server in traditional way) by
+ * Tuscany CORBA binding
+ */
+ @Test
+ public void test_tuscanyGetSetAttribute() {
+ try {
+ TScenarioTwo ref = domain.getService(TScenarioTwoComponent.class, "ScenarioTwo").getScenarioTwo();
+ String strVal = "Whatever";
+ ref.setStringField(strVal);
+ assertEquals(strVal, ref.getStringField());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * Tests using objects attribute (which is served by Tuscany) in traditional
+ * way (by idlj generated code)
+ */
+ @Test
+ public void test_getneratedGetSetAttribute() {
+ try {
+ orb = server.getORB();
+ org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
+ NamingContext ncRef = NamingContextHelper.narrow(objRef);
+ NameComponent nc = new NameComponent(TUSCANY_SERVICE_NAME, "");
+ NameComponent path[] = {nc};
+ ScenarioTwo st = ScenarioTwoHelper.narrow(ncRef.resolve(path));
+ st.stringField("");
+ assertEquals("", st.stringField());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/TestCorbaHost.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/TestCorbaHost.java
new file mode 100644
index 0000000000..bd1ce8cb49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/TestCorbaHost.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.corba;
+
+import org.apache.tuscany.sca.host.corba.CorbaHost;
+import org.apache.tuscany.sca.host.corba.CorbaHostException;
+import org.apache.tuscany.sca.host.corba.jse.DefaultCorbaHost;
+import org.omg.CORBA.Object;
+
+/**
+ * @version $Rev$ $Date$
+ * Mock Corba host which proxies to configured Corba host
+ */
+public class TestCorbaHost implements CorbaHost {
+
+ private static CorbaHost corbaHost = new DefaultCorbaHost();
+
+ /**
+ * Configures environment to use given Corba host
+ *
+ * @param corbaHost Corba host to use
+ */
+ public static void setCorbaHost(CorbaHost corbaHost) {
+ TestCorbaHost.corbaHost = corbaHost;
+ }
+
+ public Object lookup(String arg0) throws CorbaHostException {
+ return TestCorbaHost.corbaHost.lookup(arg0);
+ }
+
+ public void registerServant(String arg0, Object arg1) throws CorbaHostException {
+ TestCorbaHost.corbaHost.registerServant(arg0, arg1);
+ }
+
+ public void unregisterServant(String arg0) throws CorbaHostException {
+ TestCorbaHost.corbaHost.unregisterServant(arg0);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/TestCorbaHostModuleActivator.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/TestCorbaHostModuleActivator.java
new file mode 100644
index 0000000000..c25372c837
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/TestCorbaHostModuleActivator.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.corba;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ * Registers TestCorbaHost as a Corba host extension.
+ */
+public class TestCorbaHostModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry extensionPointRegistry) {
+ CorbaHostExtensionPoint chep = extensionPointRegistry.getExtensionPoint(CorbaHostExtensionPoint.class);
+ chep.getCorbaHosts().add(0, new TestCorbaHost());
+ }
+
+ public void stop(ExtensionPointRegistry extensionPointRegistry) {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStruct.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStruct.java
new file mode 100644
index 0000000000..abcec43d0e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStruct.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/AnnotatedStruct.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* sobota, 16 sierpieñ 2008 15:31:35 CEST
+*/
+
+public final class AnnotatedStruct implements org.omg.CORBA.portable.IDLEntity
+{
+ public String stringArray[][] = null;
+
+ public AnnotatedStruct ()
+ {
+ } // ctor
+
+ public AnnotatedStruct (String[][] _stringArray)
+ {
+ stringArray = _stringArray;
+ } // ctor
+
+} // class AnnotatedStruct
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHelper.java
new file mode 100644
index 0000000000..171a7919a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHelper.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* sobota, 16 sierpieñ 2008 15:31:35 CEST
+*/
+
+abstract public class AnnotatedStructHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/AnnotatedStruct/AnnotatedStruct:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ private static boolean __active = false;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ synchronized (org.omg.CORBA.TypeCode.class)
+ {
+ if (__typeCode == null)
+ {
+ if (__active)
+ {
+ return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
+ }
+ __active = true;
+ org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [1];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_array_tc (2, _tcOf_members0 );
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_array_tc (2, _tcOf_members0 );
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.id (), "StringArray", _tcOf_members0);
+ _members0[0] = new org.omg.CORBA.StructMember (
+ "stringArray",
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.apache.tuscany.sca.test.corba.generated.AnnotatedStructHelper.id (), "AnnotatedStruct", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct value = new org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct ();
+ value.stringArray = org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.read (istream);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct value)
+ {
+ org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.write (ostream, value.stringArray);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHolder.java
new file mode 100644
index 0000000000..5f2dc56033
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHolder.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.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/AnnotatedStructHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* sobota, 16 sierpieñ 2008 15:31:35 CEST
+*/
+
+public final class AnnotatedStructHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct value = null;
+
+ public AnnotatedStructHolder ()
+ {
+ }
+
+ public AnnotatedStructHolder (org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.AnnotatedStructHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.AnnotatedStructHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.AnnotatedStructHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/Color.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/Color.java
new file mode 100644
index 0000000000..24a628d406
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/Color.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/Color.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public class Color implements org.omg.CORBA.portable.IDLEntity
+{
+ private int __value;
+ private static int __size = 3;
+ private static org.apache.tuscany.sca.test.corba.generated.Color[] __array = new org.apache.tuscany.sca.test.corba.generated.Color [__size];
+
+ public static final int _red = 0;
+ public static final org.apache.tuscany.sca.test.corba.generated.Color red = new org.apache.tuscany.sca.test.corba.generated.Color(_red);
+ public static final int _yellow = 1;
+ public static final org.apache.tuscany.sca.test.corba.generated.Color yellow = new org.apache.tuscany.sca.test.corba.generated.Color(_yellow);
+ public static final int _green = 2;
+ public static final org.apache.tuscany.sca.test.corba.generated.Color green = new org.apache.tuscany.sca.test.corba.generated.Color(_green);
+
+ public int value ()
+ {
+ return __value;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.Color from_int (int value)
+ {
+ if (value >= 0 && value < __size)
+ return __array[value];
+ else
+ throw new org.omg.CORBA.BAD_PARAM ();
+ }
+
+ protected Color (int value)
+ {
+ __value = value;
+ __array[__value] = this;
+ }
+} // class Color
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ColorHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ColorHelper.java
new file mode 100644
index 0000000000..da37f28e39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ColorHelper.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ColorHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+abstract public class ColorHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/Color:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.Color that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.Color extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (org.apache.tuscany.sca.test.corba.generated.ColorHelper.id (), "Color", new String[] { "red", "yellow", "green"} );
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.Color read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return org.apache.tuscany.sca.test.corba.generated.Color.from_int (istream.read_long ());
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.Color value)
+ {
+ ostream.write_long (value.value ());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ColorHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ColorHolder.java
new file mode 100644
index 0000000000..7b2466f791
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ColorHolder.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.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ColorHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class ColorHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.Color value = null;
+
+ public ColorHolder ()
+ {
+ }
+
+ public ColorHolder (org.apache.tuscany.sca.test.corba.generated.Color initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.ColorHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.ColorHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.ColorHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStruct.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStruct.java
new file mode 100644
index 0000000000..27052a1549
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStruct.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/InnerStruct.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class InnerStruct implements org.omg.CORBA.portable.IDLEntity
+{
+ public int twoDimLongSequence[][] = null;
+ public String stringField = null;
+ public org.apache.tuscany.sca.test.corba.generated.Color color = null;
+
+ public InnerStruct ()
+ {
+ } // ctor
+
+ public InnerStruct (int[][] _twoDimLongSequence, String _stringField, org.apache.tuscany.sca.test.corba.generated.Color _color)
+ {
+ twoDimLongSequence = _twoDimLongSequence;
+ stringField = _stringField;
+ color = _color;
+ } // ctor
+
+} // class InnerStruct
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStructHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStructHelper.java
new file mode 100644
index 0000000000..57daa51f42
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStructHelper.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/InnerStructHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+abstract public class InnerStructHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/InnerStruct/InnerStruct:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.InnerStruct that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.InnerStruct extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ private static boolean __active = false;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ synchronized (org.omg.CORBA.TypeCode.class)
+ {
+ if (__typeCode == null)
+ {
+ if (__active)
+ {
+ return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
+ }
+ __active = true;
+ org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [3];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.test.corba.generated.LongSequenceHelper.id (), "LongSequence", _tcOf_members0);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.test.corba.generated.TwoDimLongSequenceHelper.id (), "TwoDimLongSequence", _tcOf_members0);
+ _members0[0] = new org.omg.CORBA.StructMember (
+ "twoDimLongSequence",
+ _tcOf_members0,
+ null);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
+ _members0[1] = new org.omg.CORBA.StructMember (
+ "stringField",
+ _tcOf_members0,
+ null);
+ _tcOf_members0 = org.apache.tuscany.sca.test.corba.generated.ColorHelper.type ();
+ _members0[2] = new org.omg.CORBA.StructMember (
+ "color",
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.apache.tuscany.sca.test.corba.generated.InnerStructHelper.id (), "InnerStruct", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.InnerStruct read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.apache.tuscany.sca.test.corba.generated.InnerStruct value = new org.apache.tuscany.sca.test.corba.generated.InnerStruct ();
+ value.twoDimLongSequence = org.apache.tuscany.sca.test.corba.generated.TwoDimLongSequenceHelper.read (istream);
+ value.stringField = istream.read_string ();
+ value.color = org.apache.tuscany.sca.test.corba.generated.ColorHelper.read (istream);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.InnerStruct value)
+ {
+ org.apache.tuscany.sca.test.corba.generated.TwoDimLongSequenceHelper.write (ostream, value.twoDimLongSequence);
+ ostream.write_string (value.stringField);
+ org.apache.tuscany.sca.test.corba.generated.ColorHelper.write (ostream, value.color);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStructHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStructHolder.java
new file mode 100644
index 0000000000..88fef0b4fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerStructHolder.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.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/InnerStructHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class InnerStructHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.InnerStruct value = null;
+
+ public InnerStructHolder ()
+ {
+ }
+
+ public InnerStructHolder (org.apache.tuscany.sca.test.corba.generated.InnerStruct initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.InnerStructHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.InnerStructHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.InnerStructHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnion.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnion.java
new file mode 100644
index 0000000000..40c017dd29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnion.java
@@ -0,0 +1,112 @@
+package org.apache.tuscany.sca.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/InnerUnion.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* niedziela, 17 sierpieñ 2008 19:07:14 CEST
+*/
+
+public final class InnerUnion implements org.omg.CORBA.portable.IDLEntity
+{
+ private int ___x;
+ private float ___y;
+ private int __discriminator;
+ private boolean __uninitialized = true;
+
+ public InnerUnion ()
+ {
+ }
+
+ public int discriminator ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ return __discriminator;
+ }
+
+ public int x ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ verifyx (__discriminator);
+ return ___x;
+ }
+
+ public void x (int value)
+ {
+ __discriminator = 1;
+ ___x = value;
+ __uninitialized = false;
+ }
+
+ public void x (int discriminator, int value)
+ {
+ verifyx (discriminator);
+ __discriminator = discriminator;
+ ___x = value;
+ __uninitialized = false;
+ }
+
+ private void verifyx (int discriminator)
+ {
+ if (discriminator != 1)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+
+ public float y ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ verifyy (__discriminator);
+ return ___y;
+ }
+
+ public void y (float value)
+ {
+ __discriminator = 2;
+ ___y = value;
+ __uninitialized = false;
+ }
+
+ public void y (int discriminator, float value)
+ {
+ verifyy (discriminator);
+ __discriminator = discriminator;
+ ___y = value;
+ __uninitialized = false;
+ }
+
+ private void verifyy (int discriminator)
+ {
+ if (discriminator != 2)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+
+ public void _default ()
+ {
+ __discriminator = -2147483648;
+ __uninitialized = false;
+ }
+
+ public void _default (int discriminator)
+ {
+ verifyDefault( discriminator ) ;
+ __discriminator = discriminator ;
+ __uninitialized = false;
+ }
+
+ private void verifyDefault( int value )
+ {
+ switch (value) {
+ case 1:
+ case 2:
+ throw new org.omg.CORBA.BAD_OPERATION() ;
+
+ default:
+ return;
+ }
+ }
+
+} // class InnerUnion
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnionHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnionHelper.java
new file mode 100644
index 0000000000..6ec067521e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnionHelper.java
@@ -0,0 +1,106 @@
+package org.apache.tuscany.sca.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/InnerUnionHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* niedziela, 17 sierpieñ 2008 19:07:14 CEST
+*/
+
+abstract public class InnerUnionHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/InnerUnion/InnerUnion:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.InnerUnion that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.InnerUnion extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ org.omg.CORBA.TypeCode _disTypeCode0;
+ _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+ org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [2];
+ org.omg.CORBA.TypeCode _tcOf_members0;
+ org.omg.CORBA.Any _anyOf_members0;
+
+ // Branch for x (case label 1)
+ _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+ _anyOf_members0.insert_long ((int)1);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+ _members0[0] = new org.omg.CORBA.UnionMember (
+ "x",
+ _anyOf_members0,
+ _tcOf_members0,
+ null);
+
+ // Branch for y (case label 2)
+ _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+ _anyOf_members0.insert_long ((int)2);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float);
+ _members0[1] = new org.omg.CORBA.UnionMember (
+ "y",
+ _anyOf_members0,
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (org.apache.tuscany.sca.test.corba.generated.InnerUnionHelper.id (), "InnerUnion", _disTypeCode0, _members0);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.InnerUnion read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.apache.tuscany.sca.test.corba.generated.InnerUnion value = new org.apache.tuscany.sca.test.corba.generated.InnerUnion ();
+ int _dis0 = (int)0;
+ _dis0 = istream.read_long ();
+ switch (_dis0)
+ {
+ case 1:
+ int _x = (int)0;
+ _x = istream.read_long ();
+ value.x (_x);
+ break;
+ case 2:
+ float _y = (float)0;
+ _y = istream.read_float ();
+ value.y (_y);
+ break;
+ default:
+ value._default( _dis0 ) ;
+ break;
+ }
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.InnerUnion value)
+ {
+ ostream.write_long (value.discriminator ());
+ switch (value.discriminator ())
+ {
+ case 1:
+ ostream.write_long (value.x ());
+ break;
+ case 2:
+ ostream.write_float (value.y ());
+ break;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnionHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnionHolder.java
new file mode 100644
index 0000000000..8955f81694
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/InnerUnionHolder.java
@@ -0,0 +1,38 @@
+package org.apache.tuscany.sca.test.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/InnerUnionHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* niedziela, 17 sierpieñ 2008 19:07:14 CEST
+*/
+
+public final class InnerUnionHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.InnerUnion value = null;
+
+ public InnerUnionHolder ()
+ {
+ }
+
+ public InnerUnionHolder (org.apache.tuscany.sca.test.corba.generated.InnerUnion initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.InnerUnionHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.InnerUnionHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.InnerUnionHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/LongSequenceHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/LongSequenceHelper.java
new file mode 100644
index 0000000000..940b391499
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/LongSequenceHelper.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/LongSequenceHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+abstract public class LongSequenceHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/LongSequence:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, int[] that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static int[] extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.test.corba.generated.LongSequenceHelper.id (), "LongSequence", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static int[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ int value[] = null;
+ int _len0 = istream.read_long ();
+ value = new int[_len0];
+ istream.read_long_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, int[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_long_array (value, 0, value.length);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/LongSequenceHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/LongSequenceHolder.java
new file mode 100644
index 0000000000..63a11dc56a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/LongSequenceHolder.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/LongSequenceHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class LongSequenceHolder implements org.omg.CORBA.portable.Streamable
+{
+ public int value[] = null;
+
+ public LongSequenceHolder ()
+ {
+ }
+
+ public LongSequenceHolder (int[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.LongSequenceHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.LongSequenceHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.LongSequenceHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStruct.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStruct.java
new file mode 100644
index 0000000000..8c0bfc9e39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStruct.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/RichStruct.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class RichStruct implements org.omg.CORBA.portable.IDLEntity
+{
+ public org.apache.tuscany.sca.test.corba.generated.InnerStruct innerStruct = null;
+ public String stringSequence[] = null;
+ public int longField = (int)0;
+
+ public RichStruct ()
+ {
+ } // ctor
+
+ public RichStruct (org.apache.tuscany.sca.test.corba.generated.InnerStruct _innerStruct, String[] _stringSequence, int _longField)
+ {
+ innerStruct = _innerStruct;
+ stringSequence = _stringSequence;
+ longField = _longField;
+ } // ctor
+
+} // class RichStruct
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStructHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStructHelper.java
new file mode 100644
index 0000000000..72ff55a711
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStructHelper.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/RichStructHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+abstract public class RichStructHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/RichStruct/RichStruct:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.RichStruct that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.RichStruct extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ private static boolean __active = false;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ synchronized (org.omg.CORBA.TypeCode.class)
+ {
+ if (__typeCode == null)
+ {
+ if (__active)
+ {
+ return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
+ }
+ __active = true;
+ org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [3];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ _tcOf_members0 = org.apache.tuscany.sca.test.corba.generated.InnerStructHelper.type ();
+ _members0[0] = new org.omg.CORBA.StructMember (
+ "innerStruct",
+ _tcOf_members0,
+ null);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.test.corba.generated.StringSequenceHelper.id (), "StringSequence", _tcOf_members0);
+ _members0[1] = new org.omg.CORBA.StructMember (
+ "stringSequence",
+ _tcOf_members0,
+ null);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+ _members0[2] = new org.omg.CORBA.StructMember (
+ "longField",
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.apache.tuscany.sca.test.corba.generated.RichStructHelper.id (), "RichStruct", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.RichStruct read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.apache.tuscany.sca.test.corba.generated.RichStruct value = new org.apache.tuscany.sca.test.corba.generated.RichStruct ();
+ value.innerStruct = org.apache.tuscany.sca.test.corba.generated.InnerStructHelper.read (istream);
+ value.stringSequence = org.apache.tuscany.sca.test.corba.generated.StringSequenceHelper.read (istream);
+ value.longField = istream.read_long ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.RichStruct value)
+ {
+ org.apache.tuscany.sca.test.corba.generated.InnerStructHelper.write (ostream, value.innerStruct);
+ org.apache.tuscany.sca.test.corba.generated.StringSequenceHelper.write (ostream, value.stringSequence);
+ ostream.write_long (value.longField);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStructHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStructHolder.java
new file mode 100644
index 0000000000..8a063b8b9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichStructHolder.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.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/RichStructHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class RichStructHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.RichStruct value = null;
+
+ public RichStructHolder ()
+ {
+ }
+
+ public RichStructHolder (org.apache.tuscany.sca.test.corba.generated.RichStruct initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.RichStructHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.RichStructHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.RichStructHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnion.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnion.java
new file mode 100644
index 0000000000..4a3376c476
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnion.java
@@ -0,0 +1,177 @@
+package org.apache.tuscany.sca.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/RichUnion.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* niedziela, 17 sierpieñ 2008 19:07:14 CEST
+*/
+
+public final class RichUnion implements org.omg.CORBA.portable.IDLEntity
+{
+ private int ___x;
+ private float ___y;
+ private String ___z;
+ private org.apache.tuscany.sca.test.corba.generated.InnerUnion ___iu;
+ private boolean ___a;
+ private int __discriminator;
+ private boolean __uninitialized = true;
+
+ public RichUnion ()
+ {
+ }
+
+ public int discriminator ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ return __discriminator;
+ }
+
+ public int x ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ verifyx (__discriminator);
+ return ___x;
+ }
+
+ public void x (int value)
+ {
+ __discriminator = 1;
+ ___x = value;
+ __uninitialized = false;
+ }
+
+ public void x (int discriminator, int value)
+ {
+ verifyx (discriminator);
+ __discriminator = discriminator;
+ ___x = value;
+ __uninitialized = false;
+ }
+
+ private void verifyx (int discriminator)
+ {
+ if (discriminator != 1)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+
+ public float y ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ verifyy (__discriminator);
+ return ___y;
+ }
+
+ public void y (float value)
+ {
+ __discriminator = 2;
+ ___y = value;
+ __uninitialized = false;
+ }
+
+ public void y (int discriminator, float value)
+ {
+ verifyy (discriminator);
+ __discriminator = discriminator;
+ ___y = value;
+ __uninitialized = false;
+ }
+
+ private void verifyy (int discriminator)
+ {
+ if (discriminator != 2)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+
+ public String z ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ verifyz (__discriminator);
+ return ___z;
+ }
+
+ public void z (String value)
+ {
+ __discriminator = 3;
+ ___z = value;
+ __uninitialized = false;
+ }
+
+ public void z (int discriminator, String value)
+ {
+ verifyz (discriminator);
+ __discriminator = discriminator;
+ ___z = value;
+ __uninitialized = false;
+ }
+
+ private void verifyz (int discriminator)
+ {
+ if (discriminator != 3)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+
+ public org.apache.tuscany.sca.test.corba.generated.InnerUnion iu ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ verifyiu (__discriminator);
+ return ___iu;
+ }
+
+ public void iu (org.apache.tuscany.sca.test.corba.generated.InnerUnion value)
+ {
+ __discriminator = 4;
+ ___iu = value;
+ __uninitialized = false;
+ }
+
+ public void iu (int discriminator, org.apache.tuscany.sca.test.corba.generated.InnerUnion value)
+ {
+ verifyiu (discriminator);
+ __discriminator = discriminator;
+ ___iu = value;
+ __uninitialized = false;
+ }
+
+ private void verifyiu (int discriminator)
+ {
+ if (discriminator != 4)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+
+ public boolean a ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ verifya (__discriminator);
+ return ___a;
+ }
+
+ public void a (boolean value)
+ {
+ __discriminator = -2147483648;
+ ___a = value;
+ __uninitialized = false;
+ }
+
+ public void a (int discriminator, boolean value)
+ {
+ verifya (discriminator);
+ __discriminator = discriminator;
+ ___a = value;
+ __uninitialized = false;
+ }
+
+ private void verifya (int discriminator)
+ {
+ if (discriminator == 1 || discriminator == 2 || discriminator == 3 || discriminator == 4)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+
+} // class RichUnion
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnionHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnionHelper.java
new file mode 100644
index 0000000000..9b89d7f98a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnionHelper.java
@@ -0,0 +1,157 @@
+package org.apache.tuscany.sca.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/RichUnionHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* niedziela, 17 sierpieñ 2008 19:07:14 CEST
+*/
+
+abstract public class RichUnionHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/RichUnion/RichUnion:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.RichUnion that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.RichUnion extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ org.omg.CORBA.TypeCode _disTypeCode0;
+ _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+ org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [5];
+ org.omg.CORBA.TypeCode _tcOf_members0;
+ org.omg.CORBA.Any _anyOf_members0;
+
+ // Branch for x (case label 1)
+ _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+ _anyOf_members0.insert_long ((int)1);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+ _members0[0] = new org.omg.CORBA.UnionMember (
+ "x",
+ _anyOf_members0,
+ _tcOf_members0,
+ null);
+
+ // Branch for y (case label 2)
+ _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+ _anyOf_members0.insert_long ((int)2);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float);
+ _members0[1] = new org.omg.CORBA.UnionMember (
+ "y",
+ _anyOf_members0,
+ _tcOf_members0,
+ null);
+
+ // Branch for z (case label 3)
+ _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+ _anyOf_members0.insert_long ((int)3);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
+ _members0[2] = new org.omg.CORBA.UnionMember (
+ "z",
+ _anyOf_members0,
+ _tcOf_members0,
+ null);
+
+ // Branch for iu (case label 4)
+ _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+ _anyOf_members0.insert_long ((int)4);
+ _tcOf_members0 = org.apache.tuscany.sca.test.corba.generated.InnerUnionHelper.type ();
+ _members0[3] = new org.omg.CORBA.UnionMember (
+ "iu",
+ _anyOf_members0,
+ _tcOf_members0,
+ null);
+
+ // Branch for a (Default case)
+ _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+ _anyOf_members0.insert_octet ((byte)0); // default member label
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean);
+ _members0[4] = new org.omg.CORBA.UnionMember (
+ "a",
+ _anyOf_members0,
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (org.apache.tuscany.sca.test.corba.generated.RichUnionHelper.id (), "RichUnion", _disTypeCode0, _members0);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.RichUnion read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.apache.tuscany.sca.test.corba.generated.RichUnion value = new org.apache.tuscany.sca.test.corba.generated.RichUnion ();
+ int _dis0 = (int)0;
+ _dis0 = istream.read_long ();
+ switch (_dis0)
+ {
+ case 1:
+ int _x = (int)0;
+ _x = istream.read_long ();
+ value.x (_x);
+ break;
+ case 2:
+ float _y = (float)0;
+ _y = istream.read_float ();
+ value.y (_y);
+ break;
+ case 3:
+ String _z = null;
+ _z = istream.read_string ();
+ value.z (_z);
+ break;
+ case 4:
+ org.apache.tuscany.sca.test.corba.generated.InnerUnion _iu = null;
+ _iu = org.apache.tuscany.sca.test.corba.generated.InnerUnionHelper.read (istream);
+ value.iu (_iu);
+ break;
+ default:
+ boolean _a = false;
+ _a = istream.read_boolean ();
+ value.a (_dis0, _a);
+ break;
+ }
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.RichUnion value)
+ {
+ ostream.write_long (value.discriminator ());
+ switch (value.discriminator ())
+ {
+ case 1:
+ ostream.write_long (value.x ());
+ break;
+ case 2:
+ ostream.write_float (value.y ());
+ break;
+ case 3:
+ ostream.write_string (value.z ());
+ break;
+ case 4:
+ org.apache.tuscany.sca.test.corba.generated.InnerUnionHelper.write (ostream, value.iu ());
+ break;
+ default:
+ ostream.write_boolean (value.a ());
+ break;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnionHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnionHolder.java
new file mode 100644
index 0000000000..3c1a1c9a83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/RichUnionHolder.java
@@ -0,0 +1,38 @@
+package org.apache.tuscany.sca.test.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/RichUnionHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* niedziela, 17 sierpieñ 2008 19:07:14 CEST
+*/
+
+public final class RichUnionHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.RichUnion value = null;
+
+ public RichUnionHolder ()
+ {
+ }
+
+ public RichUnionHolder (org.apache.tuscany.sca.test.corba.generated.RichUnion initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.RichUnionHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.RichUnionHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.RichUnionHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOne.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOne.java
new file mode 100644
index 0000000000..13f294b871
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOne.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioOne.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public interface ScenarioOne extends ScenarioOneOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
+{
+} // interface ScenarioOne
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneHelper.java
new file mode 100644
index 0000000000..66cc1d1e82
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneHelper.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioOneHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+abstract public class ScenarioOneHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioOne:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.ScenarioOne that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioOne extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.apache.tuscany.sca.test.corba.generated.ScenarioOneHelper.id (), "ScenarioOne");
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioOne read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return narrow (istream.read_Object (_ScenarioOneStub.class));
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.ScenarioOne value)
+ {
+ ostream.write_Object ((org.omg.CORBA.Object) value);
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioOne narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.apache.tuscany.sca.test.corba.generated.ScenarioOne)
+ return (org.apache.tuscany.sca.test.corba.generated.ScenarioOne)obj;
+ else if (!obj._is_a (id ()))
+ throw new org.omg.CORBA.BAD_PARAM ();
+ else
+ {
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
+ org.apache.tuscany.sca.test.corba.generated._ScenarioOneStub stub = new org.apache.tuscany.sca.test.corba.generated._ScenarioOneStub ();
+ stub._set_delegate(delegate);
+ return stub;
+ }
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioOne unchecked_narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.apache.tuscany.sca.test.corba.generated.ScenarioOne)
+ return (org.apache.tuscany.sca.test.corba.generated.ScenarioOne)obj;
+ else
+ {
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
+ org.apache.tuscany.sca.test.corba.generated._ScenarioOneStub stub = new org.apache.tuscany.sca.test.corba.generated._ScenarioOneStub ();
+ stub._set_delegate(delegate);
+ return stub;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneHolder.java
new file mode 100644
index 0000000000..f14394b400
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneHolder.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.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioOneHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class ScenarioOneHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.ScenarioOne value = null;
+
+ public ScenarioOneHolder ()
+ {
+ }
+
+ public ScenarioOneHolder (org.apache.tuscany.sca.test.corba.generated.ScenarioOne initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.ScenarioOneHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.ScenarioOneHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.ScenarioOneHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneOperations.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneOperations.java
new file mode 100644
index 0000000000..56388624d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioOneOperations.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioOneOperations.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public interface ScenarioOneOperations
+{
+ org.apache.tuscany.sca.test.corba.generated.RichStruct setRichStruct (org.apache.tuscany.sca.test.corba.generated.RichStruct richStruct) throws org.apache.tuscany.sca.test.corba.generated.WrongColor, org.apache.tuscany.sca.test.corba.generated.UnexpectedException;
+} // interface ScenarioOneOperations
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSix.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSix.java
new file mode 100644
index 0000000000..1897d0682c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSix.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioSix.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* sobota, 16 sierpieñ 2008 15:31:35 CEST
+*/
+
+public interface ScenarioSix extends ScenarioSixOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
+{
+} // interface ScenarioSix
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixHelper.java
new file mode 100644
index 0000000000..c8c88ef91d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixHelper.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioSixHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* sobota, 16 sierpieñ 2008 15:31:35 CEST
+*/
+
+abstract public class ScenarioSixHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioSix:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.ScenarioSix that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioSix extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.apache.tuscany.sca.test.corba.generated.ScenarioSixHelper.id (), "ScenarioSix");
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioSix read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return narrow (istream.read_Object (_ScenarioSixStub.class));
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.ScenarioSix value)
+ {
+ ostream.write_Object ((org.omg.CORBA.Object) value);
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioSix narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.apache.tuscany.sca.test.corba.generated.ScenarioSix)
+ return (org.apache.tuscany.sca.test.corba.generated.ScenarioSix)obj;
+ else if (!obj._is_a (id ()))
+ throw new org.omg.CORBA.BAD_PARAM ();
+ else
+ {
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
+ org.apache.tuscany.sca.test.corba.generated._ScenarioSixStub stub = new org.apache.tuscany.sca.test.corba.generated._ScenarioSixStub ();
+ stub._set_delegate(delegate);
+ return stub;
+ }
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioSix unchecked_narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.apache.tuscany.sca.test.corba.generated.ScenarioSix)
+ return (org.apache.tuscany.sca.test.corba.generated.ScenarioSix)obj;
+ else
+ {
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
+ org.apache.tuscany.sca.test.corba.generated._ScenarioSixStub stub = new org.apache.tuscany.sca.test.corba.generated._ScenarioSixStub ();
+ stub._set_delegate(delegate);
+ return stub;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixHolder.java
new file mode 100644
index 0000000000..5540b98c21
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixHolder.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.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioSixHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* sobota, 16 sierpieñ 2008 15:31:35 CEST
+*/
+
+public final class ScenarioSixHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.ScenarioSix value = null;
+
+ public ScenarioSixHolder ()
+ {
+ }
+
+ public ScenarioSixHolder (org.apache.tuscany.sca.test.corba.generated.ScenarioSix initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.ScenarioSixHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.ScenarioSixHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.ScenarioSixHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixOperations.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixOperations.java
new file mode 100644
index 0000000000..648144299c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioSixOperations.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioSixOperations.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* niedziela, 17 sierpieñ 2008 19:07:14 CEST
+*/
+
+public interface ScenarioSixOperations
+{
+ String[][] passStringArray (String[][] arg);
+ org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct passAnnotatedStruct (org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct arg);
+ org.apache.tuscany.sca.test.corba.generated.RichUnion passRichUnion (org.apache.tuscany.sca.test.corba.generated.RichUnion arg);
+} // interface ScenarioSixOperations
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java
new file mode 100644
index 0000000000..b57e098a56
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioTwo.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* wtorek, 15 lipiec 2008 13:36:31 CEST
+*/
+
+
+// objects for ScenarioTwo
+public interface ScenarioTwo extends ScenarioTwoOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
+{
+} // interface ScenarioTwo
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java
new file mode 100644
index 0000000000..8ddfa10575
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* wtorek, 15 lipiec 2008 13:36:31 CEST
+*/
+
+
+// objects for ScenarioTwo
+abstract public class ScenarioTwoHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioTwo:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.ScenarioTwo that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioTwo extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.apache.tuscany.sca.test.corba.generated.ScenarioTwoHelper.id (), "ScenarioTwo");
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioTwo read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return narrow (istream.read_Object (_ScenarioTwoStub.class));
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.ScenarioTwo value)
+ {
+ ostream.write_Object ((org.omg.CORBA.Object) value);
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioTwo narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.apache.tuscany.sca.test.corba.generated.ScenarioTwo)
+ return (org.apache.tuscany.sca.test.corba.generated.ScenarioTwo)obj;
+ else if (!obj._is_a (id ()))
+ throw new org.omg.CORBA.BAD_PARAM ();
+ else
+ {
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
+ org.apache.tuscany.sca.test.corba.generated._ScenarioTwoStub stub = new org.apache.tuscany.sca.test.corba.generated._ScenarioTwoStub ();
+ stub._set_delegate(delegate);
+ return stub;
+ }
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.ScenarioTwo unchecked_narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.apache.tuscany.sca.test.corba.generated.ScenarioTwo)
+ return (org.apache.tuscany.sca.test.corba.generated.ScenarioTwo)obj;
+ else
+ {
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
+ org.apache.tuscany.sca.test.corba.generated._ScenarioTwoStub stub = new org.apache.tuscany.sca.test.corba.generated._ScenarioTwoStub ();
+ stub._set_delegate(delegate);
+ return stub;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java
new file mode 100644
index 0000000000..9717629711
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.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.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioTwoHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* wtorek, 15 lipiec 2008 13:36:31 CEST
+*/
+
+
+// objects for ScenarioTwo
+public final class ScenarioTwoHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.ScenarioTwo value = null;
+
+ public ScenarioTwoHolder ()
+ {
+ }
+
+ public ScenarioTwoHolder (org.apache.tuscany.sca.test.corba.generated.ScenarioTwo initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.ScenarioTwoHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.ScenarioTwoHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.ScenarioTwoHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java
new file mode 100644
index 0000000000..1247b4618d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/ScenarioTwoOperations.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* wtorek, 15 lipiec 2008 13:36:31 CEST
+*/
+
+
+// objects for ScenarioTwo
+public interface ScenarioTwoOperations
+{
+ String stringField ();
+ void stringField (String newStringField);
+} // interface ScenarioTwoOperations
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringArrayHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringArrayHelper.java
new file mode 100644
index 0000000000..f2cc3adad5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringArrayHelper.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/StringArrayHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* sobota, 16 sierpieñ 2008 15:31:35 CEST
+*/
+
+abstract public class StringArrayHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/StringArray:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, String[][] that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static String[][] extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0);
+ __typeCode = org.omg.CORBA.ORB.init ().create_array_tc (2, __typeCode );
+ __typeCode = org.omg.CORBA.ORB.init ().create_array_tc (2, __typeCode );
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.id (), "StringArray", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String[][] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value[][] = null;
+ value = new String[2][];
+ for (int _o0 = 0;_o0 < (2); ++_o0)
+ {
+ value[_o0] = new String[2];
+ for (int _o1 = 0;_o1 < (2); ++_o1)
+ {
+ value[_o0][_o1] = istream.read_string ();
+ }
+ }
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String[][] value)
+ {
+ if (value.length != (2))
+ throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ for (int _i0 = 0;_i0 < (2); ++_i0)
+ {
+ if (value[_i0].length != (2))
+ throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ for (int _i1 = 0;_i1 < (2); ++_i1)
+ {
+ ostream.write_string (value[_i0][_i1]);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringArrayHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringArrayHolder.java
new file mode 100644
index 0000000000..dbad550222
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringArrayHolder.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/StringArrayHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* sobota, 16 sierpieñ 2008 15:31:35 CEST
+*/
+
+public final class StringArrayHolder implements org.omg.CORBA.portable.Streamable
+{
+ public String value[][] = null;
+
+ public StringArrayHolder ()
+ {
+ }
+
+ public StringArrayHolder (String[][] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringSequenceHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringSequenceHelper.java
new file mode 100644
index 0000000000..d29129236c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringSequenceHelper.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/StringSequenceHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+abstract public class StringSequenceHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/StringSequence:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, String[] that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static String[] extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.test.corba.generated.StringSequenceHelper.id (), "StringSequence", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value[] = null;
+ int _len0 = istream.read_long ();
+ value = new String[_len0];
+ for (int _o1 = 0;_o1 < value.length; ++_o1)
+ value[_o1] = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String[] value)
+ {
+ ostream.write_long (value.length);
+ for (int _i0 = 0;_i0 < value.length; ++_i0)
+ ostream.write_string (value[_i0]);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringSequenceHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringSequenceHolder.java
new file mode 100644
index 0000000000..837ba04cea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/StringSequenceHolder.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/StringSequenceHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class StringSequenceHolder implements org.omg.CORBA.portable.Streamable
+{
+ public String value[] = null;
+
+ public StringSequenceHolder ()
+ {
+ }
+
+ public StringSequenceHolder (String[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.StringSequenceHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.StringSequenceHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.StringSequenceHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHelper.java
new file mode 100644
index 0000000000..0b24056642
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHelper.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+abstract public class TwoDimLongSequenceHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequence:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, int[][] that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static int[][] extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.test.corba.generated.LongSequenceHelper.id (), "LongSequence", __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.test.corba.generated.TwoDimLongSequenceHelper.id (), "TwoDimLongSequence", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static int[][] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ int value[][] = null;
+ int _len0 = istream.read_long ();
+ value = new int[_len0][];
+ for (int _o1 = 0;_o1 < value.length; ++_o1)
+ value[_o1] = org.apache.tuscany.sca.test.corba.generated.LongSequenceHelper.read (istream);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, int[][] value)
+ {
+ ostream.write_long (value.length);
+ for (int _i0 = 0;_i0 < value.length; ++_i0)
+ org.apache.tuscany.sca.test.corba.generated.LongSequenceHelper.write (ostream, value[_i0]);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHolder.java
new file mode 100644
index 0000000000..e2ed1ab037
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHolder.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/TwoDimLongSequenceHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class TwoDimLongSequenceHolder implements org.omg.CORBA.portable.Streamable
+{
+ public int value[][] = null;
+
+ public TwoDimLongSequenceHolder ()
+ {
+ }
+
+ public TwoDimLongSequenceHolder (int[][] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.TwoDimLongSequenceHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.TwoDimLongSequenceHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.TwoDimLongSequenceHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedException.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedException.java
new file mode 100644
index 0000000000..46888399ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedException.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/UnexpectedException.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class UnexpectedException extends org.omg.CORBA.UserException
+{
+ public String info = null;
+
+ public UnexpectedException ()
+ {
+ super(UnexpectedExceptionHelper.id());
+ } // ctor
+
+ public UnexpectedException (String _info)
+ {
+ super(UnexpectedExceptionHelper.id());
+ info = _info;
+ } // ctor
+
+
+ public UnexpectedException (String $reason, String _info)
+ {
+ super(UnexpectedExceptionHelper.id() + " " + $reason);
+ info = _info;
+ } // ctor
+
+} // class UnexpectedException
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHelper.java
new file mode 100644
index 0000000000..c276038050
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHelper.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+abstract public class UnexpectedExceptionHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/UnexpectedException:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.UnexpectedException that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.UnexpectedException extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ private static boolean __active = false;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ synchronized (org.omg.CORBA.TypeCode.class)
+ {
+ if (__typeCode == null)
+ {
+ if (__active)
+ {
+ return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
+ }
+ __active = true;
+ org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [1];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
+ _members0[0] = new org.omg.CORBA.StructMember (
+ "info",
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.apache.tuscany.sca.test.corba.generated.UnexpectedExceptionHelper.id (), "UnexpectedException", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.UnexpectedException read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.apache.tuscany.sca.test.corba.generated.UnexpectedException value = new org.apache.tuscany.sca.test.corba.generated.UnexpectedException ();
+ // read and discard the repository ID
+ istream.read_string ();
+ value.info = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.UnexpectedException value)
+ {
+ // write the repository ID
+ ostream.write_string (id ());
+ ostream.write_string (value.info);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHolder.java
new file mode 100644
index 0000000000..079a56b446
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHolder.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.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/UnexpectedExceptionHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class UnexpectedExceptionHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.UnexpectedException value = null;
+
+ public UnexpectedExceptionHolder ()
+ {
+ }
+
+ public UnexpectedExceptionHolder (org.apache.tuscany.sca.test.corba.generated.UnexpectedException initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.UnexpectedExceptionHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.UnexpectedExceptionHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.UnexpectedExceptionHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColor.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColor.java
new file mode 100644
index 0000000000..0407184598
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColor.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/WrongColor.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class WrongColor extends org.omg.CORBA.UserException
+{
+ public org.apache.tuscany.sca.test.corba.generated.Color givenColor = null;
+ public org.apache.tuscany.sca.test.corba.generated.Color correctColor = null;
+
+ public WrongColor ()
+ {
+ super(WrongColorHelper.id());
+ } // ctor
+
+ public WrongColor (org.apache.tuscany.sca.test.corba.generated.Color _givenColor, org.apache.tuscany.sca.test.corba.generated.Color _correctColor)
+ {
+ super(WrongColorHelper.id());
+ givenColor = _givenColor;
+ correctColor = _correctColor;
+ } // ctor
+
+
+ public WrongColor (String $reason, org.apache.tuscany.sca.test.corba.generated.Color _givenColor, org.apache.tuscany.sca.test.corba.generated.Color _correctColor)
+ {
+ super(WrongColorHelper.id() + " " + $reason);
+ givenColor = _givenColor;
+ correctColor = _correctColor;
+ } // ctor
+
+} // class WrongColor
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColorHelper.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColorHelper.java
new file mode 100644
index 0000000000..16e099cfa3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColorHelper.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/WrongColorHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+abstract public class WrongColorHelper
+{
+ private static String _id = "IDL:org/apache/tuscany/sca/test/corba/generated/WrongColor:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.test.corba.generated.WrongColor that)
+ {
+ org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+ a.type (type ());
+ write (out, that);
+ a.read_value (out.create_input_stream (), type ());
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.WrongColor extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ private static boolean __active = false;
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ synchronized (org.omg.CORBA.TypeCode.class)
+ {
+ if (__typeCode == null)
+ {
+ if (__active)
+ {
+ return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
+ }
+ __active = true;
+ org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [2];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ _tcOf_members0 = org.apache.tuscany.sca.test.corba.generated.ColorHelper.type ();
+ _members0[0] = new org.omg.CORBA.StructMember (
+ "givenColor",
+ _tcOf_members0,
+ null);
+ _tcOf_members0 = org.apache.tuscany.sca.test.corba.generated.ColorHelper.type ();
+ _members0[1] = new org.omg.CORBA.StructMember (
+ "correctColor",
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.apache.tuscany.sca.test.corba.generated.WrongColorHelper.id (), "WrongColor", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.apache.tuscany.sca.test.corba.generated.WrongColor read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.apache.tuscany.sca.test.corba.generated.WrongColor value = new org.apache.tuscany.sca.test.corba.generated.WrongColor ();
+ // read and discard the repository ID
+ istream.read_string ();
+ value.givenColor = org.apache.tuscany.sca.test.corba.generated.ColorHelper.read (istream);
+ value.correctColor = org.apache.tuscany.sca.test.corba.generated.ColorHelper.read (istream);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.test.corba.generated.WrongColor value)
+ {
+ // write the repository ID
+ ostream.write_string (id ());
+ org.apache.tuscany.sca.test.corba.generated.ColorHelper.write (ostream, value.givenColor);
+ org.apache.tuscany.sca.test.corba.generated.ColorHelper.write (ostream, value.correctColor);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColorHolder.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColorHolder.java
new file mode 100644
index 0000000000..b4883cb35c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/WrongColorHolder.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.corba.generated;
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/WrongColorHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public final class WrongColorHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.apache.tuscany.sca.test.corba.generated.WrongColor value = null;
+
+ public WrongColorHolder ()
+ {
+ }
+
+ public WrongColorHolder (org.apache.tuscany.sca.test.corba.generated.WrongColor initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.apache.tuscany.sca.test.corba.generated.WrongColorHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.apache.tuscany.sca.test.corba.generated.WrongColorHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.apache.tuscany.sca.test.corba.generated.WrongColorHelper.type ();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioOneImplBase.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioOneImplBase.java
new file mode 100644
index 0000000000..c96fb61204
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioOneImplBase.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/_ScenarioOneImplBase.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public abstract class _ScenarioOneImplBase extends org.omg.CORBA.portable.ObjectImpl
+ implements org.apache.tuscany.sca.test.corba.generated.ScenarioOne, org.omg.CORBA.portable.InvokeHandler
+{
+
+ // Constructors
+ public _ScenarioOneImplBase ()
+ {
+ }
+
+ private static java.util.Hashtable _methods = new java.util.Hashtable ();
+ static
+ {
+ _methods.put ("setRichStruct", new java.lang.Integer (0));
+ }
+
+ public org.omg.CORBA.portable.OutputStream _invoke (String $method,
+ org.omg.CORBA.portable.InputStream in,
+ org.omg.CORBA.portable.ResponseHandler $rh)
+ {
+ org.omg.CORBA.portable.OutputStream out = null;
+ java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
+ if (__method == null)
+ throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+
+ switch (__method.intValue ())
+ {
+ case 0: // org/apache/tuscany/sca/test/corba/generated/ScenarioOne/setRichStruct
+ {
+ try {
+ org.apache.tuscany.sca.test.corba.generated.RichStruct richStruct = org.apache.tuscany.sca.test.corba.generated.RichStructHelper.read (in);
+ org.apache.tuscany.sca.test.corba.generated.RichStruct $result = null;
+ $result = this.setRichStruct (richStruct);
+ out = $rh.createReply();
+ org.apache.tuscany.sca.test.corba.generated.RichStructHelper.write (out, $result);
+ } catch (org.apache.tuscany.sca.test.corba.generated.WrongColor $ex) {
+ out = $rh.createExceptionReply ();
+ org.apache.tuscany.sca.test.corba.generated.WrongColorHelper.write (out, $ex);
+ } catch (org.apache.tuscany.sca.test.corba.generated.UnexpectedException $ex) {
+ out = $rh.createExceptionReply ();
+ org.apache.tuscany.sca.test.corba.generated.UnexpectedExceptionHelper.write (out, $ex);
+ }
+ break;
+ }
+
+ default:
+ throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ return out;
+ } // _invoke
+
+ // Type-specific CORBA::Object operations
+ private static String[] __ids = {
+ "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioOne:1.0"};
+
+ public String[] _ids ()
+ {
+ return (String[])__ids.clone ();
+ }
+
+
+} // class _ScenarioOneImplBase
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioOneStub.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioOneStub.java
new file mode 100644
index 0000000000..3427c127ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioOneStub.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.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/_ScenarioOneStub.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* pi±tek, 27 czerwiec 2008 20:40:03 CEST
+*/
+
+public class _ScenarioOneStub extends org.omg.CORBA.portable.ObjectImpl implements org.apache.tuscany.sca.test.corba.generated.ScenarioOne
+{
+
+ public org.apache.tuscany.sca.test.corba.generated.RichStruct setRichStruct (org.apache.tuscany.sca.test.corba.generated.RichStruct richStruct) throws org.apache.tuscany.sca.test.corba.generated.WrongColor, org.apache.tuscany.sca.test.corba.generated.UnexpectedException
+ {
+ org.omg.CORBA.portable.InputStream $in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream $out = _request ("setRichStruct", true);
+ org.apache.tuscany.sca.test.corba.generated.RichStructHelper.write ($out, richStruct);
+ $in = _invoke ($out);
+ org.apache.tuscany.sca.test.corba.generated.RichStruct $result = org.apache.tuscany.sca.test.corba.generated.RichStructHelper.read ($in);
+ return $result;
+ } catch (org.omg.CORBA.portable.ApplicationException $ex) {
+ $in = $ex.getInputStream ();
+ String _id = $ex.getId ();
+ if (_id.equals ("IDL:org/apache/tuscany/sca/test/corba/generated/WrongColor:1.0"))
+ throw org.apache.tuscany.sca.test.corba.generated.WrongColorHelper.read ($in);
+ else if (_id.equals ("IDL:org/apache/tuscany/sca/test/corba/generated/UnexpectedException:1.0"))
+ throw org.apache.tuscany.sca.test.corba.generated.UnexpectedExceptionHelper.read ($in);
+ else
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException $rm) {
+ return setRichStruct (richStruct );
+ } finally {
+ _releaseReply ($in);
+ }
+ } // setRichStruct
+
+ // Type-specific CORBA::Object operations
+ private static String[] __ids = {
+ "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioOne:1.0"};
+
+ public String[] _ids ()
+ {
+ return (String[])__ids.clone ();
+ }
+
+ private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
+ {
+ String str = s.readUTF ();
+ String[] args = null;
+ java.util.Properties props = null;
+ org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
+ _set_delegate (delegate);
+ }
+
+ private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
+ {
+ String[] args = null;
+ java.util.Properties props = null;
+ String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
+ s.writeUTF (str);
+ }
+} // class _ScenarioOneStub
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioSixImplBase.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioSixImplBase.java
new file mode 100644
index 0000000000..78464fe40d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioSixImplBase.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/_ScenarioSixImplBase.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* niedziela, 17 sierpieñ 2008 23:35:36 CEST
+*/
+
+public abstract class _ScenarioSixImplBase extends org.omg.CORBA.portable.ObjectImpl
+ implements org.apache.tuscany.sca.test.corba.generated.ScenarioSix, org.omg.CORBA.portable.InvokeHandler
+{
+
+ // Constructors
+ public _ScenarioSixImplBase ()
+ {
+ }
+
+ private static java.util.Hashtable _methods = new java.util.Hashtable ();
+ static
+ {
+ _methods.put ("passStringArray", new java.lang.Integer (0));
+ _methods.put ("passAnnotatedStruct", new java.lang.Integer (1));
+ _methods.put ("passRichUnion", new java.lang.Integer (2));
+ }
+
+ public org.omg.CORBA.portable.OutputStream _invoke (String $method,
+ org.omg.CORBA.portable.InputStream in,
+ org.omg.CORBA.portable.ResponseHandler $rh)
+ {
+ org.omg.CORBA.portable.OutputStream out = null;
+ java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
+ if (__method == null)
+ throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+
+ switch (__method.intValue ())
+ {
+ case 0: // org/apache/tuscany/sca/test/corba/generated/ScenarioSix/passStringArray
+ {
+ String arg[][] = org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.read (in);
+ String $result[][] = null;
+ $result = this.passStringArray (arg);
+ out = $rh.createReply();
+ org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.write (out, $result);
+ break;
+ }
+
+ case 1: // org/apache/tuscany/sca/test/corba/generated/ScenarioSix/passAnnotatedStruct
+ {
+ org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct arg = org.apache.tuscany.sca.test.corba.generated.AnnotatedStructHelper.read (in);
+ org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct $result = null;
+ $result = this.passAnnotatedStruct (arg);
+ out = $rh.createReply();
+ org.apache.tuscany.sca.test.corba.generated.AnnotatedStructHelper.write (out, $result);
+ break;
+ }
+
+ case 2: // org/apache/tuscany/sca/test/corba/generated/ScenarioSix/passRichUnion
+ {
+ org.apache.tuscany.sca.test.corba.generated.RichUnion arg = org.apache.tuscany.sca.test.corba.generated.RichUnionHelper.read (in);
+ org.apache.tuscany.sca.test.corba.generated.RichUnion $result = null;
+ $result = this.passRichUnion (arg);
+ out = $rh.createReply();
+ org.apache.tuscany.sca.test.corba.generated.RichUnionHelper.write (out, $result);
+ break;
+ }
+
+ default:
+ throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ return out;
+ } // _invoke
+
+ // Type-specific CORBA::Object operations
+ private static String[] __ids = {
+ "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioSix:1.0"};
+
+ public String[] _ids ()
+ {
+ return (String[])__ids.clone ();
+ }
+
+
+} // class _ScenarioSixImplBase
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioSixStub.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioSixStub.java
new file mode 100644
index 0000000000..faff36c2a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioSixStub.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/_ScenarioSixStub.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* niedziela, 17 sierpieñ 2008 19:07:14 CEST
+*/
+
+public class _ScenarioSixStub extends org.omg.CORBA.portable.ObjectImpl implements org.apache.tuscany.sca.test.corba.generated.ScenarioSix
+{
+
+ public String[][] passStringArray (String[][] arg)
+ {
+ org.omg.CORBA.portable.InputStream $in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream $out = _request ("passStringArray", true);
+ org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.write ($out, arg);
+ $in = _invoke ($out);
+ String $result[][] = org.apache.tuscany.sca.test.corba.generated.StringArrayHelper.read ($in);
+ return $result;
+ } catch (org.omg.CORBA.portable.ApplicationException $ex) {
+ $in = $ex.getInputStream ();
+ String _id = $ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException $rm) {
+ return passStringArray (arg );
+ } finally {
+ _releaseReply ($in);
+ }
+ } // passStringArray
+
+ public org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct passAnnotatedStruct (org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct arg)
+ {
+ org.omg.CORBA.portable.InputStream $in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream $out = _request ("passAnnotatedStruct", true);
+ org.apache.tuscany.sca.test.corba.generated.AnnotatedStructHelper.write ($out, arg);
+ $in = _invoke ($out);
+ org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct $result = org.apache.tuscany.sca.test.corba.generated.AnnotatedStructHelper.read ($in);
+ return $result;
+ } catch (org.omg.CORBA.portable.ApplicationException $ex) {
+ $in = $ex.getInputStream ();
+ String _id = $ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException $rm) {
+ return passAnnotatedStruct (arg );
+ } finally {
+ _releaseReply ($in);
+ }
+ } // passAnnotatedStruct
+
+ public org.apache.tuscany.sca.test.corba.generated.RichUnion passRichUnion (org.apache.tuscany.sca.test.corba.generated.RichUnion arg)
+ {
+ org.omg.CORBA.portable.InputStream $in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream $out = _request ("passRichUnion", true);
+ org.apache.tuscany.sca.test.corba.generated.RichUnionHelper.write ($out, arg);
+ $in = _invoke ($out);
+ org.apache.tuscany.sca.test.corba.generated.RichUnion $result = org.apache.tuscany.sca.test.corba.generated.RichUnionHelper.read ($in);
+ return $result;
+ } catch (org.omg.CORBA.portable.ApplicationException $ex) {
+ $in = $ex.getInputStream ();
+ String _id = $ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException $rm) {
+ return passRichUnion (arg );
+ } finally {
+ _releaseReply ($in);
+ }
+ } // passRichUnion
+
+ // Type-specific CORBA::Object operations
+ private static String[] __ids = {
+ "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioSix:1.0"};
+
+ public String[] _ids ()
+ {
+ return (String[])__ids.clone ();
+ }
+
+ private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
+ {
+ String str = s.readUTF ();
+ String[] args = null;
+ java.util.Properties props = null;
+ org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
+ _set_delegate (delegate);
+ }
+
+ private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
+ {
+ String[] args = null;
+ java.util.Properties props = null;
+ String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
+ s.writeUTF (str);
+ }
+} // class _ScenarioSixStub
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java
new file mode 100644
index 0000000000..750006cec6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoImplBase.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* wtorek, 15 lipiec 2008 13:36:31 CEST
+*/
+
+
+// objects for ScenarioTwo
+public abstract class _ScenarioTwoImplBase extends org.omg.CORBA.portable.ObjectImpl
+ implements org.apache.tuscany.sca.test.corba.generated.ScenarioTwo, org.omg.CORBA.portable.InvokeHandler
+{
+
+ // Constructors
+ public _ScenarioTwoImplBase ()
+ {
+ }
+
+ private static java.util.Hashtable _methods = new java.util.Hashtable ();
+ static
+ {
+ _methods.put ("_get_stringField", new java.lang.Integer (0));
+ _methods.put ("_set_stringField", new java.lang.Integer (1));
+ }
+
+ public org.omg.CORBA.portable.OutputStream _invoke (String $method,
+ org.omg.CORBA.portable.InputStream in,
+ org.omg.CORBA.portable.ResponseHandler $rh)
+ {
+ org.omg.CORBA.portable.OutputStream out = null;
+ java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
+ if (__method == null)
+ throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+
+ switch (__method.intValue ())
+ {
+ case 0: // org/apache/tuscany/sca/test/corba/generated/ScenarioTwo/_get_stringField
+ {
+ String $result = null;
+ $result = this.stringField ();
+ out = $rh.createReply();
+ out.write_string ($result);
+ break;
+ }
+
+ case 1: // org/apache/tuscany/sca/test/corba/generated/ScenarioTwo/_set_stringField
+ {
+ String newStringField = in.read_string ();
+ this.stringField (newStringField);
+ out = $rh.createReply();
+ break;
+ }
+
+ default:
+ throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ return out;
+ } // _invoke
+
+ // Type-specific CORBA::Object operations
+ private static String[] __ids = {
+ "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioTwo:1.0"};
+
+ public String[] _ids ()
+ {
+ return (String[])__ids.clone ();
+ }
+
+
+} // class _ScenarioTwoImplBase
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.java
new file mode 100644
index 0000000000..ef9f561d1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.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.test.corba.generated;
+
+
+/**
+* org/apache/tuscany/sca/test/corba/generated/_ScenarioTwoStub.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from itest_scenario.idl
+* wtorek, 15 lipiec 2008 13:36:31 CEST
+*/
+
+
+// objects for ScenarioTwo
+public class _ScenarioTwoStub extends org.omg.CORBA.portable.ObjectImpl implements org.apache.tuscany.sca.test.corba.generated.ScenarioTwo
+{
+
+ public String stringField ()
+ {
+ org.omg.CORBA.portable.InputStream $in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream $out = _request ("_get_stringField", true);
+ $in = _invoke ($out);
+ String $result = $in.read_string ();
+ return $result;
+ } catch (org.omg.CORBA.portable.ApplicationException $ex) {
+ $in = $ex.getInputStream ();
+ String _id = $ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException $rm) {
+ return stringField ( );
+ } finally {
+ _releaseReply ($in);
+ }
+ } // stringField
+
+ public void stringField (String newStringField)
+ {
+ org.omg.CORBA.portable.InputStream $in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream $out = _request ("_set_stringField", true);
+ $out.write_string (newStringField);
+ $in = _invoke ($out);
+ return;
+ } catch (org.omg.CORBA.portable.ApplicationException $ex) {
+ $in = $ex.getInputStream ();
+ String _id = $ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException $rm) {
+ stringField (newStringField );
+ } finally {
+ _releaseReply ($in);
+ }
+ } // stringField
+
+ // Type-specific CORBA::Object operations
+ private static String[] __ids = {
+ "IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioTwo:1.0"};
+
+ public String[] _ids ()
+ {
+ return (String[])__ids.clone ();
+ }
+
+ private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
+ {
+ String str = s.readUTF ();
+ String[] args = null;
+ java.util.Properties props = null;
+ org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
+ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
+ _set_delegate (delegate);
+ }
+
+ private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
+ {
+ String[] args = null;
+ java.util.Properties props = null;
+ String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
+ s.writeUTF (str);
+ }
+} // class _ScenarioTwoStub
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFive.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFive.java
new file mode 100644
index 0000000000..4f6eacc9ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFive.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.corba.types;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ * Operations for scenario five
+ */
+@Remotable
+public interface ScenarioFive {
+
+ void doNothing();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveComponent.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveComponent.java
new file mode 100644
index 0000000000..a3be6daa23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveComponent.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.corba.types;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ * Component for obtaining ScenarioFive reference
+ */
+public class ScenarioFiveComponent {
+
+ private ScenarioFive scenarioFive;
+
+ @Reference
+ public void setScenarioFive(ScenarioFive scenarioFive) {
+ this.scenarioFive = scenarioFive;
+ }
+
+ public ScenarioFive getScenarioFive() {
+ return scenarioFive;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveImpl.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveImpl.java
new file mode 100644
index 0000000000..dc752a2aea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveImpl.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.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * Implementation of ScenarioFive service
+ */
+public class ScenarioFiveImpl implements ScenarioFive {
+
+ public void doNothing() {
+ // does nothing
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFour.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFour.java
new file mode 100644
index 0000000000..aec0f7b1bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFour.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.corba.types;
+
+import org.apache.tuscany.sca.test.corba.scenariofour.ScenarioFourSdo;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ * Operations for ScenarioFour
+ */
+@Remotable
+public interface ScenarioFour {
+
+ ScenarioFourStruct setStruct(ScenarioFourStruct struct);
+
+ void exceptionTest() throws ScenarioFourException;
+
+ ScenarioFourSdo passScenarioFourStruct(ScenarioFourSdo scenarioFourSdo);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourComponent.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourComponent.java
new file mode 100644
index 0000000000..04aef326af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourComponent.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.corba.types;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ * Component for obtaining ScenarioFour reference
+ */
+public class ScenarioFourComponent {
+
+ private ScenarioFour scenarioFour;
+
+ @Reference
+ public void setScenarioFour(ScenarioFour scenarioFour) {
+ this.scenarioFour = scenarioFour;
+ }
+
+ public ScenarioFour getScenarioFour() {
+ return scenarioFour;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourException.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourException.java
new file mode 100644
index 0000000000..bc76373633
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourException.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.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * Exception for ScenarioFour tests
+ */
+public class ScenarioFourException extends Exception {
+
+ public static final String DEFAULT_CONTENT = "Test";
+
+ private static final long serialVersionUID = 1L;
+ private String content;
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourImpl.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourImpl.java
new file mode 100644
index 0000000000..2f10177bd0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourImpl.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.corba.types;
+
+import org.apache.tuscany.sca.test.corba.scenariofour.ScenarioFourSdo;
+
+/**
+ * @version $Rev$ $Date$
+ * Implementation of ScenarioFour service
+ */
+public class ScenarioFourImpl implements ScenarioFour {
+
+ public ScenarioFourStruct setStruct(ScenarioFourStruct struct) {
+ return struct;
+ }
+
+ public void exceptionTest() throws ScenarioFourException {
+ ScenarioFourException exception = new ScenarioFourException();
+ exception.setContent(ScenarioFourException.DEFAULT_CONTENT);
+ throw exception;
+ }
+
+ public ScenarioFourSdo passScenarioFourStruct(ScenarioFourSdo scenarioFourSdo) {
+ return scenarioFourSdo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourStruct.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourStruct.java
new file mode 100644
index 0000000000..de8624455f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourStruct.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.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * Type for ScenarioFour test
+ */
+public class ScenarioFourStruct {
+
+ public String field1;
+ public int field2;
+ public double[] field3;
+
+ public boolean equals(ScenarioFourStruct arg) {
+ return (field1 != null && arg.field1 != null
+ && field1.equals(arg.field1)
+ && field2 == arg.field2
+ && field3 != null
+ && arg.field3 != null && field3.length == arg.field3.length);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioOneComponent.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioOneComponent.java
new file mode 100644
index 0000000000..30e4e2994a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioOneComponent.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.corba.types;
+
+import org.apache.tuscany.sca.test.corba.generated.RichStruct;
+import org.apache.tuscany.sca.test.corba.generated.ScenarioOne;
+import org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations;
+import org.apache.tuscany.sca.test.corba.generated.UnexpectedException;
+import org.apache.tuscany.sca.test.corba.generated.WrongColor;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ * Component for reference using generated interface.
+ */
+public class ScenarioOneComponent implements ScenarioOneOperations {
+
+ private ScenarioOne scenarionOne;
+
+ @Reference
+ public void setScenarioOne(ScenarioOne scenarioOne) {
+ this.scenarionOne = scenarioOne;
+ }
+
+ public RichStruct setRichStruct(RichStruct richStruct) throws WrongColor, UnexpectedException {
+ return scenarionOne.setRichStruct(richStruct);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioOneServant.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioOneServant.java
new file mode 100644
index 0000000000..9b49adbfbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioOneServant.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.corba.types;
+
+import org.apache.tuscany.sca.test.corba.generated.Color;
+import org.apache.tuscany.sca.test.corba.generated.RichStruct;
+import org.apache.tuscany.sca.test.corba.generated.UnexpectedException;
+import org.apache.tuscany.sca.test.corba.generated.WrongColor;
+import org.apache.tuscany.sca.test.corba.generated._ScenarioOneImplBase;
+
+/**
+ * @version $Rev$ $Date$
+ * Servant for generated interface. Uses generated classes.
+ */
+public class ScenarioOneServant extends _ScenarioOneImplBase {
+
+ private static final long serialVersionUID = 1L;
+
+ public RichStruct setRichStruct(RichStruct richStruct) throws WrongColor, UnexpectedException {
+ if (richStruct.innerStruct.color.value() == Color.red.value()) {
+ throw new WrongColor(richStruct.innerStruct.color, Color.green);
+ } else if (richStruct.longField == 0) {
+ throw new UnexpectedException("Expected richStruct.longField != 0");
+ }
+ return richStruct;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioSixServant.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioSixServant.java
new file mode 100644
index 0000000000..7889a80bf1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioSixServant.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.corba.types;
+
+import org.apache.tuscany.sca.test.corba.generated.AnnotatedStruct;
+import org.apache.tuscany.sca.test.corba.generated.RichUnion;
+import org.apache.tuscany.sca.test.corba.generated._ScenarioSixImplBase;
+
+/**
+ * @version $Rev$ $Date$
+ * Scenario six servant for generated interface.
+ */
+public class ScenarioSixServant extends _ScenarioSixImplBase {
+
+ private static final long serialVersionUID = 1L;
+
+ public String[][] passStringArray(String[][] arg) {
+ return arg;
+ }
+
+ public AnnotatedStruct passAnnotatedStruct(AnnotatedStruct arg) {
+ return arg;
+ }
+
+ public RichUnion passRichUnion(RichUnion arg) {
+ return arg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioTwoServant.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioTwoServant.java
new file mode 100644
index 0000000000..cdd49904d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioTwoServant.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.corba.types;
+
+import org.apache.tuscany.sca.test.corba.generated._ScenarioTwoImplBase;
+
+/**
+ * @version $Rev$ $Date$
+ * Servant for generated interface.
+ */
+public class ScenarioTwoServant extends _ScenarioTwoImplBase {
+
+ private static final long serialVersionUID = 1L;
+
+ private String stringField = "";
+
+ public String stringField() {
+ return stringField;
+ }
+
+ public void stringField(String newStringField) {
+ this.stringField = newStringField;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TAnnotatedStruct.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TAnnotatedStruct.java
new file mode 100644
index 0000000000..adb48aa159
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TAnnotatedStruct.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.corba.types;
+
+import org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
+
+/**
+ * @version $Rev$ $Date$ Scenario six structure used by Tuscany.
+ */
+public final class TAnnotatedStruct {
+
+ @CorbaArray( {2, 2})
+ public String[][] stringArray;
+
+ public TAnnotatedStruct() {
+
+ }
+
+ public TAnnotatedStruct(String[][] stringArray) {
+ this.stringArray = stringArray;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TColor.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TColor.java
new file mode 100644
index 0000000000..71003d008f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TColor.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.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * User provided enum representation for Color type.
+ */
+public class TColor {
+
+ private int value;
+
+ public static final int _red = 0;
+ public static final int _yellow = 1;
+ public static final int _green = 2;
+
+ public static final TColor red = new TColor(_red);
+ public static final TColor yellow = new TColor(_yellow);
+ public static final TColor green = new TColor(_green);
+
+ public int value() {
+ return value;
+ }
+
+ public static TColor from_int(int value) {
+ switch (value) {
+ case 0:
+ return red;
+ case 1:
+ return yellow;
+ case 2:
+ return green;
+ }
+ return green;
+ }
+
+ protected TColor(int value) {
+ this.value = value;
+ }
+
+ public TColor() {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TInnerStruct.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TInnerStruct.java
new file mode 100644
index 0000000000..271f1e669b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TInnerStruct.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.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * User provided interface representation for InnerStruct type.
+ */
+public final class TInnerStruct {
+
+ public int[][] twoDimLongSequence;
+ public String stringField;
+ public TColor color;
+
+ public TInnerStruct() {
+
+ }
+
+ public TInnerStruct(int[][] a1, String a2, TColor a3) {
+ twoDimLongSequence = a1;
+ stringField = a2;
+ color = a3;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TInnerUnion.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TInnerUnion.java
new file mode 100644
index 0000000000..d7734c48a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TInnerUnion.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.corba.types;
+
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
+
+/**
+ * @version $Rev$ $Date$
+ * User provided interface representation for CORBA InnerUnion type.
+ */
+public final class TInnerUnion {
+
+ @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 1)
+ private int x;
+
+ @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 2)
+ private float y;
+
+ @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
+ @SuppressWarnings("unused")
+ private int discriminator;
+
+ public int getX() {
+ return x;
+ }
+
+ public void setX(int x) {
+ discriminator = 1;
+ this.x = x;
+ }
+
+ public float getY() {
+ return y;
+ }
+
+ public void setY(float y) {
+ discriminator = 2;
+ this.y = y;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TRichStruct.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TRichStruct.java
new file mode 100644
index 0000000000..1b44da9752
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TRichStruct.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.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * User provided interface representation for RichStruct type.
+ */
+public final class TRichStruct {
+
+ public TInnerStruct innerStruct;
+ public String[] stringSequence;
+ public int longField;
+
+ public TRichStruct() {
+
+ }
+
+ public TRichStruct(TInnerStruct a1, String[] a2, int a3) {
+ innerStruct = a1;
+ stringSequence = a2;
+ longField = a3;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TRichUnion.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TRichUnion.java
new file mode 100644
index 0000000000..eb76c94643
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TRichUnion.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.test.corba.types;
+
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
+
+/**
+ * @version $Rev$ $Date$
+ * User provided interface representation for CORBA RichUnion type.
+ */
+public final class TRichUnion {
+
+ @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 1)
+ private int x;
+
+ @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 2)
+ private float y;
+
+ @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 3)
+ private String z;
+
+ @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 4)
+ private TInnerUnion iu;
+
+ @CorbaUnionElement(type = CorbaUnionElementType.defaultOption)
+ private boolean def;
+
+ @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
+ @SuppressWarnings("unused")
+ private int discriminator = -1;
+
+ public int getX() {
+ return x;
+ }
+
+ public void setX(int x) {
+ this.discriminator = 1;
+ this.x = x;
+ }
+
+ public float getY() {
+ return y;
+ }
+
+ public void setY(float y) {
+ this.discriminator = 2;
+ this.y = y;
+ }
+
+ public String getZ() {
+ return z;
+ }
+
+ public void setZ(String z) {
+ this.discriminator = 3;
+ this.z = z;
+ }
+
+ public boolean isDef() {
+ return def;
+ }
+
+ public void setDef(boolean def) {
+ this.discriminator = -1;
+ this.def = def;
+ }
+
+ public TInnerUnion getIu() {
+ return iu;
+ }
+
+ public void setIu(TInnerUnion iu) {
+ this.discriminator = 4;
+ this.iu = iu;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOne.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOne.java
new file mode 100644
index 0000000000..922759cd8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOne.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.corba.types;
+
+import org.apache.tuscany.sca.test.corba.generated.UnexpectedException;
+import org.apache.tuscany.sca.test.corba.generated.WrongColor;
+
+/**
+ * @version $Rev$ $Date$
+ * User provided CORBA service interface.
+ */
+public interface TScenarioOne {
+
+ TRichStruct setRichStruct(TRichStruct richStruct) throws WrongColor, UnexpectedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOneComponent.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOneComponent.java
new file mode 100644
index 0000000000..a4f15488cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOneComponent.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.corba.types;
+
+import org.apache.tuscany.sca.test.corba.generated.UnexpectedException;
+import org.apache.tuscany.sca.test.corba.generated.WrongColor;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ * Component for reference using user provided interface.
+ */
+public class TScenarioOneComponent implements TScenarioOne {
+
+ private TScenarioOne scenarionOne;
+
+ @Reference
+ public void setScenarioOne(TScenarioOne scenarioOne) {
+ this.scenarionOne = scenarioOne;
+ }
+
+ public TRichStruct setRichStruct(TRichStruct richStruct) throws WrongColor, UnexpectedException {
+ return scenarionOne.setRichStruct(richStruct);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOneServant.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOneServant.java
new file mode 100644
index 0000000000..47f0775c16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioOneServant.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.corba.types;
+
+import org.apache.tuscany.sca.test.corba.generated.Color;
+import org.apache.tuscany.sca.test.corba.generated.UnexpectedException;
+import org.apache.tuscany.sca.test.corba.generated.WrongColor;
+
+/**
+ * @version $Rev$ $Date$
+ * Servant for user provided interface. Uses T* classes.
+ */
+public class TScenarioOneServant implements TScenarioOne {
+
+ private static final long serialVersionUID = 1L;
+
+ public TRichStruct setRichStruct(TRichStruct richStruct) throws WrongColor, UnexpectedException {
+ if (richStruct.innerStruct.color.value() == Color.red.value()) {
+ Color translatedColor = Color.from_int(richStruct.innerStruct.color.value());
+ throw new WrongColor(translatedColor, Color.green);
+ } else if (richStruct.longField == 0) {
+ throw new UnexpectedException("Expected richStruct.longField != 0");
+ }
+ return richStruct;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSix.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSix.java
new file mode 100644
index 0000000000..3b4943a43d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSix.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.corba.types;
+
+import org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
+
+/**
+ * @version $Rev$ $Date$
+ * Operations for scenario six.
+ */
+public interface TScenarioSix {
+
+ @CorbaArray( {2, 2})
+ public String[][] passStringArray(@CorbaArray( {2, 2})String[][] arg);
+
+ public TAnnotatedStruct passAnnotatedStruct(TAnnotatedStruct arg);
+
+ public TRichUnion passRichUnion(TRichUnion arg);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSixComponent.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSixComponent.java
new file mode 100644
index 0000000000..7d43badb23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSixComponent.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.corba.types;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ * Component for obtaining ScenartioSix reference.
+ */
+public class TScenarioSixComponent {
+
+ private TScenarioSix scenarioSix;
+
+ @Reference
+ public void setScenarioSix(TScenarioSix scenarioSix) {
+ this.scenarioSix = scenarioSix;
+ }
+
+ public TScenarioSix getScenarioSix() {
+ return scenarioSix;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSixServant.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSixServant.java
new file mode 100644
index 0000000000..8e76958e31
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioSixServant.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.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * Tuscany scenario six servant.
+ */
+public class TScenarioSixServant implements TScenarioSix {
+
+ private static final long serialVersionUID = 1L;
+
+ public String[][] passStringArray(String[][] arg) {
+ return arg;
+ }
+
+ public TAnnotatedStruct passAnnotatedStruct(TAnnotatedStruct arg) {
+ return arg;
+ }
+
+ public TRichUnion passRichUnion(TRichUnion arg) {
+ return arg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThree.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThree.java
new file mode 100644
index 0000000000..1e4264256b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThree.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.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * Operations for ScenarioThree.
+ */
+public interface TScenarioThree {
+
+ int getIntField();
+
+ void setIntField(int intField);
+
+ void overloadedName();
+
+ void overloadedName(String arg1);
+
+ void overloadedName(String arg1, int arg2);
+
+ int caseDifferent();
+
+ int CaseDifferent();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeComponent.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeComponent.java
new file mode 100644
index 0000000000..917cceedf5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeComponent.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.corba.types;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ * Component for obtaining ScenartioThree reference.
+ */
+public class TScenarioThreeComponent {
+
+ private TScenarioThree scenarionThree;
+
+ @Reference
+ public void setScenarioThree(TScenarioThree scenarioThree) {
+ this.scenarionThree = scenarioThree;
+ }
+
+ public TScenarioThree getScenarioThree() {
+ return scenarionThree;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeServant.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeServant.java
new file mode 100644
index 0000000000..b679214c6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioThreeServant.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * Servant for user provided interface.
+ */
+public class TScenarioThreeServant implements TScenarioThree {
+
+ public int getIntField() {
+ return 0;
+ }
+
+ public void overloadedName() {
+ }
+
+ public void overloadedName(String arg1) {
+ }
+
+ public void overloadedName(String arg1, int arg2) {
+ }
+
+ public void setIntField(int intField) {
+ }
+
+ public int CaseDifferent() {
+ return 1;
+ }
+
+ public int caseDifferent() {
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwo.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwo.java
new file mode 100644
index 0000000000..415634c80f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwo.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.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * Operations for ScenarioTwo.
+ */
+public interface TScenarioTwo {
+
+ String getStringField();
+
+ void setStringField(String stringField);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoComponent.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoComponent.java
new file mode 100644
index 0000000000..d7c72b40da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoComponent.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.corba.types;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ * Component for obtaining ScenartioTwo reference.
+ */
+public class TScenarioTwoComponent {
+
+ private TScenarioTwo scenarioTwo;
+
+ @Reference
+ public void setScenarioTwo(TScenarioTwo scenarioTwo) {
+ this.scenarioTwo = scenarioTwo;
+ }
+
+ public TScenarioTwo getScenarioTwo() {
+ return scenarioTwo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoServant.java b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoServant.java
new file mode 100644
index 0000000000..cb868d18a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/TScenarioTwoServant.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.corba.types;
+
+/**
+ * @version $Rev$ $Date$
+ * Servant for user provided interface.
+ */
+public class TScenarioTwoServant implements TScenarioTwo {
+
+ private static String stringField = "";
+
+ public String getStringField() {
+ return stringField;
+ }
+
+ public void setStringField(String stringField) {
+ TScenarioTwoServant.stringField = stringField;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..3e77527d73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/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.
+
+org.apache.tuscany.sca.test.corba.TestCorbaHostModuleActivator
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioFive.composite b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioFive.composite
new file mode 100644
index 0000000000..3c73e238a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioFive.composite
@@ -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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Corba">
+
+ <component name="ScenarioFiveService">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioFiveImpl" />
+ </component>
+ <service name="ScenarioFive" promote="ScenarioFiveService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.ScenarioFive"/>
+ <binding.sca uri="corbaname::localhost:5090#ScenarioFive"/>
+ </service>
+
+ <component name="ScenarioFive">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioFiveComponent" />
+ <reference name="scenarioFive">
+ <binding.sca uri="corbaname::localhost:5090#ScenarioFive"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioFour.composite b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioFour.composite
new file mode 100644
index 0000000000..01d7e2314a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioFour.composite
@@ -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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Corba">
+
+ <!-- note that some binding configuration (like port or host name) is also used in JUnit test class -->
+
+ <component name="ScenarioFourService">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioFourImpl" />
+ </component>
+ <service name="ScenarioFour" promote="ScenarioFourService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.ScenarioFour"/>
+ <binding.sca uri="corbaname::localhost:5080#ScenarioFour"/>
+ </service>
+
+ <component name="ScenarioFour">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioFourComponent" />
+ <reference name="scenarioFour">
+ <binding.sca uri="corbaname::localhost:5080#ScenarioFour"/>
+ </reference>
+ </component>
+
+ <!-- doubled service and reference to test reuse of name server -->
+ <service name="ScenarioFourDoubled" promote="ScenarioFourService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.ScenarioFour"/>
+ <binding.sca uri="corbaname::localhost:5080#ScenarioFourReuse"/>
+ </service>
+
+ <component name="ScenarioFourReuse">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioFourComponent" />
+ <reference name="scenarioFour">
+ <binding.sca uri="corbaname::localhost:5080#ScenarioFourReuse"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioOne.composite b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioOne.composite
new file mode 100644
index 0000000000..c10b383661
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioOne.composite
@@ -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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Corba">
+
+ <!-- note that some binding configuration (like port or host name) is also used in JUnit test class -->
+
+ <!-- reference 1 - consuming traditional CORBA service using USER PROVIDED Java interface -->
+ <component name="ScenarioOne">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioOneComponent" />
+ <reference name="scenarioOne">
+ <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOne"/>
+ </reference>
+ </component>
+
+ <!-- reference 2 - consuming traditional CORBA service using GENERATED Java interface -->
+ <component name="ScenarioOneGenerated">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioOneComponent" />
+ <reference name="scenarioOne">
+ <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOne"/>
+ </reference>
+ </component>
+
+ <!-- TUSCANY CORBA SERVICE 1 (TS1) - CORBA service using USER PROVIDED Java interface -->
+ <component name="ScenarionOneService">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioOneServant" />
+ </component>
+ <service name="ScenarionOneService" promote="ScenarionOneService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.TScenarioOne"/>
+ <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOneTuscany" id="IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioOne:1.0"/>
+ </service>
+
+ <!-- TUSCANY CORBA SERVICE 2 (TS2) - CORBA service using GENERATED provided Java interface -->
+ <component name="ScenarionOneServiceGenerated">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioOneServant" />
+ </component>
+ <service name="ScenarionOneServiceGenerated" promote="ScenarionOneServiceGenerated">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations"/>
+ <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOneTuscanyGenerated" id="IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioOne:1.0"/>
+ </service>
+
+ <!-- reference 3 - user provided interface combined with TUSCANY SERVICE 1 (TS1) -->
+ <component name="TU2TS1">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioOneComponent" />
+ <reference name="scenarioOne">
+ <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOneTuscany"/>
+ </reference>
+ </component>
+
+ <!-- reference 4 - generated interface combined with TUSCANY SERVICE 1 (TS1) -->
+ <component name="TG2TS1">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioOneComponent" />
+ <reference name="scenarioOne">
+ <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOneTuscany"/>
+ </reference>
+ </component>
+
+ <!-- reference 5 - user provided interface combined with TUSCANY SERVICE 2 (TS2) -->
+ <component name="TU2TS2">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioOneComponent" />
+ <reference name="scenarioOne">
+ <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOneTuscanyGenerated"/>
+ </reference>
+ </component>
+
+ <!-- reference 6 - generated interface combined with TUSCANY SERVICE 2 (TS2) -->
+ <component name="TG2TS2">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioOneComponent" />
+ <reference name="scenarioOne">
+ <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOneTuscanyGenerated"/>
+ </reference>
+ </component>
+
+ <!-- TUSCANY CORBA SERVICE 3 (TS3) - CORBA service using registered using URI -->
+ <component name="ScenarionOneServiceURI">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioOneServant" />
+ </component>
+ <service name="ScenarionOneServiceGenerated" promote="ScenarionOneServiceGenerated">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations"/>
+ <tuscany:binding.corba uri="corbaname::localhost:5060#NamedWithURI"/>
+ </service>
+
+ <!-- reference 7 - ... -->
+ <component name="UriBinding">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioOneComponent" />
+ <reference name="scenarioOne">
+ <tuscany:binding.corba uri="corbaname::localhost:5060#NamedWithURI"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioSix.composite b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioSix.composite
new file mode 100644
index 0000000000..88238478c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioSix.composite
@@ -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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Corba">
+
+ <component name="ScenarioSix">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioSixComponent" />
+ <reference name="scenarioSix">
+ <tuscany:binding.corba host="localhost" port="5050" name="ScenarioSix"/>
+ </reference>
+ </component>
+
+ <component name="ScenarionSixService">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioSixServant" />
+ </component>
+ <service name="ScenarionSixService" promote="ScenarionSixService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.TScenarioSix"/>
+ <tuscany:binding.corba host="localhost" port="5050" name="ScenarioSixTuscany" id="IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioSix:1.0"/>
+ </service>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioThree.composite b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioThree.composite
new file mode 100644
index 0000000000..f43e4a3f7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioThree.composite
@@ -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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Corba">
+
+ <!-- note that some binding configuration (like port or host name) is also used in JUnit test class -->
+
+ <component name="ScenarioThreeService">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioThreeServant" />
+ </component>
+ <service name="ScenarioThreeServiceTuscany" promote="ScenarioThreeService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.TScenarioThree"/>
+ <tuscany:binding.corba uri="corbaname::localhost:5060#ScenarioThree"/>
+ </service>
+
+ <component name="ScenarioThreeReference">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioThreeComponent" />
+ <reference name="scenarioThree">
+ <tuscany:binding.corba uri="corbaname::localhost:5060#ScenarioThree"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioTwo.composite b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioTwo.composite
new file mode 100644
index 0000000000..dc5ddc50d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/ScenarioTwo.composite
@@ -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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Corba">
+
+ <!-- note that some binding configuration (like port or host name) is also used in JUnit test class -->
+
+ <component name="ScenarioTwoService">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioTwoServant" />
+ </component>
+ <service name="ScenarioTwoServiceTuscany" promote="ScenarioTwoService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.TScenarioTwo"/>
+ <tuscany:binding.corba uri="corbaname::localhost:5060#ScenarioTwo" id="IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioTwo:1.0"/>
+ </service>
+
+ <component name="ScenarioTwo">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.TScenarioTwoComponent" />
+ <reference name="scenarioTwo">
+ <tuscany:binding.corba uri="corbaname::localhost:5060#ScenarioTwoGenerated"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/itest_scenario.idl b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/itest_scenario.idl
new file mode 100644
index 0000000000..41489a4565
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/itest_scenario.idl
@@ -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.
+ */
+
+/*
+ * compile by
+ * idlj -fall -oldImplBase itest_scenario.idl
+ */
+
+module org {
+ module apache {
+ module tuscany {
+ module sca {
+ module test {
+ module corba {
+ module generated {
+
+ // objects for ScenarioOne
+
+ enum Color {red, yellow, green};
+
+ typedef sequence<string> StringSequence;
+ typedef sequence<long> LongSequence;
+ typedef sequence<LongSequence> TwoDimLongSequence;
+
+ struct InnerStruct {
+ TwoDimLongSequence twoDimLongSequence;
+ string stringField;
+ Color color;
+ };
+
+ struct RichStruct {
+ InnerStruct innerStruct;
+ StringSequence stringSequence;
+ long longField;
+ };
+
+ exception WrongColor {
+ Color givenColor;
+ Color correctColor;
+ };
+
+ exception UnexpectedException {
+ string info;
+ };
+
+ interface ScenarioOne {
+
+ RichStruct setRichStruct(in RichStruct richStruct) raises (WrongColor, UnexpectedException);
+
+ };
+
+ // objects for ScenarioTwo
+
+ interface ScenarioTwo {
+
+ attribute string stringField;
+
+ };
+
+ typedef string StringArray[2][2];
+
+ struct AnnotatedStruct {
+ StringArray stringArray;
+ };
+
+ union InnerUnion switch (long) {
+ case 1: long x;
+ case 2: float y;
+ };
+
+ union RichUnion switch (long) {
+ case 1: long x;
+ case 2: float y;
+ case 3: string z;
+ case 4: InnerUnion iu;
+ default: boolean a;
+ };
+
+ interface ScenarioSix {
+
+ StringArray passStringArray(in StringArray arg);
+
+ AnnotatedStruct passAnnotatedStruct(in AnnotatedStruct arg);
+
+ RichUnion passRichUnion(in RichUnion arg);
+
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+};
diff --git a/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/scenariofour.xsd b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/scenariofour.xsd
new file mode 100644
index 0000000000..2669b54be3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/corba/src/test/resources/scenariofour.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 targetNamespace="http://example.com/scenariofour" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="ScenarioFourSdo">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="string" />
+ <element name="symbol" minOccurs="1" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/common/pom.xml b/sca-java-1.x/branches/sca-android/itest/databindings/common/pom.xml
new file mode 100644
index 0000000000..40f2999c9c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/common/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-databindings</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-common</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Databinding Common Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</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>http://download.java.net/maven/1</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>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-tools</artifactId>
+ <version>1.1.1</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.1.1</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-android/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java
new file mode 100644
index 0000000000..adb546a1ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.File;
+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.InputFileType;
+import org.apache.tuscany.generate.TemplateType;
+import org.apache.tuscany.sdo.generate.XSD2JavaGenerator;
+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 xsd file
+ * generate SDOs
+ * 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 convenient 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 configured file holds a list of types
+ // that the velocity templates expand into appropriate methods and method calls
+ List fileList = generateType.getInputFile();
+
+ //Initialise 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);
+ File f = new File(filename);
+ // Create folders since the package doesn't exist before the code-gen for the 1st time
+ f.getParentFile().mkdirs();
+ FileWriter fw = new FileWriter(f);
+ 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 SDO generator tool does all of the hard work
+ *
+ * @param projectBuildDir the path to the target dir of the project being generated.
+ */
+ public static void generateSDO(String projectBuildDir) {
+ System.out.println(">> Building SDOs 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 convenient 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 configured file holds a list of types
+ // that the velocity templates expand into appropriate methods and method calls
+ List fileList = generateType.getInputFile();
+
+ // for each XSD in the XSD file list generate an SDO.
+ XSD2JavaGenerator generator = new XSD2JavaGenerator();
+
+ for ( Object item : fileList){
+ InputFileType file = (InputFileType)item;
+
+ XSD2JavaGenerator.generateFromXMLSchema(projectBuildDir + "/classes/xsd/" + file.getFileName(),
+ file.getNamespace(),
+ projectBuildDir + "/sdo-source",
+ file.getJavaPackage(),
+ null, //file.getPrefix(),
+ XSD2JavaGenerator.OPTION_NO_CONTAINMENT | XSD2JavaGenerator.OPTION_NO_NOTIFICATION | XSD2JavaGenerator.OPTION_NO_UNSETTABLE);
+
+ }
+
+ } 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.generate(args[0]);
+
+ if (args.length > 1){
+ Generate.generateSDO(args[0]);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm
new file mode 100644
index 0000000000..88616cc997
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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:8085/services/GreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm
new file mode 100644
index 0000000000..77a12e92ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 automatically 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-android/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm
new file mode 100644
index 0000000000..aab564dc1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 automatically 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-android/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm
new file mode 100644
index 0000000000..5507a0b747
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 automatically 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-android/itest/databindings/common/src/main/resources/generate/generate.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/wsdl/Dummy.txt b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Annotation.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Annotation.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Attribute.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Attribute.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Import.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Import.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Include.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Include.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Interop.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Notation.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Notation.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/Person.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd
new file mode 100644
index 0000000000..5d27ef5ce1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd
new file mode 100644
index 0000000000..ec16a678a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd
new file mode 100644
index 0000000000..ed681009f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd
new file mode 100644
index 0000000000..ea35bec61a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd
new file mode 100644
index 0000000000..57981e3666
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/datagraph.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java
new file mode 100644
index 0000000000..fa3f310d4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.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.itest.generate;
+
+import junit.framework.TestCase;
+
+
+/**
+ *
+ */
+public class GenerateTestCase extends TestCase {
+
+ //private Generate generator = null;
+
+ @Override
+ protected void setUp() throws Exception {
+ //generator = new Generate();
+ }
+
+ @Override
+ 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-android/itest/databindings/config.png b/sca-java-1.x/branches/sca-android/itest/databindings/config.png
new file mode 100644
index 0000000000..7912019e9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/config.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/config.svg b/sca-java-1.x/branches/sca-android/itest/databindings/config.svg
new file mode 100644
index 0000000000..aaf027e2df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/databindings/databinding.png b/sca-java-1.x/branches/sca-android/itest/databindings/databinding.png
new file mode 100644
index 0000000000..76a9c71b7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/databinding.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/databinding.svg b/sca-java-1.x/branches/sca-android/itest/databindings/databinding.svg
new file mode 100644
index 0000000000..d6850ccf7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/databindings/interop.png b/sca-java-1.x/branches/sca-android/itest/databindings/interop.png
new file mode 100644
index 0000000000..005e0f24ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/interop.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/interop.svg b/sca-java-1.x/branches/sca-android/itest/databindings/interop.svg
new file mode 100644
index 0000000000..03897c6d09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/databindings/interop/pom.xml b/sca-java-1.x/branches/sca-android/itest/databindings/interop/pom.xml
new file mode 100644
index 0000000000..bcd1b12078
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/interop/pom.xml
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-databindings</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-interop</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA DataBinding Interop Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</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.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>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-xml</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <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>itest-databindings-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </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-android/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm b/sca-java-1.x/branches/sca-android/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm
new file mode 100644
index 0000000000..38bfccce0c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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:8085/services/JAXBGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm b/sca-java-1.x/branches/sca-android/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm
new file mode 100644
index 0000000000..6f02af4c9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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:8085/services/SDOGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/interop/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/jaxb-bottom-up/pom.xml b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/pom.xml
new file mode 100644
index 0000000000..92a8e7d82a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/pom.xml
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-databindings</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-jaxb-bottom-up</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Databinding Integration Tests - JAXB Bottom Up</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </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>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-xml</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-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.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</version>
+ </dependency>
+ <!-- Added by Simon Nash -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.12</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- End of addition -->
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </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>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <executions>
+
+ <execution>
+ <id>wsgen</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>wsgen-test</goal>
+ </goals>
+ <configuration>
+ <sei>org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloServiceSimpleImpl</sei>
+ <genWsdl>true</genWsdl>
+ <keep>true</keep>
+ <resourceDestDir>${project.build.directory}/jaxws-source</resourceDestDir>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ </configuration>
+ </execution>
+
+ </executions>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <version>1.5.0</version>
+ <scope>system</scope>
+ <systemPath>${java.home}/../lib/tools.jar</systemPath>
+ </dependency>
+ </dependencies>
+
+ </plugin>
+ -->
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java
new file mode 100644
index 0000000000..7f9b62f9b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.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.databindings.jaxb;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AClientService.
+ */
+@Remotable
+public interface AClientService {
+ public String getGreetingsForward(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java
new file mode 100644
index 0000000000..1762812c1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.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.databindings.jaxb;
+
+import javax.jws.soap.SOAPBinding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface AService {
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean1.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean1.java
new file mode 100644
index 0000000000..7529c2b841
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean1.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.itest.databindings.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Bean1<T> {
+ private T item;
+
+ public Bean1() {
+ }
+
+ public Bean1(T item) {
+ this.item = item;
+ }
+
+ public void setItem(T item) {
+ this.item = item;
+ }
+
+ public T getItem() {
+ return item;
+ }
+
+ public boolean equals(Object that) {
+ if(that == null) {
+ return false;
+ }
+ if(that.getClass() != this.getClass()) {
+ return false;
+ }
+
+ Bean1<?> that1 = (Bean1<?>)that;
+ if(this == that1) {
+ return true;
+ } else if(this.item != null) {
+ return this.item.equals(that1.item);
+ } else {
+ return that1.item == null;
+ }
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName()+"[item = "+item+"]";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean10.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean10.java
new file mode 100644
index 0000000000..4a4419a42b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean10.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.databindings.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Bean10 extends Bean1<String> {
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean11.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean11.java
new file mode 100644
index 0000000000..65f019ec48
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean11.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.databindings.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Bean11 extends Bean1<String> {
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean2.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean2.java
new file mode 100644
index 0000000000..844e28863a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean2.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.itest.databindings.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Bean2 {
+ private String name;
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean equals(Object that) {
+ if(that == null) {
+ return false;
+ }
+
+ if(this.getClass() != that.getClass()) {
+ return false;
+ }
+
+ if(this == that) {
+ return true;
+ } else if(this.name != null) {
+ return this.name.equals(((Bean2)that).name);
+ } else {
+ return ((Bean2)that).name == null;
+ }
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName()+"[name = "+name+"]";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean3.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean3.java
new file mode 100644
index 0000000000..4e0bd38b2b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean3.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.itest.databindings.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Bean3 extends Bean2 {
+ private String address;
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public boolean equals(Object that) {
+ if(that == null) {
+ return false;
+ }
+
+ if(this.getClass() != that.getClass()) {
+ return false;
+ }
+
+ if(this == that) {
+ return true;
+ } else if(this.address != null) {
+ return this.address.equals(((Bean3)that).address) && super.equals(that);
+ } else {
+ return ((Bean3)that).address == null && super.equals(that);
+ }
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName()+"[name = "+super.getName()+", address = "+address+"]";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean31.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean31.java
new file mode 100644
index 0000000000..40aff31297
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/Bean31.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.itest.databindings.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Bean31 extends Bean2 {
+ private String address;
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public boolean equals(Object that) {
+ if(that == null) {
+ return false;
+ }
+
+ if(this.getClass() != that.getClass()) {
+ return false;
+ }
+
+ if(this == that) {
+ return true;
+ } else if(this.address != null) {
+ return this.address.equals(((Bean31)that).address) && super.equals(that);
+ } else {
+ return ((Bean31)that).address == null && super.equals(that);
+ }
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName()+"[name = "+super.getName()+", address = "+address+"]";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsLocalService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsLocalService.java
new file mode 100644
index 0000000000..ca012b967d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsLocalService.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.itest.databindings.jaxb;
+
+/**
+ * The interface for GenericsLocalService.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface GenericsLocalService {
+ Bean1<String> getTypeExplicit(Bean1<String> arg);
+
+ <T> Bean1<T> getTypeUnbound(T[] anArray);
+
+ <T extends Bean2> Bean1<T> getTypeExtends(T[] anArray);
+
+ <T extends Bean1<String>> Bean1<T> getRecursiveTypeBound(T[] anArray);
+
+ Bean1<?> getWildcardUnbound(Bean1<?> arg);
+
+ Bean1<? super Bean3> getWildcardSuper(Bean1<? super Bean3> arg);
+
+ Bean1<? extends Bean2> getWildcardExtends(Bean1<? extends Bean2> arg);
+
+ Bean2 getPolymorphic(Bean2 arg);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsService.java
new file mode 100644
index 0000000000..12ed7d0ec7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsService.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.itest.databindings.jaxb;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for GenericsService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface GenericsService extends GenericsLocalService{
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsServiceClient.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsServiceClient.java
new file mode 100644
index 0000000000..3bae554dc7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsServiceClient.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.databindings.jaxb;
+
+/**
+ * The interface for GenericsServiceClient.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface GenericsServiceClient {
+ Bean1<String> getTypeExplicitForward(Bean1<String> arg);
+
+ <T> Bean1<T> getTypeUnboundForward(T[] anArray);
+
+ <T extends Bean2> Bean1<T> getTypeExtendsForward(T[] anArray);
+
+ <T extends Bean1<String>> Bean1<T> getRecursiveTypeBoundForward(T[] anArray);
+
+ Bean1<?> getWildcardUnboundForward(Bean1<?> arg);
+
+ Bean1<? super Bean3> getWildcardSuperForward(Bean1<? super Bean3> arg);
+
+ Bean1<? extends Bean2> getWildcardExtendsForward(Bean1<? extends Bean2> arg);
+
+ Bean2 getPolymorphicForward(Bean2 arg);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloLocalServiceSimple.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloLocalServiceSimple.java
new file mode 100644
index 0000000000..a31cc3d45a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloLocalServiceSimple.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.itest.databindings.jaxb;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The interface for HelloLocalServiceSimple.
+ */
+public interface HelloLocalServiceSimple {
+ String getGreetings(String name);
+ String[] getGreetingsArray(String[] names);
+ List<String> getGreetingsList(List<String> names);
+ ArrayList<String> getGreetingsArrayList(ArrayList<String> names);
+ Map<String, String> getGreetingsMap(Map<String, String> namesMap);
+ HashMap<String, String> getGreetingsHashMap(HashMap<String, String> namesMap);
+ String getGreetingsVarArgs(String... names);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceSimple.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceSimple.java
new file mode 100644
index 0000000000..34ac9024f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceSimple.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.databindings.jaxb;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for HelloServiceSimple.
+ */
+@Remotable
+public interface HelloServiceSimple extends HelloLocalServiceSimple {
+ // Add any methods to the local interface.
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceSimpleClient.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceSimpleClient.java
new file mode 100644
index 0000000000..23ed57dec9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceSimpleClient.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.databindings.jaxb;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The interface for HelloServiceSimpleClient.
+ */
+public interface HelloServiceSimpleClient {
+ String getGreetingsForward(String name);
+ String[] getGreetingsArrayForward(String[] names);
+ List<String> getGreetingsListForward(List<String> names);
+ ArrayList<String> getGreetingsArrayListForward(ArrayList<String> names);
+ Map<String, String> getGreetingsMapForward(Map<String, String> namesMap);
+ HashMap<String, String> getGreetingsHashMapForward(HashMap<String, String> namesMap);
+ String getGreetingsVarArgsForward(String... names);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesLocalService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesLocalService.java
new file mode 100644
index 0000000000..6239c0f5f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesLocalService.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.databindings.jaxb;
+
+
+/**
+ * The interface for PrimitivesLocalService.
+ */
+public interface PrimitivesLocalService {
+ boolean negateBoolean(boolean flag);
+ boolean[] negateBooleanArray(boolean[] flags);
+ boolean[] identityBooleanArray(boolean[] flags);
+ byte negateByte(byte b);
+ byte[] negateByteArray(byte[] ba);
+ byte[] identityByteArray(byte[] ba);
+ short negateShort(short s);
+ short[] negateShortArray(short[] s);
+ short[] identityShortArray(short[] sa);
+ int negateInt(int s);
+ int[] negateIntArray(int[] s);
+ int[] identityIntArray(int[] ia);
+ long negateLong(long l);
+ long[] negateLongArray(long[] la);
+ long[] identityLongArray(long[] la);
+ float negateFloat(float f);
+ float[] negateFloatArray(float[] fa);
+ float[] identityFloatArray(float[] fa);
+ double negateDouble(double d);
+ double[] negateDoubleArray(double[] da);
+ double[] identityDoubleArray(double[] da);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java
new file mode 100644
index 0000000000..c5553688e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.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.databindings.jaxb;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for PrimitivesService.
+ */
+@Remotable
+public interface PrimitivesService extends PrimitivesLocalService {
+ // Add any methods to the local interface.
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java
new file mode 100644
index 0000000000..3bdf886dfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.databindings.jaxb;
+
+
+/**
+ * The interface for PrimitivesServiceClient.
+ */
+public interface PrimitivesServiceClient {
+ boolean negateBooleanForward(boolean flag);
+ boolean[] negateBooleanArrayForward(boolean[] flags);
+ boolean passByValueBooleanArray();
+ byte negateByteForward(byte b);
+ byte[] negateByteArrayForward(byte[] ba);
+ boolean passByValueByteArray();
+ short negateShortForward(short s);
+ short[] negateShortArrayForward(short[] sa);
+ boolean passByValueShortArray();
+ int negateIntForward(int i);
+ int[] negateIntArrayForward(int[] ia);
+ boolean passByValueIntArray();
+ long negateLongForward(long l);
+ long[] negateLongArrayForward(long[] la);
+ boolean passByValueLongArray();
+ float negateFloatForward(float f);
+ float[] negateFloatArrayForward(float[] fa);
+ boolean passByValueFloatArray();
+ double negateDoubleForward(double d);
+ double[] negateDoubleArrayForward(double[] da);
+ boolean passByValueDoubleArray();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesLocalService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesLocalService.java
new file mode 100644
index 0000000000..0fdf69459f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesLocalService.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.itest.databindings.jaxb;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+
+/**
+ * The interface for StandardTypesLocalService.
+ */
+public interface StandardTypesLocalService {
+ BigInteger getNewBigInteger(BigInteger bi);
+ BigInteger[] getNewBigIntegerArray(BigInteger[] bia);
+
+ BigDecimal getNewBigDecimal(BigDecimal bd);
+ BigDecimal[] getNewBigDecimalArray(BigDecimal[] bda);
+
+ Calendar getNewCalendar(Calendar c);
+ Calendar[] getNewCalendarArray(Calendar[] ca);
+
+ Date getNewDate(Date d);
+ Date[] getNewDateArray(Date[] da);
+
+ QName getNewQName(QName qname);
+ QName[] getNewQNameArray(QName[] qnames);
+
+ URI getNewURI(URI uri);
+ URI[] getNewURIArray(URI[] uris);
+
+ XMLGregorianCalendar getNewXMLGregorianCalendar(XMLGregorianCalendar xgcal);
+ XMLGregorianCalendar[] getNewXMLGregorianCalendarArray(XMLGregorianCalendar[] xgcal);
+
+ Duration getNewDuration(Duration d);
+ Duration[] getNewDurationArray(Duration[] da);
+
+ Object getNewObject(Object obj);
+ Object[] getNewObjectArray(Object[] objs);
+
+ Image getNewImage(Image img);
+ Image[] getNewImageArray(Image[] imgs);
+
+ DataHandler getNewDataHandler(DataHandler dh);
+ DataHandler[] getNewDataHandlerArray(DataHandler[] dha);
+
+ Source getNewSource(Source src);
+ Source[] getNewSourceArray(Source[] srcs);
+
+ UUID getNewUUID(UUID uuid);
+ UUID[] getNewUUIDArray(UUID[] uuids);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java
new file mode 100644
index 0000000000..2842205085
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.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.itest.databindings.jaxb;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+
+/**
+ * The interface for StandardTypesService.
+ */
+@Remotable
+public interface StandardTypesService extends StandardTypesLocalService{
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java
new file mode 100644
index 0000000000..351d9df0cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.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.itest.databindings.jaxb;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+
+/**
+ * The interface for StandardTypesServiceClient.
+ */
+public interface StandardTypesServiceClient {
+ BigInteger getNewBigIntegerForward(BigInteger bi);
+ BigInteger[] getNewBigIntegerArrayForward(BigInteger[] bia);
+
+ BigDecimal getNewBigDecimalForward(BigDecimal bd);
+ BigDecimal[] getNewBigDecimalArrayForward(BigDecimal[] bda);
+
+ Calendar getNewCalendarForward(Calendar c);
+ Calendar[] getNewCalendarArrayForward(Calendar[] ca);
+
+ Date getNewDateForward(Date d);
+ Date[] getNewDateArrayForward(Date[] da);
+
+ QName getNewQNameForward(QName qname);
+ QName[] getNewQNameArrayForward(QName[] qnames);
+
+ URI getNewURIForward(URI uri);
+ URI[] getNewURIArrayForward(URI[] uris);
+
+ XMLGregorianCalendar getNewXMLGregorianCalendarForward(XMLGregorianCalendar xgcal);
+ XMLGregorianCalendar[] getNewXMLGregorianCalendarArrayForward(XMLGregorianCalendar[] xgcals);
+
+ Duration getNewDurationForward(Duration d);
+ Duration[] getNewDurationArrayForward(Duration[] da);
+
+ Object getNewObjectForward(Object obj);
+ Object[] getNewObjectArrayForward(Object[] objs);
+
+ Image getNewImageForward(Image img);
+ Image[] getNewImageArrayForward(Image[] imgs);
+
+ DataHandler getNewDataHandlerForward(DataHandler dh);
+ DataHandler[] getNewDataHandlerArrayForward(DataHandler[] dha);
+
+ Source getNewSourceForward(Source src);
+ Source[] getNewSourceArrayForward(Source[] srcs);
+
+ UUID getNewUUIDForward(UUID uuid);
+ UUID[] getNewUUIDArrayForward(UUID[] uuids);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java
new file mode 100644
index 0000000000..8b484e93f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.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.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.AClientService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.AService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AClientService.class)
+public class AClientServiceImpl implements AClientService {
+
+ @Reference
+ protected AService aService;
+
+ public String getGreetingsForward(String name) {
+ return aService.getGreetings(name);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java
new file mode 100644
index 0000000000..4a35d41c04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.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.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.AService;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsLocalServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsLocalServiceClientImpl.java
new file mode 100644
index 0000000000..9e042ffe6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsLocalServiceClientImpl.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.itest.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean1;
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean2;
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean3;
+import org.apache.tuscany.sca.itest.databindings.jaxb.GenericsLocalService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.GenericsServiceClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of GenericsLocalServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(GenericsServiceClient.class)
+public class GenericsLocalServiceClientImpl implements GenericsServiceClient {
+
+ private GenericsLocalService service;
+
+ @Reference(required=false)
+ protected void setGenericsLocalService(GenericsLocalService service) {
+ this.service = service;
+ }
+
+ public Bean1<String> getTypeExplicitForward(Bean1<String> arg) {
+ return service.getTypeExplicit(arg);
+ }
+
+ public <T> Bean1<T> getTypeUnboundForward(T[] anArray) {
+ return service.getTypeUnbound(anArray);
+ }
+
+ public <T extends Bean2> Bean1<T> getTypeExtendsForward(T[] anArray) {
+ return service.getTypeExtends(anArray);
+ }
+
+ public <T extends Bean1<String>> Bean1<T> getRecursiveTypeBoundForward(T[] anArray) {
+ return service.getRecursiveTypeBound(anArray);
+ }
+
+ public Bean1<?> getWildcardUnboundForward(Bean1<?> arg) {
+ return service.getWildcardUnbound(arg);
+ }
+
+ public Bean1<? super Bean3> getWildcardSuperForward(Bean1<? super Bean3> arg) {
+ return service.getWildcardSuper(arg);
+ }
+
+ public Bean1<? extends Bean2> getWildcardExtendsForward(Bean1<? extends Bean2> arg) {
+ return service.getWildcardExtends(arg);
+ }
+
+ public Bean2 getPolymorphicForward(Bean2 arg) {
+ return service.getPolymorphic(arg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsServiceClientImpl.java
new file mode 100644
index 0000000000..ec929ddece
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsServiceClientImpl.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.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.GenericsService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.GenericsServiceClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of GenericsServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(GenericsServiceClient.class)
+public class GenericsServiceClientImpl extends GenericsLocalServiceClientImpl {
+
+ @Reference
+ public void setGenericsService(GenericsService service) {
+ super.setGenericsLocalService(service);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsServiceImpl.java
new file mode 100644
index 0000000000..58808eec4f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsServiceImpl.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.itest.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean1;
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean2;
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean3;
+import org.apache.tuscany.sca.itest.databindings.jaxb.GenericsLocalService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.GenericsService;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of GenericsService.
+ * This implementation provides both a local and a remotable service.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(interfaces={GenericsService.class, GenericsLocalService.class})
+public class GenericsServiceImpl implements GenericsService, GenericsLocalService {
+
+ public Bean1<String> getTypeExplicit(Bean1<String> arg) {
+ return GenericsTransformer.getTypeExplicit(arg);
+ }
+
+ public <T> Bean1<T> getTypeUnbound(T[] anArray) {
+ return GenericsTransformer.getTypeUnbound(anArray);
+ }
+
+ public <T extends Bean2> Bean1<T> getTypeExtends(T[] anArray) {
+ return GenericsTransformer.getTypeExtends(anArray);
+ }
+
+ public <T extends Bean1<String>> Bean1<T> getRecursiveTypeBound(T[] anArray) {
+ return GenericsTransformer.getRecursiveTypeBound(anArray);
+ }
+
+ public Bean1<?> getWildcardUnbound(Bean1<?> arg) {
+ return GenericsTransformer.getWildcardUnbound(arg);
+ }
+
+ public Bean1<? super Bean3> getWildcardSuper(Bean1<? super Bean3> arg) {
+ return GenericsTransformer.getWildcardSuper(arg);
+ }
+
+ public Bean1<? extends Bean2> getWildcardExtends(Bean1<? extends Bean2> arg) {
+ return GenericsTransformer.getWildcardExtends(arg);
+ }
+
+ public Bean2 getPolymorphic(Bean2 arg) {
+ return GenericsTransformer.getPolymorphic(arg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsTransformer.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsTransformer.java
new file mode 100644
index 0000000000..858b8da59a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/GenericsTransformer.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.itest.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean1;
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean10;
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean11;
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean2;
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean3;
+import org.apache.tuscany.sca.itest.databindings.jaxb.Bean31;
+
+
+/**
+ * GenericsTransformer class that provide for transforming input provided to GenericsService methods.
+ *
+ * @version $Rev$ $Date$
+ */
+public class GenericsTransformer {
+
+ public static Bean1<String> getTypeExplicit(Bean1<String> arg) {
+ return new Bean1<String>(arg.getItem() == null ? null : arg.getItem()+" AA");
+ }
+
+ public static <T> Bean1<T> getTypeUnbound(T[] arg) {
+ if(arg instanceof String[]) {
+ return new Bean1<T>(arg[0]);
+ } else if(arg instanceof Integer[]){
+ return new Bean1<T>(arg[1]);
+ } else {
+ return new Bean1<T>(arg[2]);
+ }
+ }
+
+ public static <T extends Bean2> Bean1<T> getTypeExtends(T[] arg) {
+ if(arg instanceof Bean3[]) {
+ return new Bean1<T>(arg[0]);
+ } else if(arg instanceof Bean31[]) {
+ return new Bean1<T>(arg[1]);
+ } else {
+ return new Bean1<T>(arg[2]);
+ }
+ }
+
+ public static <T extends Bean1<String>> Bean1<T> getRecursiveTypeBound(T[] arg) {
+ if(arg instanceof Bean10[]) {
+ return new Bean1<T>(arg[0]);
+ } else if(arg instanceof Bean11[]) {
+ return new Bean1<T>(arg[1]);
+ } else {
+ return new Bean1<T>(arg[2]);
+ }
+ }
+
+ public static Bean1<?> getWildcardUnbound(Bean1<?> arg) {
+ if(arg.getItem() instanceof String) {
+ Bean1<String> temp = new Bean1<String>();
+ temp.setItem("Hello "+arg.getItem());
+ return temp;
+ } else if(arg.getItem() instanceof Integer) {
+ Bean1<Integer> temp = new Bean1<Integer>();
+ temp.setItem(10+(Integer)arg.getItem());
+ return temp;
+ } else {
+ return new Bean1<String>(arg.toString());
+ }
+ }
+
+ public static Bean1<? super Bean3> getWildcardSuper(Bean1<? super Bean3> arg) {
+ Object item = arg.getItem();
+ if(item instanceof Bean3) {
+ Bean3 temp = new Bean3();
+ temp.setName("Hello " + ((Bean3)item).getName());
+ temp.setAddress("New "+((Bean3)item).getAddress());
+ return new Bean1<Bean3>(temp);
+ } else if(item instanceof Bean2) {
+ Bean2 temp = new Bean2();
+ temp.setName("Hello " + ((Bean3)item).getName());
+ return new Bean1<Bean2>(temp);
+ } else {
+ Bean2 temp = new Bean2();
+ temp.setName(item.toString());
+ return new Bean1<Bean2>(temp);
+ }
+ }
+
+ public static Bean1<? extends Bean2> getWildcardExtends(Bean1<? extends Bean2> arg) {
+ Bean2 item = arg.getItem();
+ if(item instanceof Bean3) {
+ Bean3 temp = new Bean3();
+ temp.setName("Hello "+item.getName());
+ temp.setAddress("New "+((Bean3)item).getAddress());
+ return new Bean1<Bean3>(temp);
+ } else if(item instanceof Bean31) {
+ Bean31 temp = new Bean31();
+ temp.setName("Hello "+item.getName());
+ temp.setAddress("New "+((Bean31)item).getAddress());
+ return new Bean1<Bean31>(temp);
+ } else {
+ Bean2 temp = new Bean2();
+ temp.setName("Hello "+item.getName());
+ return new Bean1<Bean2>(temp);
+ }
+ }
+
+ public static Bean2 getPolymorphic(Bean2 arg) {
+ return arg;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloLocalServiceSimpleClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloLocalServiceSimpleClientImpl.java
new file mode 100644
index 0000000000..51e48edbc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloLocalServiceSimpleClientImpl.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.itest.databindings.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloLocalServiceSimple;
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceSimpleClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of HelloServiceSimpleClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ */
+@Service(HelloServiceSimpleClient.class)
+public class HelloLocalServiceSimpleClientImpl implements HelloServiceSimpleClient {
+
+ private HelloLocalServiceSimple service;
+
+ @Reference(required=false)
+ protected void setHelloLocalServiceSimple(HelloLocalServiceSimple service) {
+ this.service = service;
+ }
+
+ public String getGreetingsForward(String name) {
+ return service.getGreetings(name);
+ }
+
+ public String[] getGreetingsArrayForward(String[] names) {
+ return service.getGreetingsArray(names);
+ }
+
+ public List<String> getGreetingsListForward(List<String> names) {
+ return service.getGreetingsList(names);
+ }
+
+ public Map<String, String> getGreetingsMapForward(Map<String, String> namesMap) {
+ return service.getGreetingsMap(namesMap);
+ }
+
+ public ArrayList<String> getGreetingsArrayListForward(ArrayList<String> names) {
+ return service.getGreetingsArrayList(names);
+ }
+
+ public HashMap<String, String> getGreetingsHashMapForward(HashMap<String, String> namesMap) {
+ return service.getGreetingsHashMap(namesMap);
+ }
+
+ public String getGreetingsVarArgsForward(String... names) {
+ return service.getGreetingsVarArgs(names[0], names[1], names[2]);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceSimpleClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceSimpleClientImpl.java
new file mode 100644
index 0000000000..de52cdfac3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceSimpleClientImpl.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.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceSimple;
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceSimpleClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of HelloServiceSimpleClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ */
+@Service(HelloServiceSimpleClient.class)
+public class HelloServiceSimpleClientImpl extends HelloLocalServiceSimpleClientImpl {
+
+ @Reference
+ public void setHelloServiceSimple(HelloServiceSimple service) {
+ super.setHelloLocalServiceSimple(service);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceSimpleImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceSimpleImpl.java
new file mode 100644
index 0000000000..199335c38c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceSimpleImpl.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.itest.databindings.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloLocalServiceSimple;
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceSimple;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of HelloServiceSimple.
+ * The implementation provides both a local and a remotable service.
+ */
+@Service(interfaces = {HelloServiceSimple.class, HelloLocalServiceSimple.class})
+public class HelloServiceSimpleImpl implements HelloServiceSimple {
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ public String[] getGreetingsArray(String[] names) {
+ String[] resps = new String[names.length];
+ for (int i = 0; i < names.length; ++i) {
+ resps[i] = "Hello " + names[i];
+ }
+ return resps;
+ }
+
+ public List<String> getGreetingsList(List<String> names) {
+ List<String> resps = new ArrayList<String>();
+ for (int i = 0; i < names.size(); ++i) {
+ resps.add("Hello " + names.get(i));
+ }
+ return resps;
+ }
+
+ public ArrayList<String> getGreetingsArrayList(ArrayList<String> names) {
+ ArrayList<String> resps = new ArrayList<String>();
+ for (int i = 0; i < names.size(); ++i) {
+ resps.add("Hello " + names.get(i));
+ }
+ return resps;
+ }
+
+ public Map<String, String> getGreetingsMap(Map<String, String> namesMap) {
+ for (Map.Entry<String, String> entry : namesMap.entrySet()) {
+ entry.setValue("Hello " + entry.getKey());
+ }
+ return namesMap;
+ }
+
+ public HashMap<String, String> getGreetingsHashMap(HashMap<String, String> namesMap) {
+ for (Map.Entry<String, String> entry : namesMap.entrySet()) {
+ entry.setValue("Hello " + entry.getKey());
+ }
+ return namesMap;
+ }
+
+ public String getGreetingsVarArgs(String... names) {
+ String resp = "Hello";
+ for(int i = 0; i < names.length; ++i) {
+ resp += (" "+names[i]);
+ }
+ return resp;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesLocalServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesLocalServiceClientImpl.java
new file mode 100644
index 0000000000..fe9121be9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesLocalServiceClientImpl.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesLocalService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesServiceClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of PrimitivesLocalServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ */
+@Service(PrimitivesServiceClient.class)
+public class PrimitivesLocalServiceClientImpl implements PrimitivesServiceClient {
+
+ private PrimitivesLocalService service;
+
+ @Reference(required=false)
+ protected void setPrimitivesLocalService(PrimitivesLocalService service) {
+ this.service = service;
+ }
+
+ public boolean negateBooleanForward(boolean flag) {
+ return service.negateBoolean(flag);
+ }
+
+ public boolean[] negateBooleanArrayForward(boolean[] flags) {
+ return service.negateBooleanArray(flags);
+ }
+
+ public boolean passByValueBooleanArray() {
+ boolean[] req = new boolean[2];
+ boolean[] resp = service.identityBooleanArray(req);
+ return req != resp;
+ }
+
+ public byte negateByteForward(byte b) {
+ return service.negateByte(b);
+ }
+
+ public byte[] negateByteArrayForward(byte[] ba) {
+ return service.negateByteArray(ba);
+ }
+
+ public boolean passByValueByteArray() {
+ byte[] req = new byte[2];
+ byte[] resp = service.identityByteArray(req);
+ return req != resp;
+ }
+
+ public short negateShortForward(short s) {
+ return service.negateShort(s);
+ }
+
+ public short[] negateShortArrayForward(short[] s) {
+ return service.negateShortArray(s);
+ }
+
+ public boolean passByValueShortArray() {
+ short[] req = new short[2];
+ short[] resp = service.identityShortArray(req);
+ return req != resp;
+ }
+
+ public int negateIntForward(int i) {
+ return service.negateInt(i);
+ }
+
+ public int[] negateIntArrayForward(int[] ia) {
+ return service.negateIntArray(ia);
+ }
+
+ public boolean passByValueIntArray() {
+ int[] req = new int[2];
+ int[] resp = service.identityIntArray(req);
+ return req != resp;
+ }
+
+ public long negateLongForward(long l) {
+ return service.negateLong(l);
+ }
+
+ public long[] negateLongArrayForward(long[] la) {
+ return service.negateLongArray(la);
+ }
+
+ public boolean passByValueLongArray() {
+ long[] req = new long[2];
+ long[] resp = service.identityLongArray(req);
+ return req != resp;
+ }
+
+ public float negateFloatForward(float f) {
+ return service.negateFloat(f);
+ }
+
+ public float[] negateFloatArrayForward(float[] fa) {
+ return service.negateFloatArray(fa);
+ }
+
+ public boolean passByValueFloatArray() {
+ float[] req = new float[2];
+ float[] resp = service.identityFloatArray(req);
+ return req != resp;
+ }
+
+ public double negateDoubleForward(double d) {
+ return service.negateDouble(d);
+ }
+
+ public double[] negateDoubleArrayForward(double[] da) {
+ return service.negateDoubleArray(da);
+ }
+
+ public boolean passByValueDoubleArray() {
+ double[] req = new double[2];
+ double[] resp = service.identityDoubleArray(req);
+ return req != resp;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java
new file mode 100644
index 0000000000..28ace6aab7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.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.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesServiceClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of PrimitivesServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ */
+@Service(PrimitivesServiceClient.class)
+public class PrimitivesServiceClientImpl extends PrimitivesLocalServiceClientImpl {
+
+ @Reference
+ public void setPrimitivesService(PrimitivesService service) {
+ super.setPrimitivesLocalService(service);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java
new file mode 100644
index 0000000000..ab1a3b4ab8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.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.itest.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesLocalService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of PrimitivesService.
+ * This implementation provides both a local and a remotable service.
+ */
+@Service(interfaces={PrimitivesService.class, PrimitivesLocalService.class})
+public class PrimitivesServiceImpl implements PrimitivesService, PrimitivesLocalService {
+
+ public boolean negateBoolean(boolean flag) {
+ return !flag;
+ }
+
+ public boolean[] negateBooleanArray(boolean[] flags) {
+ boolean[] resp = new boolean[flags.length];
+
+ for(int i = 0; i < flags.length; ++i) {
+ resp[i] = !flags[i];
+ }
+ return resp;
+ }
+
+ public boolean[] identityBooleanArray(boolean[] flags) {
+ return flags;
+ }
+
+ public byte negateByte(byte b) {
+ return (byte)-b;
+ }
+
+ public byte[] negateByteArray(byte[] ba) {
+ byte[] resp = new byte[ba.length];
+
+ for(int i = 0; i < ba.length; ++i) {
+ resp[i] = (byte)-ba[i];
+ }
+ return resp;
+ }
+
+ public byte[] identityByteArray(byte[] ba) {
+ return ba;
+ }
+
+ public short negateShort(short s) {
+ return (short)-s;
+ }
+
+ public short[] negateShortArray(short[] s) {
+ short[] resp = new short[s.length];
+
+ for(int i = 0; i < s.length; ++i) {
+ resp[i] = (short)-s[i];
+ }
+ return resp;
+ }
+
+ public short[] identityShortArray(short[] sa) {
+ return sa;
+ }
+
+ public int negateInt(int i) {
+ return -i;
+ }
+
+ public int[] negateIntArray(int[] ia) {
+ int[] resp = new int[ia.length];
+
+ for(int i = 0; i < ia.length; ++i) {
+ resp[i] = -ia[i];
+ }
+ return resp;
+ }
+
+ public int[] identityIntArray(int[] ia) {
+ return ia;
+ }
+
+ public long negateLong(long l) {
+ return -l;
+ }
+
+ public long[] negateLongArray(long[] la) {
+ long[] resp = new long[la.length];
+
+ for(int i = 0; i < la.length; ++i) {
+ resp[i] = -la[i];
+ }
+ return resp;
+ }
+
+ public long[] identityLongArray(long[] la) {
+ return la;
+ }
+
+ public float negateFloat(float f) {
+ return -f;
+ }
+
+ public float[] negateFloatArray(float[] fa) {
+ float[] resp = new float[fa.length];
+
+ for(int i = 0; i < fa.length; ++i) {
+ resp[i] = -fa[i];
+ }
+ return resp;
+ }
+
+ public float[] identityFloatArray(float[] fa) {
+ return fa;
+ }
+
+ public double negateDouble(double d) {
+ return -d;
+ }
+
+ public double[] negateDoubleArray(double[] da) {
+ double[] resp = new double[da.length];
+
+ for(int i = 0; i < da.length; ++i) {
+ resp[i] = -da[i];
+ }
+ return resp;
+ }
+
+ public double[] identityDoubleArray(double[] da) {
+ return da;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesLocalServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesLocalServiceClientImpl.java
new file mode 100644
index 0000000000..0a8f6772b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesLocalServiceClientImpl.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.itest.databindings.jaxb.impl;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesLocalService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesServiceClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of StandardTypesLocalServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ */
+@Service(StandardTypesServiceClient.class)
+public class StandardTypesLocalServiceClientImpl implements StandardTypesServiceClient {
+
+ private StandardTypesLocalService service;
+
+ @Reference(required=false)
+ protected void setStandardTypesLocalService(StandardTypesLocalService service) {
+ this.service = service;
+ }
+
+ public BigInteger getNewBigIntegerForward(BigInteger bi) {
+ return service.getNewBigInteger(bi);
+ }
+
+ public BigInteger[] getNewBigIntegerArrayForward(BigInteger[] bia) {
+ return service.getNewBigIntegerArray(bia);
+ }
+
+ public BigDecimal getNewBigDecimalForward(BigDecimal bd) {
+ return service.getNewBigDecimal(bd);
+ }
+
+ public BigDecimal[] getNewBigDecimalArrayForward(BigDecimal[] bda) {
+ return service.getNewBigDecimalArray(bda);
+ }
+ public Calendar getNewCalendarForward(Calendar c) {
+ return service.getNewCalendar(c);
+ }
+ public Calendar[] getNewCalendarArrayForward(Calendar[] ca) {
+ return service.getNewCalendarArray(ca);
+ }
+
+ public Date getNewDateForward(Date d) {
+ return service.getNewDate(d);
+ }
+
+ public Date[] getNewDateArrayForward(Date[] da) {
+ return service.getNewDateArray(da);
+ }
+
+ public QName getNewQNameForward(QName qname) {
+ return service.getNewQName(qname);
+ }
+
+ public QName[] getNewQNameArrayForward(QName[] qnames) {
+ return service.getNewQNameArray(qnames);
+ }
+
+ public URI getNewURIForward(URI uri) {
+ return service.getNewURI(uri);
+ }
+
+ public URI[] getNewURIArrayForward(URI[] uris) {
+ return service.getNewURIArray(uris);
+ }
+
+ public XMLGregorianCalendar getNewXMLGregorianCalendarForward(XMLGregorianCalendar xgcal) {
+ return service.getNewXMLGregorianCalendar(xgcal);
+ }
+
+ public XMLGregorianCalendar[] getNewXMLGregorianCalendarArrayForward(XMLGregorianCalendar[] xgcals) {
+ return service.getNewXMLGregorianCalendarArray(xgcals);
+ }
+
+ public Duration getNewDurationForward(Duration d) {
+ return service.getNewDuration(d);
+ }
+
+ public Duration[] getNewDurationArrayForward(Duration[] da) {
+ return service.getNewDurationArray(da);
+ }
+
+ public Object getNewObjectForward(Object obj) {
+ return service.getNewObject(obj);
+ }
+
+ public Object[] getNewObjectArrayForward(Object[] objs) {
+ return service.getNewObjectArray(objs);
+ }
+
+ public Image getNewImageForward(Image img) {
+ return service.getNewImage(img);
+ }
+
+ public Image[] getNewImageArrayForward(Image[] imgs) {
+ return service.getNewImageArray(imgs);
+ }
+
+ public DataHandler getNewDataHandlerForward(DataHandler dh) {
+ return service.getNewDataHandler(dh);
+ }
+
+ public DataHandler[] getNewDataHandlerArrayForward(DataHandler[] dha) {
+ return service.getNewDataHandlerArray(dha);
+ }
+
+
+ public Source getNewSourceForward(Source src) {
+ return service.getNewSource(src);
+ }
+
+ public Source[] getNewSourceArrayForward(Source[] srcs) {
+ return service.getNewSourceArray(srcs);
+ }
+
+ public UUID getNewUUIDForward(UUID uuid) {
+ return service.getNewUUID(uuid);
+ }
+
+ public UUID[] getNewUUIDArrayForward(UUID[] uuids) {
+ return service.getNewUUIDArray(uuids);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java
new file mode 100644
index 0000000000..626b0e9844
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.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.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesServiceClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of StandardTypesServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ */
+@Service(StandardTypesServiceClient.class)
+public class StandardTypesServiceClientImpl extends StandardTypesLocalServiceClientImpl {
+
+ @Reference
+ public void setStandardTypesService(StandardTypesService service) {
+ super.setStandardTypesLocalService(service);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java
new file mode 100644
index 0000000000..19a6cae01b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb.impl;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesLocalService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of StandardTypesService.
+ * This implementation provides both a local and a remotable service.
+ */
+@Service(interfaces={StandardTypesService.class, StandardTypesLocalService.class})
+public class StandardTypesServiceImpl implements StandardTypesService, StandardTypesLocalService {
+
+ public BigInteger getNewBigInteger(BigInteger bi) {
+ return bi.negate();
+ }
+
+ public BigInteger[] getNewBigIntegerArray(BigInteger[] bia) {
+ BigInteger[] resp = new BigInteger[bia.length];
+ for(int i = 0; i < bia.length; ++i) {
+ resp[i] = bia[i].negate();
+ }
+ return resp;
+ }
+
+ public BigDecimal getNewBigDecimal(BigDecimal bd) {
+ return bd.negate();
+ }
+
+ public BigDecimal[] getNewBigDecimalArray(BigDecimal[] bda) {
+ BigDecimal[] resp = new BigDecimal[bda.length];
+ for(int i = 0; i < bda.length; ++i) {
+ resp[i] = bda[i].negate();
+ }
+ return resp;
+ }
+
+ public Calendar getNewCalendar(Calendar c) {
+ Calendar resp = (Calendar)c.clone();
+ resp.add(Calendar.DAY_OF_MONTH, 5);
+ return resp;
+ }
+
+ public Calendar[] getNewCalendarArray(Calendar[] ca) {
+ Calendar[] resp = new Calendar[ca.length];
+ for(int i = 0; i < ca.length; ++i) {
+ resp[i] = getNewCalendar(ca[i]);
+ }
+ return resp;
+ }
+
+ public Date getNewDate(Date d) {
+ return new Date(d.getTime() + 5*24*60*60*1000);
+ }
+
+ public Date[] getNewDateArray(Date[] da) {
+ Date[] resp = new Date[da.length];
+ for(int i = 0; i < da.length; ++i) {
+ resp[i] = getNewDate(da[i]);
+ }
+ return resp;
+ }
+
+ public QName getNewQName(QName qname) {
+ return new QName(qname.getNamespaceURI()+"q", qname.getLocalPart()+"q", qname.getPrefix()+"q");
+
+ }
+
+ public QName[] getNewQNameArray(QName[] qnames) {
+ QName[] resp = new QName[qnames.length];
+ for(int i = 0; i < qnames.length; ++i) {
+ resp[i] = getNewQName(qnames[i]);
+ }
+ return resp;
+ }
+
+ public URI getNewURI(URI uri) {
+ return uri.resolve("uri");
+ }
+
+ public URI[] getNewURIArray(URI[] uris) {
+ URI[] resp = new URI[uris.length];
+ for(int i = 0; i < uris.length; ++i) {
+ resp[i] = getNewURI(uris[i]);
+ }
+ return resp;
+ }
+
+ public XMLGregorianCalendar getNewXMLGregorianCalendar(XMLGregorianCalendar xgcal) {
+ xgcal = (XMLGregorianCalendar)xgcal.clone();
+ xgcal.setDay(xgcal.getDay()+5);
+ return xgcal;
+ }
+
+ public XMLGregorianCalendar[] getNewXMLGregorianCalendarArray(XMLGregorianCalendar[] xgcals) {
+ XMLGregorianCalendar[] resp = new XMLGregorianCalendar[xgcals.length];
+ for(int i = 0; i < xgcals.length; ++i) {
+ resp[i] = getNewXMLGregorianCalendar(xgcals[i]);
+ }
+ return resp;
+ }
+
+ public Duration getNewDuration(Duration d) {
+ return d.negate();
+ }
+
+ public Duration[] getNewDurationArray(Duration[] da) {
+ Duration[] resp = new Duration[da.length];
+ for(int i = 0; i < da.length; ++i) {
+ resp[i] = da[i].negate();
+ }
+ return resp;
+ }
+
+ public Object getNewObject(Object obj) {
+ return StandardTypesTransformer.getNewObject(obj);
+ }
+
+ public Object[] getNewObjectArray(Object[] objs) {
+ Object[] resp = new Object[objs.length];
+ for(int i = 0; i < objs.length; ++i) {
+ resp[i] = getNewObject(objs[i]);
+ }
+ return resp;
+ }
+
+ public Image getNewImage(Image img) {
+ return StandardTypesTransformer.getNewImage(img);
+ }
+
+ public Image[] getNewImageArray(Image[] imgs) {
+ Image[] resp = new Image[imgs.length];
+ for(int i = 0; i < imgs.length; ++i) {
+ resp[i] = getNewImage(imgs[i]);
+ }
+ return resp;
+ }
+
+ public DataHandler getNewDataHandler(DataHandler dh) {
+ // FIXME: transform the input
+ return dh;
+ }
+
+ public DataHandler[] getNewDataHandlerArray(DataHandler[] dha) {
+ DataHandler[] resp = new DataHandler[dha.length];
+ for(int i = 0; i < dha.length; ++i) {
+ resp[i] = dha[i];
+ }
+ return resp;
+ }
+
+ public Source getNewSource(Source src) {
+ return StandardTypesTransformer.getNewSource(src);
+ }
+
+ public Source[] getNewSourceArray(Source[] srcs) {
+ Source[] resp = new Source[srcs.length];
+ for(int i = 0; i < srcs.length; ++i) {
+ resp[i] = getNewSource(srcs[i]);
+ }
+ return resp;
+ }
+
+ public UUID getNewUUID(UUID uuid) {
+ return UUID.fromString(uuid.toString()+"AAA");
+ }
+
+ public UUID[] getNewUUIDArray(UUID[] uuids) {
+ UUID[] resp = new UUID[uuids.length];
+ for(int i = 0; i < uuids.length; ++i) {
+ resp[i] = getNewUUID(uuids[i]);
+ }
+ return resp;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java
new file mode 100644
index 0000000000..68510b4b03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.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.itest.databindings.jaxb.impl;
+
+import java.awt.Image;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayReader;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+
+
+
+/**
+ * StandardTypesTransformer class that provide for transforming input provided to StandardTypesService methods.
+ *
+ * @version $Rev$ $Date$
+ */
+public class StandardTypesTransformer {
+
+ public static Object getNewObject(Object obj) {
+ if(obj instanceof String) {
+ return "Hello "+obj;
+ } else if(obj instanceof Integer) {
+ return new Integer(-((Integer)obj).intValue());
+ } else if(obj instanceof Double) {
+ return new Double(-((Double)obj).doubleValue());
+ }
+
+ return obj;
+ }
+
+ /**
+ * Returns a copy of the source object if the input is DOMSource, SAXSource or StreamSource.
+ * Returns the input object as is for other types.
+ */
+ public static Source getNewSource(Source src) {
+ Source ret = null;
+ if(src instanceof DOMSource) {
+ DOMSource dsrc = (DOMSource)src;
+ ret = new DOMSource(dsrc.getNode() != null ? dsrc.getNode().cloneNode(true) : null);
+ } else if(src instanceof SAXSource) {
+ SAXSource ssrc = (SAXSource)src;
+ if(ssrc.getInputSource().getByteStream() != null) {
+ InputStream inp = ssrc.getInputSource().getByteStream();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ int b;
+ try {
+ while((b = inp.read()) != -1) {
+ bout.write(b);
+ }
+ } catch (IOException ignored) {
+ }
+ try { bout.close();} catch (IOException ignored) {}
+ try { inp.reset();} catch (IOException ignored) {}
+ ret = new SAXSource(new InputSource(new ByteArrayInputStream(bout.toByteArray())));
+ } else if(ssrc.getInputSource().getCharacterStream() != null) {
+ Reader rdr = ssrc.getInputSource().getCharacterStream();
+ CharArrayWriter caw = new CharArrayWriter();
+ try {
+ int c;
+ while((c = rdr.read()) != -1) {
+ caw.append((char)c);
+ }
+ } catch (IOException ignored) {
+ }
+ caw.close();
+ try{ rdr.reset();} catch(IOException ignored) {}
+ ret = new SAXSource(new InputSource(new CharArrayReader(caw.toCharArray())));
+ } else {
+ ret = new SAXSource();
+ }
+ } else if(src instanceof StreamSource) {
+ StreamSource ssrc = (StreamSource)src;
+ if(ssrc.getInputStream() != null) {
+ InputStream inp = ssrc.getInputStream();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ int b;
+ try {
+ while((b = inp.read()) != -1) {
+ bout.write(b);
+ }
+ } catch (IOException ignored) {
+ }
+ try { bout.close();} catch (IOException ignored) {}
+ try { inp.reset();} catch (IOException ignored) {}
+ ret = new StreamSource(new ByteArrayInputStream(bout.toByteArray()));
+ } else if(ssrc.getReader() != null) {
+ Reader rdr = ssrc.getReader();
+ CharArrayWriter caw = new CharArrayWriter();
+ try {
+ int c;
+ while((c = rdr.read()) != -1) {
+ caw.append((char)c);
+ }
+ } catch (IOException ignored) {
+ }
+ caw.close();
+ try{ rdr.reset();} catch(IOException ignored) {}
+ ret = new StreamSource(new CharArrayReader(caw.toCharArray()));
+ } else {
+ ret = new StreamSource();
+ }
+ }
+
+ if(ret != null) {
+ ret.setSystemId(src.getSystemId());
+ } else {
+ ret = src;
+ }
+ return ret;
+ }
+
+ public static Image getNewImage(Image arg) {
+ arg.getGraphics().drawOval(2, 2, 7, 7);
+ return arg;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl
new file mode 100644
index 0000000000..10a242be4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://jaxb.databindings.itest.sca.tuscany.apache.org"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:ns0="http://jaxb.databindings.itest.sca.tuscany.apache.org"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns1="http://org.apache.axis2/xsd"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org" xmlns:ns="http://jaxb.databindings.itest.sca.tuscany.apache.org">
+ <xs:element name="getGreetings" nillable="true" type="xs:string"/>
+ <xs:element name="getGreetingsResponse" nillable="true" type="xs:string"/>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part name="parameters" element="ns0:getGreetings"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part name="parameters" element="ns0:getGreetingsResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="AServicePortType">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="ns0:getGreetingsRequest" wsaw:Action="urn:getGreetings"/>
+ <wsdl:output message="ns0:getGreetingsResponse" wsaw:Action="urn:getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AServiceSOAP12Binding" type="ns0:AServicePortType">
+ <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <soap12:operation soapAction="urn:getGreetings" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="AServicePortTypeBinding" type="ns0:AServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <soap:operation soapAction=""/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="AServiceHttpBinding" type="ns0:AServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="getGreetings">
+ <http:operation location="AService/getGreetings"/>
+ <wsdl:input>
+ <mime:content part="getGreetings" type="text/xml"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="getGreetings" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="AServiceSOAP11Binding" type="ns0:AServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <soap:operation soapAction="urn:getGreetings" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AServicePortTypeService">
+ <wsdl:port name="AServicePortTypePort" binding="ns0:AServicePortTypeBinding">
+ <soap:address location="http://localhost:8080/AService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <wsdl:service name="AService">
+ <wsdl:port name="AServiceHttpport" binding="ns0:AServiceHttpBinding">
+ <http:address location="http://localhost:8080/AService/httpport"/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP12port_http" binding="ns0:AServiceSOAP12Binding">
+ <soap12:address location="http://localhost:8080/AService/soap12port"/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP11port_http" binding="ns0:AServiceSOAP11Binding">
+ <soap:address location="http://localhost:8080/AService/soap11port"/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP12port_http_null" binding="ns0:AServiceSOAP12Binding">
+ <soap12:address location=""/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP12port_http_wsdl" binding="ns0:AServiceSOAP12Binding">
+ <soap12:address location="inWsdl"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite
new file mode 100644
index 0000000000..5ecbb9edee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.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://itest" name="doclitbarewsdltest">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.AServiceImpl"/>
+ <service name="AService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org#wsdl.interface(AServicePortType)"/>
+ <binding.ws uri="http://localhost:8085/AService/endpointref"/>
+ </service>
+ </component>
+ <component name="AClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <!--interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org#wsdl.interface(AServicePortType)"/-->
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.AService"/>
+ <binding.ws uri="http://localhost:8085/AService/endpointref"/>
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/generics-service.composite b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/generics-service.composite
new file mode 100644
index 0000000000..2d47ba7b14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/generics-service.composite
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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$ -->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="GenericsService">
+
+ <!-- Clients to test the service -->
+ <!-- A GenericsServiceClient component that uses WS binding to invoke GenericsService -->
+ <component name="GenericsServiceClientWSComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.GenericsServiceClientImpl" />
+ <reference name="genericsService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.GenericsService"/>
+ <binding.ws uri="http://localhost:8085/gs-ep"/>
+ </reference>
+ </component>
+
+ <!-- A GenericsServiceClient component that uses SCA binding to invoke GenericsService service -->
+ <component name="GenericsServiceClientSCAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.GenericsServiceClientImpl" />
+ <reference name="genericsService" target="GenericsServiceComponent/GenericsService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.GenericsService"/>
+ <binding.sca/>
+ </reference>
+ </component>
+
+ <!-- A GenericsLocalServiceClient component that uses SCA binding to invoke GenericsLocalService service -->
+ <component name="GenericsLocalServiceClientSCAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.GenericsLocalServiceClientImpl" />
+ <reference name="genericsLocalService" target="GenericsServiceComponent/GenericsLocalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.GenericsLocalService"/>
+ <binding.sca/>
+ </reference>
+ </component>
+
+ <!-- Components used to implement the services -->
+ <!-- A GenericsService component. -->
+ <component name="GenericsServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.GenericsServiceImpl"/>
+ <service name="GenericsService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.GenericsService"/>
+ <binding.ws uri="http://localhost:8085/gs-ep"/>
+ <binding.sca/>
+ </service>
+ <service name="GenericsLocalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.GenericsLocalService"/>
+ <binding.sca/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/helloservice.composite b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/helloservice.composite
new file mode 100644
index 0000000000..c39cf21002
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/helloservice.composite
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="HelloService">
+
+ <!-- Clients to test the service -->
+ <!-- A HelloServiceSimpleClient component that uses WS binding to invoke HelloServiceSimple service -->
+ <component name="HelloServiceSimpleClientWSComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloServiceSimpleClientImpl" />
+ <reference name="helloServiceSimple">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceSimple"/>
+ <binding.ws uri="http://localhost:8085/hs-ep0"/>
+ </reference>
+ </component>
+
+ <!-- A HelloServiceSimpleClient component that uses SCA binding to invoke HelloServiceSimple service -->
+ <component name="HelloServiceSimpleClientSCAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloServiceSimpleClientImpl" />
+ <reference name="helloServiceSimple" target="HelloServiceSimpleComponent/HelloServiceSimple">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceSimple"/>
+ <binding.sca/>
+ </reference>
+ </component>
+
+ <!-- A HelloLocalServiceSimpleClient component that uses SCA binding to invoke HelloLocalServiceSimple service -->
+ <component name="HelloLocalServiceSimpleClientSCAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloLocalServiceSimpleClientImpl" />
+ <reference name="helloLocalServiceSimple" target="HelloServiceSimpleComponent/HelloLocalServiceSimple">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.HelloLocalServiceSimple"/>
+ <binding.sca/>
+ </reference>
+ </component>
+
+ <!-- Components used to implement the services -->
+ <!-- A HelloServiceSimple component. -->
+ <component name="HelloServiceSimpleComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloServiceSimpleImpl"/>
+ <service name="HelloServiceSimple">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceSimple"/>
+ <binding.ws uri="http://localhost:8085/hs-ep0"/>
+ <binding.sca/>
+ </service>
+ <service name="HelloLocalServiceSimple">
+ <binding.sca/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/primitivesservice.composite b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/primitivesservice.composite
new file mode 100644
index 0000000000..4b0a6e215d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/primitivesservice.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="PrimitivesService">
+
+ <!-- Clients to test the service -->
+ <!-- A PrimitivesServiceClient component that uses WS binding to invoke PrimitivesService -->
+ <component name="PrimitivesServiceClientWSComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.PrimitivesServiceClientImpl" />
+ <reference name="primitivesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService"/>
+ <binding.ws uri="http://localhost:8085/ps-ep"/>
+ </reference>
+ </component>
+
+ <!-- A PrimitivesServiceClient component that uses SCA binding to invoke PrimitivesService service -->
+ <component name="PrimitivesServiceClientSCAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.PrimitivesServiceClientImpl" />
+ <reference name="primitivesService" target="PrimitivesServiceComponent/PrimitivesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService"/>
+ <binding.sca/>
+ </reference>
+ </component>
+
+ <!-- A PrimitivesLocalServiceClient component that uses SCA binding to invoke PrimitivesLocalService service -->
+ <component name="PrimitivesLocalServiceClientSCAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.PrimitivesLocalServiceClientImpl" />
+ <reference name="primitivesLocalService" target="PrimitivesServiceComponent/PrimitivesLocalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesLocalService"/>
+ <binding.sca/>
+ </reference>
+ </component>
+
+ <!-- Components used to implement the services -->
+ <!-- A PrimitivesService component. -->
+ <component name="PrimitivesServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.PrimitivesServiceImpl"/>
+ <service name="PrimitivesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService"/>
+ <binding.ws uri="http://localhost:8085/ps-ep"/>
+ <binding.sca/>
+ </service>
+ <service name="PrimitivesLocalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesLocalService"/>
+ <binding.sca/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/standard-types-service.composite b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/standard-types-service.composite
new file mode 100644
index 0000000000..13ef73c082
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/main/resources/standard-types-service.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="StandardTypesService">
+
+ <!-- Clients to test the service -->
+ <!-- A StandardTypesServiceClient component that uses WS binding to invoke StandardTypesService -->
+ <component name="StandardTypesServiceClientWSComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesServiceClientImpl" />
+ <reference name="standardTypesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService"/>
+ <binding.ws uri="http://localhost:8085/sts-ep"/>
+ </reference>
+ </component>
+
+ <!-- A StandardTypesServiceClient component that uses SCA binding to invoke StandardTypesService service -->
+ <component name="StandardTypesServiceClientSCAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesServiceClientImpl" />
+ <reference name="standardTypesService" target="StandardTypesServiceComponent/StandardTypesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService"/>
+ <binding.sca/>
+ </reference>
+ </component>
+
+ <!-- A StandardTypesLocalServiceClient component that uses SCA binding to invoke StandardTypesLocalService service -->
+ <component name="StandardTypesLocalServiceClientSCAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesLocalServiceClientImpl" />
+ <reference name="standardTypesLocalService" target="StandardTypesServiceComponent/StandardTypesLocalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesLocalService"/>
+ <binding.sca/>
+ </reference>
+ </component>
+
+ <!-- Components used to implement the services -->
+ <!-- A StandardTypesService component. -->
+ <component name="StandardTypesServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesServiceImpl"/>
+ <service name="StandardTypesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService"/>
+ <binding.ws uri="http://localhost:8085/sts-ep"/>
+ <binding.sca/>
+ </service>
+ <service name="StandardTypesLocalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesLocalService"/>
+ <binding.sca/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DatabindingTestCase.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DatabindingTestCase.java
new file mode 100644
index 0000000000..4967b896a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DatabindingTestCase.java
@@ -0,0 +1,339 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DatabindingTestCase {
+
+ private static SCADomain domain;
+
+ /**
+ * Runs once before running the tests
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("helloservice.composite");
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Runs once after running the tests
+ */
+ @AfterClass
+ public static void tearDown() {
+ domain.close();
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using SCA binding.
+ * Service method invoked is getGreetings.
+ */
+ @Test
+ public void testSCA() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientSCAComponent");
+ performTest(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsArray.
+ */
+ @Test
+ public void testSCAArray() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientSCAComponent");
+ performTestArray(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsList.
+ */
+ @Test
+ public void testSCAList() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientSCAComponent");
+ performTestList(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsArrayList.
+ */
+ @Test
+ public void testSCAArrayList() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientSCAComponent");
+ performTestArrayList(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsMap.
+ */
+ @Test
+ public void testSCAMap() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientSCAComponent");
+ performTestMap(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsHashMap.
+ */
+ @Test
+ public void testSCAHashMap() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientSCAComponent");
+ performTestHashMap(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsVarArgs.
+ */
+ @Test
+ public void testSCAVarArgs() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientSCAComponent");
+ performTestVarArgs(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using WS binding.
+ * Service method invoked is getGreetings.
+ */
+ @Test
+ public void testWS() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientWSComponent");
+ performTest(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using WS binding.
+ * Service method invoked is getGreetingsArray.
+ */
+ @Test
+ public void testWSArray() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientWSComponent");
+ performTestArray(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using WS binding.
+ * Service method invoked is getGreetingsList.
+ */
+ @Test
+ public void testWSList() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientWSComponent");
+ performTestList(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using WS binding.
+ * Service method invoked is getGreetingsArrayList.
+ */
+ @Test
+ public void testWSArrayList() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientWSComponent");
+ performTestArrayList(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using WS binding.
+ * Service method invoked is getGreetingsMap.
+ */
+ @Test
+ public void testWSMap() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientWSComponent");
+ performTestMap(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using WS binding.
+ * Service method invoked is getGreetingsHashMap.
+ */
+ @Test
+ public void testWSHashMap() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientWSComponent");
+ performTestHashMap(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloServiceSimple service using WS binding.
+ * Service method invoked is getGreetingsVarArgs.
+ */
+ @Test
+ public void testWSVarArgs() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloServiceSimpleClientWSComponent");
+ performTestVarArgs(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloLocalServiceSimple service using SCA binding.
+ * Service method invoked is getGreetings.
+ */
+ @Test
+ public void testSCALocal() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloLocalServiceSimpleClientSCAComponent");
+ performTest(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloLocalServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsArray.
+ */
+ @Test
+ public void testSCALocalArray() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloLocalServiceSimpleClientSCAComponent");
+ performTestArray(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloLocalServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsList.
+ */
+ @Test
+ public void testSCALocalList() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloLocalServiceSimpleClientSCAComponent");
+ performTestList(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloLocalServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsArrayList.
+ */
+ @Test
+ public void testSCALocalArrayList() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloLocalServiceSimpleClientSCAComponent");
+ performTestArrayList(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloLocalServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsMap.
+ */
+ @Test
+ public void testSCALocalMap() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloLocalServiceSimpleClientSCAComponent");
+ performTestMap(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloLocalServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsHashMap.
+ */
+ @Test
+ public void testSCALocalHashMap() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloLocalServiceSimpleClientSCAComponent");
+ performTestHashMap(helloServiceSimpleClient);
+ }
+
+ /**
+ * Invokes the HelloLocalServiceSimple service using SCA binding.
+ * Service method invoked is getGreetingsVarArgs.
+ */
+ @Test
+ public void testSCALocalVarArgs() throws Exception {
+ HelloServiceSimpleClient helloServiceSimpleClient = domain.getService(HelloServiceSimpleClient.class, "HelloLocalServiceSimpleClientSCAComponent");
+ performTestVarArgs(helloServiceSimpleClient);
+ }
+
+ private void performTest(HelloServiceSimpleClient helloServiceSimpleClient) {
+ String name = "Pandu";
+ String resp = helloServiceSimpleClient.getGreetingsForward(name);
+ Assert.assertEquals("Hello "+name, resp);
+ }
+
+ private void performTestArray(HelloServiceSimpleClient helloServiceSimpleClient) {
+ String[] names = {"Me", "Pandu"};
+ String[] resps = helloServiceSimpleClient.getGreetingsArrayForward(names);
+ for(int i = 0; i < names.length; ++i) {
+ Assert.assertEquals("Hello "+names[i], resps[i]);
+ }
+ }
+
+ private void performTestList(HelloServiceSimpleClient helloServiceSimpleClient) {
+ List<String> namesList = new ArrayList<String>();
+ namesList.add("Me");
+ namesList.add("Pandu");
+ namesList.add("Chinnipandu");
+ List<String> respList = helloServiceSimpleClient.getGreetingsListForward(namesList);
+ Assert.assertEquals(namesList.size(), respList.size());
+ for(int i = 0; i < namesList.size(); ++i) {
+ Assert.assertEquals("Hello "+namesList.get(i), respList.get(i));
+ }
+ }
+
+ private void performTestArrayList(HelloServiceSimpleClient helloServiceSimpleClient) {
+ ArrayList<String> namesList = new ArrayList<String>();
+ namesList.add("Me");
+ namesList.add("Pandu");
+ namesList.add("Chinnipandu");
+ ArrayList<String> respList = helloServiceSimpleClient.getGreetingsArrayListForward(namesList);
+ Assert.assertEquals(namesList.size(), respList.size());
+ for(int i = 0; i < namesList.size(); ++i) {
+ Assert.assertEquals("Hello "+namesList.get(i), respList.get(i));
+ }
+ }
+
+ private void performTestMap(HelloServiceSimpleClient helloServiceSimpleClient) {
+ Map<String, String> namesMap = new HashMap<String, String>();
+ namesMap.put("Me", null);
+ namesMap.put("Pandu", null);
+ namesMap.put("Chinnipandu", null);
+ Map<String, String> respMap = helloServiceSimpleClient.getGreetingsMapForward(namesMap);
+ Assert.assertEquals(namesMap.keySet().size(), respMap.keySet().size());
+ for(Map.Entry<String, String> entry: namesMap.entrySet()) {
+ Assert.assertEquals("Hello "+entry.getKey(), respMap.get(entry.getKey()));
+ }
+ }
+
+ private void performTestHashMap(HelloServiceSimpleClient helloServiceSimpleClient) {
+ HashMap<String, String> namesMap = new HashMap<String, String>();
+ namesMap.put("Me", null);
+ namesMap.put("Pandu", null);
+ namesMap.put("Chinnipandu", null);
+ Map<String, String> respMap = helloServiceSimpleClient.getGreetingsHashMapForward(namesMap);
+ Assert.assertEquals(namesMap.keySet().size(), respMap.keySet().size());
+ for(Map.Entry<String, String> entry: namesMap.entrySet()) {
+ Assert.assertEquals("Hello "+entry.getKey(), respMap.get(entry.getKey()));
+ }
+ }
+
+ private void performTestVarArgs(HelloServiceSimpleClient helloServiceSimpleClient) {
+ String[] names = { "Me", "You", "Pandu" }; // Do not change the array size from 3.
+ String expected = "Hello Me You Pandu";
+ String actual = helloServiceSimpleClient.getGreetingsVarArgsForward(names[0], names[1], names[2]);
+ Assert.assertEquals(expected, actual);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java
new file mode 100644
index 0000000000..744bf20494
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.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.itest.databindings.jaxb;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DocLitBareWsdlTestCase {
+
+ private static SCADomain domain;
+
+ /**
+ * Runs once before running the tests
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("doclitbarewsdl.composite");
+ } catch (Throwable e) {
+ // @Ignore("TUSCANY-2398")
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Runs once after running the tests
+ */
+ @AfterClass
+ public static void tearDown() {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ // @Ignore("TUSCANY-2398")
+ @Test
+ public void testDocLitBareWsdl() throws Exception {
+ AClientService client = domain.getService(AClientService.class, "AClientComponent");
+ String name = "Pandu";
+ String resp = client.getGreetingsForward(name);
+ Assert.assertEquals("Hello " + name, resp);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsDatabindingTestCase.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsDatabindingTestCase.java
new file mode 100644
index 0000000000..c22d00140e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/GenericsDatabindingTestCase.java
@@ -0,0 +1,484 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.databindings.jaxb.impl.GenericsTransformer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Databinding tests for generics, parameterized and polymorphic types.
+ *
+ * @version $Rev$ $Date$
+ */
+public class GenericsDatabindingTestCase {
+ private static SCADomain domain;
+
+ /**
+ * Runs before each test method
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("generics-service.composite");
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Runs after each test method
+ */
+ @AfterClass
+ public static void tearDown() {
+ domain.close();
+ }
+
+ /**
+ * Invokes the GenericsService service using SCA binding.
+ * Service method invoked is getTypeExplicit.
+ */
+ @Test
+ public void testSCATypeExplicit() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientSCAComponent");
+ performTestTypeExplicit(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using SCA binding.
+ * Service method invoked is getTypeUnbound.
+ */
+ @Test
+ public void testSCATypeUnbound() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientSCAComponent");
+ performTestTypeUnbound(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using SCA binding.
+ * Service method invoked is getTypeExtends.
+ */
+ @Test
+ public void testSCATypeExtends() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientSCAComponent");
+ performTestTypeExtends(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using SCA binding.
+ * Service method invoked is getRecursiveTypeBound.
+ */
+ @Test
+ public void testSCARecursiveTypeBound() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientSCAComponent");
+ performTestRecursiveTypeBound(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using SCA binding.
+ * Service method invoked is getWildcardUnbound.
+ */
+ @Test
+ public void testSCAWildcardUnbound() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientSCAComponent");
+ performTestWildcardUnbound(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using SCA binding.
+ * Service method invoked is getWildcardSuper.
+ */
+ @Test
+ public void testSCAWildcardSuper() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientSCAComponent");
+ performTestWildcardSuper(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using SCA binding.
+ * Service method invoked is getWildcardExtends.
+ */
+ @Test
+ public void testSCAWildcardExtends() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientSCAComponent");
+ performTestWildcardExtends(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using SCA binding.
+ * Service method invoked is getPolymorphic.
+ */
+ @Test
+ public void testSCAPolymorphic() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientSCAComponent");
+ performTestPolymorphic(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using WS binding.
+ * Service method invoked is getTypeExplicit.
+ */
+ @Test
+ public void testWSTypeExplicit() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientWSComponent");
+ performTestTypeExplicit(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using WS binding.
+ * Service method invoked is getTypeUnbound.
+ */
+ @Test
+ public void testWSTypeUnbound() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientWSComponent");
+ performTestTypeUnbound(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using WS binding.
+ * Service method invoked is getTypeExtends.
+ */
+ @Test
+ public void testWSTypeExtends() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientWSComponent");
+ performTestTypeExtends(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using WS binding.
+ * Service method invoked is getRecursiveTypeBound.
+ */
+ @Test
+ public void testWSRecursiveTypeBound() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientWSComponent");
+ performTestRecursiveTypeBound(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using WS binding.
+ * Service method invoked is getWildcardUnbound.
+ */
+ @Test
+ public void testWSWildcardUnbound() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientWSComponent");
+ performTestWildcardUnbound(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using WS binding.
+ * Service method invoked is getWildcardSuper.
+ */
+ @Test
+ public void testWSWildcardSuper() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientWSComponent");
+ performTestWildcardSuper(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using WS binding.
+ * Service method invoked is getWildcardExtends.
+ */
+ @Test
+ public void testWSWildcardExtends() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientWSComponent");
+ performTestWildcardExtends(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsService service using WS binding.
+ * Service method invoked is getPolymorphic.
+ */
+ @Test
+ public void testWSPolymorphic() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsServiceClientWSComponent");
+ performTestPolymorphic(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsLocalService service using SCA binding.
+ * Service method invoked is getTypeExplicit.
+ */
+ @Test
+ public void testSCALocalTypeExplicit() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsLocalServiceClientSCAComponent");
+ performTestTypeExplicit(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsLocalService service using SCA binding.
+ * Service method invoked is getTypeUnbound.
+ */
+ @Test
+ public void testSCALocalTypeUnbound() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsLocalServiceClientSCAComponent");
+ performTestTypeUnbound(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsLocalService service using SCA binding.
+ * Service method invoked is getTypeExtends.
+ */
+ @Test
+ public void testSCALocalTypeExtends() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsLocalServiceClientSCAComponent");
+ performTestTypeExtends(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsLocalService service using SCA binding.
+ * Service method invoked is getRecursiveTypeBound.
+ */
+ @Test
+ public void testSCALocalRecursiveTypeBound() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsLocalServiceClientSCAComponent");
+ performTestRecursiveTypeBound(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsLocalService service using SCA binding.
+ * Service method invoked is getWildcardUnbound.
+ */
+ @Test
+ public void testSCALocalWildcardUnbound() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsLocalServiceClientSCAComponent");
+ performTestWildcardUnbound(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsLocalService service using SCA binding.
+ * Service method invoked is getWildcardSuper.
+ */
+ @Test
+ public void testSCALocalWildcardSuper() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsLocalServiceClientSCAComponent");
+ performTestWildcardSuper(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsLocalService service using SCA binding.
+ * Service method invoked is getWildcardExtends.
+ */
+ @Test
+ public void testSCALocalWildcardExtends() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsLocalServiceClientSCAComponent");
+ performTestWildcardExtends(serviceClient);
+ }
+
+ /**
+ * Invokes the GenericsLocalService service using SCA binding.
+ * Service method invoked is getPolymorphic.
+ */
+ @Test
+ public void testSCALocalPolymorphic() throws Exception {
+ GenericsServiceClient serviceClient = domain.getService(GenericsServiceClient.class, "GenericsLocalServiceClientSCAComponent");
+ performTestPolymorphic(serviceClient);
+ }
+
+ private void performTestTypeExplicit(GenericsServiceClient serviceClient) {
+ Bean1<String> args[] = new Bean1[2];
+ args[0] = new Bean1<String>("Me");
+ args[1] = new Bean1<String>();
+ for(int i = 0; i < args.length; ++i) {
+ Bean1<String> arg = args[i];
+ Bean1<String> expected = GenericsTransformer.getTypeExplicit(arg);
+ Bean1<String> actual = serviceClient.getTypeExplicitForward(arg);
+ Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestTypeUnbound(GenericsServiceClient serviceClient) {
+ { // String
+ String[] args = { "Me", "You", "Him" };
+ Bean1<String> expected = GenericsTransformer.getTypeUnbound(args);
+ Bean1<String> actual = serviceClient.getTypeUnboundForward(args);
+ // Assert.assertEquals(expected, actual);
+ }
+ { // Integer
+ Integer[] args = new Integer[3];
+ args[0] = -10;
+ args[1] = 0;
+ args[2] = 10;
+ Bean1<Integer> expected = GenericsTransformer.getTypeUnbound(args);
+ Bean1<Integer> actual = serviceClient.getTypeUnboundForward(args);
+ // Assert.assertEquals(expected, actual);
+ }
+ { // Object
+ Object[] args = new Object[3];
+ args[0] = "Me";
+ args[1] = 10;
+ args[2] = "Him";
+ Bean1<Object> expected = GenericsTransformer.getTypeUnbound(args);
+ Bean1<Object> actual = serviceClient.getTypeUnboundForward(args);
+ Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestTypeExtends(GenericsServiceClient serviceClient) {
+ { // Bean2
+ Bean2[] args = new Bean2[3];
+ for(int i = 0; i < args.length; ++i) {
+ args[i] = new Bean2();
+ args[i].setName("Name"+i);
+ }
+
+ Bean1<Bean2> expected = GenericsTransformer.getTypeExtends(args);
+ Bean1<Bean2> actual = serviceClient.getTypeExtendsForward(args);
+ Assert.assertEquals(expected, actual);
+ }
+ { // Bean3 extends Bean2
+ Bean3[] args = new Bean3[3];
+ for(int i = 0; i < args.length; ++i) {
+ args[i] = new Bean3();
+ args[i].setName("Name"+i);
+ args[i].setAddress("Address"+i);
+ }
+
+ Bean1<Bean3> expected = GenericsTransformer.getTypeExtends(args);
+ Bean1<Bean3> actual = serviceClient.getTypeExtendsForward(args);
+ // Assert.assertEquals(expected, actual);
+ }
+ { //Bean31 extends Bean2
+ Bean31[] args = new Bean31[3];
+ for(int i = 0; i < args.length; ++i) {
+ args[i] = new Bean31();
+ args[i].setName("Name"+i);
+ args[i].setAddress("Address"+i);
+ }
+
+ Bean1<Bean31> expected = GenericsTransformer.getTypeExtends(args);
+ Bean1<Bean31> actual = serviceClient.getTypeExtendsForward(args);
+ // Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestRecursiveTypeBound(GenericsServiceClient serviceClient) {
+ { // Bean1<String>
+ Bean1<String>[] args = new Bean1[3];
+ for(int i = 0; i < args.length; ++i) {
+ args[i] = new Bean1<String>();
+ args[i].setItem("Bean."+i);
+ }
+ Bean1<Bean1<String>> expected = GenericsTransformer.getRecursiveTypeBound(args);
+ Bean1<Bean1<String>> actual = serviceClient.getRecursiveTypeBoundForward(args);
+ Assert.assertEquals(expected, actual);
+ }
+ { // Bean10 extends Bean1<String>
+ Bean10[] args = new Bean10[3];
+ for(int i = 0; i < args.length; ++i) {
+ args[i] = new Bean10();
+ args[i].setItem("Bean10."+i);
+ }
+ Bean1<Bean10> expected = GenericsTransformer.getRecursiveTypeBound(args);
+ Bean1<Bean10> actual = serviceClient.getRecursiveTypeBoundForward(args);
+ // Assert.assertEquals(expected, actual);
+ }
+ { // Bean11 extends Bean1<String>
+ Bean11[] args = new Bean11[3];
+ for(int i = 0; i < args.length; ++i) {
+ args[i] = new Bean11();
+ args[i].setItem("Bean11."+i);
+ }
+ Bean1<Bean11> expected = GenericsTransformer.getRecursiveTypeBound(args);
+ Bean1<Bean11> actual = serviceClient.getRecursiveTypeBoundForward(args);
+ // Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestWildcardUnbound(GenericsServiceClient serviceClient) {
+ {
+ Bean1<?> arg = new Bean1<String>("Me");
+ Bean1<?> expected = GenericsTransformer.getWildcardUnbound(arg);
+ Bean1<?> actual = serviceClient.getWildcardUnboundForward(arg);
+ Assert.assertEquals(expected, actual);
+ }
+ {
+ Bean1<?> arg = new Bean1<Integer>(1);
+ Bean1<?> expected = GenericsTransformer.getWildcardUnbound(arg);
+ Bean1<?> actual = serviceClient.getWildcardUnboundForward(arg);
+ Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestWildcardSuper(GenericsServiceClient serviceClient) {
+ Bean1<? super Bean3> arg = new Bean1<Bean2>();
+ Bean3 item = new Bean3();
+ item.setName("Name");
+ item.setAddress("Address");
+ arg.setItem(item);
+ Bean1<? super Bean3> expected = GenericsTransformer.getWildcardSuper(arg);
+ Bean1<? super Bean3> actual = serviceClient.getWildcardSuperForward(arg);
+ Assert.assertEquals(expected, actual);
+ }
+
+ private void performTestWildcardExtends(GenericsServiceClient serviceClient) {
+ { // Bean2
+ Bean2 temp = new Bean2();
+ temp.setName("Me");
+ Bean1<? extends Bean2> arg = new Bean1<Bean2>(temp);
+ Bean1<? extends Bean2> expected = GenericsTransformer.getWildcardExtends(arg);
+ Bean1<? extends Bean2> actual = serviceClient.getWildcardExtendsForward(arg);
+ Assert.assertEquals(expected, actual);
+ }
+ { // Bean3 extends Bean2
+ Bean3 temp = new Bean3();
+ temp.setName("Me");
+ temp.setAddress("My address");
+ Bean1<? extends Bean2> arg = new Bean1<Bean3>(temp);
+ Bean1<? extends Bean2> expected = GenericsTransformer.getWildcardExtends(arg);
+ Bean1<? extends Bean2> actual = serviceClient.getWildcardExtendsForward(arg);
+ // The Bean3 will be unmarshalled into Bean2
+ // Assert.assertEquals(expected, actual);
+ Assert.assertTrue(actual.getItem() instanceof Bean2);
+ }
+ { // Bean31 extends Bean2
+ Bean31 temp = new Bean31();
+ temp.setName("Me1");
+ temp.setAddress("My address1");
+ Bean1<? extends Bean2> arg = new Bean1<Bean31>(temp);
+ Bean1<? extends Bean2> expected = GenericsTransformer.getWildcardExtends(arg);
+ Bean1<? extends Bean2> actual = serviceClient.getWildcardExtendsForward(arg);
+ // The Bean31 will be unmarshalled into Bean2
+ // Assert.assertEquals(expected, actual);
+ Assert.assertTrue(actual.getItem() instanceof Bean2);
+ }
+ }
+
+ private void performTestPolymorphic(GenericsServiceClient serviceClient) {
+ { // Bean2
+ Bean2 arg = new Bean2();
+ arg.setName("Me");
+ Bean2 expected = GenericsTransformer.getPolymorphic(arg);
+ Bean2 actual = serviceClient.getPolymorphicForward(arg);
+ Assert.assertEquals(expected, actual);
+ }
+ { // Bean3 extends Bean2
+ Bean3 arg = new Bean3();
+ arg.setName("Me");
+ arg.setAddress("My address");
+ Bean2 expected = GenericsTransformer.getPolymorphic(arg);
+ Bean2 actual = serviceClient.getPolymorphicForward(arg);
+ Assert.assertEquals(expected.getName(), actual.getName());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesDatabindingTestCase.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesDatabindingTestCase.java
new file mode 100644
index 0000000000..f8aaad3dac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesDatabindingTestCase.java
@@ -0,0 +1,776 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PrimitivesDatabindingTestCase {
+
+ private static SCADomain domain;
+
+ /**
+ * Runs before each test method
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("primitivesservice.composite");
+ } catch(Throwable e) {
+ e.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ /**
+ * Runs after each test method
+ */
+ @AfterClass
+ public static void tearDown() {
+ domain.close();
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateBoolean.
+ */
+ @Test
+ public void testSCANegateBoolean() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateBoolean(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateBooleanArray.
+ */
+ @Test
+ public void testSCANegateBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateBooleanArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with SCA binding.
+ * Test for boolean array.
+ */
+ @Test
+ public void testSCAPassByValueBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueBooleanArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateByte.
+ */
+ @Test
+ public void testSCANegateByte() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateByte(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateByteArray.
+ */
+ @Test
+ public void testSCANegateByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateByteArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with SCA binding.
+ * Test for byte array.
+ */
+ @Test
+ public void testSCAPassByValueByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueByteArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateShort.
+ */
+ @Test
+ public void testSCANegateShort() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateShort(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateShortArray.
+ */
+ @Test
+ public void testSCANegateShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateShortArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with SCA binding.
+ * Test for short array.
+ */
+ @Test
+ public void testSCAPassByValueShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueShortArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateInt.
+ */
+ @Test
+ public void testSCANegateInt() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateInt(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateIntArray.
+ */
+ @Test
+ public void testSCANegateIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateIntArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with SCA binding.
+ * Test for int array.
+ */
+ @Test
+ public void testSCAPassByValueIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueIntArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateLong.
+ */
+ @Test
+ public void testSCANegateLong() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateLong(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateLongArray.
+ */
+ @Test
+ public void testSCANegateLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateLongArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with SCA binding.
+ * Test for long array.
+ */
+ @Test
+ public void testSCAPassByValueLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueLongArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateFloat.
+ */
+ @Test
+ public void testSCANegateFloat() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateFloat(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateFloatArray.
+ */
+ @Test
+ public void testSCANegateFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateFloatArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with SCA binding.
+ * Test for float array.
+ */
+ @Test
+ public void testSCAPassByValueFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueFloatArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateDouble.
+ */
+ @Test
+ public void testSCANegateDouble() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateDouble(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateDoubleArray.
+ */
+ @Test
+ public void testSCANegateDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ performTestNegateDoubleArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with SCA binding.
+ * Test for double array.
+ */
+ @Test
+ public void testSCAPassByValueDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientSCAComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueDoubleArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateBoolean.
+ */
+ @Test
+ public void testWSNegateBoolean() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateBoolean(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateBooleanArray.
+ */
+ @Test
+ public void testWSNegateBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateBooleanArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for boolean array.
+ */
+ @Test
+ public void testWSPassByValueBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueBooleanArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateByte.
+ */
+ @Test
+ public void testWSNegateByte() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateByte(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateByteArray.
+ */
+ @Test
+ public void testWSNegateByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateByteArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for byte array.
+ */
+ @Test
+ public void testWSPassByValueByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueByteArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateShort.
+ */
+ @Test
+ public void testWSNegateShort() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateShort(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateShortArray.
+ */
+ @Test
+ public void testWSNegateShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateShortArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for short array.
+ */
+ @Test
+ public void testWSPassByValueShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueShortArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateInt.
+ */
+ @Test
+ public void testWSNegateInt() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateInt(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateIntArray.
+ */
+ @Test
+ public void testWSNegateIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateIntArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for int array.
+ */
+ @Test
+ public void testWSPassByValueIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueIntArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateLong.
+ */
+ @Test
+ public void testWSNegateLong() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateLong(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateLongArray.
+ */
+ @Test
+ public void testWSNegateLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateLongArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for long array.
+ */
+ @Test
+ public void testWSPassByValueLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueLongArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateFloat.
+ */
+ @Test
+ public void testWSNegateFloat() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateFloat(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateFloatArray.
+ */
+ @Test
+ public void testWSNegateFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateFloatArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for float array.
+ */
+ @Test
+ public void testWSPassByValueFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueFloatArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateDouble.
+ */
+ @Test
+ public void testWSNegateDouble() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateDouble(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateDoubleArray.
+ */
+ @Test
+ public void testWSNegateDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ performTestNegateDoubleArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for double array.
+ */
+ @Test
+ public void testWSPassByValueDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientWSComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueDoubleArray());
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateBoolean.
+ */
+ @Test
+ public void testSCALocalNegateBoolean() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateBoolean(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateBooleanArray.
+ */
+ @Test
+ public void testSCALocalNegateBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateBooleanArray(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateByte.
+ */
+ @Test
+ public void testSCALocalNegateByte() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateByte(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateByteArray.
+ */
+ @Test
+ public void testSCALocalNegateByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateByteArray(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateShort.
+ */
+ @Test
+ public void testSCALocalNegateShort() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateShort(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateShortArray.
+ */
+ @Test
+ public void testSCALocalNegateShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateShortArray(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateInt.
+ */
+ @Test
+ public void testSCALocalNegateInt() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateInt(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateIntArray.
+ */
+ @Test
+ public void testSCALocalNegateIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateIntArray(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateLong.
+ */
+ @Test
+ public void testSCALocalNegateLong() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateLong(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateLongArray.
+ */
+ @Test
+ public void testSCALocalNegateLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateLongArray(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateFloat.
+ */
+ @Test
+ public void testSCALocalNegateFloat() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateFloat(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using SCA binding.
+ * Service method invoked is negateFloatArray.
+ */
+ @Test
+ public void testSCALocalNegateFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateFloatArray(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateDouble.
+ */
+ @Test
+ public void testSCALocalNegateDouble() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateDouble(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesLocalService service using SCA binding.
+ * Service method invoked is negateDoubleArray.
+ */
+ @Test
+ public void testSCALocalNegateDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesLocalServiceClientSCAComponent");
+ performTestNegateDoubleArray(primitivesServiceClient);
+ }
+
+ private void performTestNegateBoolean(PrimitivesServiceClient primitivesServiceClient) {
+ Assert.assertTrue(primitivesServiceClient.negateBooleanForward(false));
+ Assert.assertFalse(primitivesServiceClient.negateBooleanForward(true));
+ }
+
+ private void performTestNegateBooleanArray(PrimitivesServiceClient primitivesServiceClient) {
+ boolean flags[] = new boolean[2];
+ flags[0] = false;
+ flags[1] = true;
+ boolean[] respFlags = primitivesServiceClient.negateBooleanArrayForward(flags);
+ Assert.assertEquals(flags.length, respFlags.length);
+ for(int i = 0; i < flags.length; ++i) {
+ Assert.assertEquals(!flags[i], respFlags[i]);
+ }
+ }
+
+ private void performTestNegateByte(PrimitivesServiceClient primitivesServiceClient) {
+ byte[] ba = new byte[3];
+ ba[0] = -1;
+ ba[1] = 0;
+ ba[2] = 1;
+
+ for(int i = 0; i < ba.length; ++i) {
+ Assert.assertEquals((byte)-ba[i], primitivesServiceClient.negateByteForward(ba[i]));
+ }
+ }
+
+ private void performTestNegateByteArray(PrimitivesServiceClient primitivesServiceClient) {
+ byte[] ba = new byte[3];
+ ba[0] = -1;
+ ba[1] = 0;
+ ba[2] = 1;
+
+ byte[] r = primitivesServiceClient.negateByteArrayForward(ba);
+ Assert.assertEquals(ba.length, r.length);
+ for(int i = 0; i < ba.length; ++i) {
+ Assert.assertEquals((byte)-ba[i], r[i]);
+ }
+ }
+
+ private void performTestNegateShort(PrimitivesServiceClient primitivesServiceClient) {
+ short[] s = new short[3];
+ s[0] = -1;
+ s[1] = 0;
+ s[2] = 1;
+
+ for(int i = 0; i < s.length; ++i) {
+ Assert.assertEquals((short)-s[i], primitivesServiceClient.negateShortForward(s[i]));
+ }
+ }
+
+ private void performTestNegateShortArray(PrimitivesServiceClient primitivesServiceClient) {
+ short[] s = new short[3];
+ s[0] = -1;
+ s[1] = 0;
+ s[2] = 1;
+
+ short[] r = primitivesServiceClient.negateShortArrayForward(s);
+ Assert.assertEquals(s.length, r.length);
+ for(int i = 0; i < s.length; ++i) {
+ Assert.assertEquals((short)-s[i], r[i]);
+ }
+ }
+
+ private void performTestNegateInt(PrimitivesServiceClient primitivesServiceClient) {
+ int[] ia = new int[3];
+ ia[0] = -1;
+ ia[1] = 0;
+ ia[2] = 1;
+
+ for(int i = 0; i < ia.length; ++i) {
+ Assert.assertEquals(-ia[i], primitivesServiceClient.negateIntForward(ia[i]));
+ }
+ }
+
+ private void performTestNegateIntArray(PrimitivesServiceClient primitivesServiceClient) {
+ int[] ia = new int[3];
+ ia[0] = -1;
+ ia[1] = 0;
+ ia[2] = 1;
+
+ int[] r = primitivesServiceClient.negateIntArrayForward(ia);
+ Assert.assertEquals(ia.length, r.length);
+ for(int i = 0; i < ia.length; ++i) {
+ Assert.assertEquals(-ia[i], r[i]);
+ }
+ }
+
+ private void performTestNegateLong(PrimitivesServiceClient primitivesServiceClient) {
+ long[] la = new long[3];
+ la[0] = -1;
+ la[1] = 0;
+ la[2] = 1;
+
+ for(int i = 0; i < la.length; ++i) {
+ Assert.assertEquals(-la[i], primitivesServiceClient.negateLongForward(la[i]));
+ }
+ }
+
+ private void performTestNegateLongArray(PrimitivesServiceClient primitivesServiceClient) {
+ long[] la = new long[3];
+ la[0] = -1;
+ la[1] = 0;
+ la[2] = 1;
+
+ long[] r = primitivesServiceClient.negateLongArrayForward(la);
+ Assert.assertEquals(la.length, r.length);
+ for(int i = 0; i < la.length; ++i) {
+ Assert.assertEquals(-la[i], r[i]);
+ }
+ }
+
+ private void performTestNegateFloat(PrimitivesServiceClient primitivesServiceClient) {
+ float[] fa = new float[3];
+ fa[0] = -1;
+ fa[1] = 0;
+ fa[2] = 1;
+
+ for(int i = 0; i < fa.length; ++i) {
+ Assert.assertEquals(-fa[i], primitivesServiceClient.negateFloatForward(fa[i]));
+ }
+ }
+
+ private void performTestNegateFloatArray(PrimitivesServiceClient primitivesServiceClient) {
+ float[] ia = new float[3];
+ ia[0] = -1;
+ ia[1] = 0;
+ ia[2] = 1;
+
+ float[] r = primitivesServiceClient.negateFloatArrayForward(ia);
+ Assert.assertEquals(ia.length, r.length);
+ for(int i = 0; i < ia.length; ++i) {
+ Assert.assertEquals(-ia[i], r[i]);
+ }
+ }
+
+ private void performTestNegateDouble(PrimitivesServiceClient primitivesServiceClient) {
+ double[] da = new double[3];
+ da[0] = -1;
+ da[1] = 0;
+ da[2] = 1;
+
+ for(int i = 0; i < da.length; ++i) {
+ Assert.assertEquals(-da[i], primitivesServiceClient.negateDoubleForward(da[i]));
+ }
+ }
+
+ private void performTestNegateDoubleArray(PrimitivesServiceClient primitivesServiceClient) {
+ double[] da = new double[3];
+ da[0] = -1;
+ da[1] = 0;
+ da[2] = 1;
+
+ double[] r = primitivesServiceClient.negateDoubleArrayForward(da);
+ Assert.assertEquals(da.length, r.length);
+ for(int i = 0; i < da.length; ++i) {
+ Assert.assertEquals(-da[i], r[i]);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesDatabindingTestCase.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesDatabindingTestCase.java
new file mode 100644
index 0000000000..4977baa84c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesDatabindingTestCase.java
@@ -0,0 +1,1438 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb;
+
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.awt.image.PixelGrabber;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.Assert;
+
+import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.tuscany.sca.databinding.xml.String2Node;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesTransformer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.xml.sax.InputSource;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StandardTypesDatabindingTestCase {
+
+ private static SCADomain domain;
+
+ /**
+ * Runs before each test method
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("standard-types-service.composite");
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Runs after each test method
+ */
+ @AfterClass
+ public static void tearDown() {
+ domain.close();
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewBigInteger.
+ */
+ @Test
+ public void testSCANewBigInteger() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewBigInteger(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewBigIntegerArray.
+ */
+ @Test
+ public void testSCANewBigIntegerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewBigIntegerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewBigDecimal.
+ */
+ @Test
+ public void testSCANewBigDecimal() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewBigDecimal(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewBigDecimalArray.
+ */
+ @Test
+ public void testSCANewBigDecimalArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewBigDecimalArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewCalendar.
+ */
+ @Test
+ public void testSCANewCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewCalendarArray.
+ */
+ @Test
+ public void testSCANewCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewDate.
+ */
+ @Test
+ public void testSCANewDate() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewDate(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewDateArray.
+ */
+ @Test
+ public void testSCANewDateArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewDateArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewQName.
+ */
+ @Test
+ public void testSCANewQName() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewQName(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewQNameArray.
+ */
+ @Test
+ public void testSCANewQNameArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewQNameArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewURI.
+ */
+ @Test
+ public void testSCANewURI() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewURI(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewURIArray.
+ */
+ @Test
+ public void testSCANewURIArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewURIArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewXMLGregorianCalendar.
+ */
+ @Test
+ public void testSCANewXMLGregorianCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewXMLGregorianCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewXMLGregorianCalendarArray.
+ */
+ @Test
+ public void testSCANewXMLGregorianCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewXMLGregorianCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewDuration.
+ */
+ @Test
+ public void testSCANewDuration() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewDuration(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewDurationArray.
+ */
+ @Test
+ public void testSCANewDurationArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewDurationArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewObject.
+ */
+ @Test
+ public void testSCANewObject() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewObject(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewObjectArray.
+ */
+ @Test
+ public void testSCANewObjectArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewObjectArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewImage.
+ */
+ @Test
+ public void testSCANewImage() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewImage(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewImageArray.
+ */
+ @Test
+ public void testSCANewImageArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewImageArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewDataHandler.
+ */
+ @Test
+ public void testSCANewDataHandler() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewDataHandler(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewDataHandlerArray.
+ */
+ @Test
+ public void testSCANewDataHandlerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewDataHandlerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewSource.
+ */
+ @Test
+ public void testSCANewSource() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewSource(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewSourceArray.
+ */
+ @Test
+ @Ignore("TUSCANY-2387")
+ public void testSCANewSourceArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewSourceArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewUUID.
+ */
+ @Test
+ public void testSCANewUUID() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewUUID(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using SCA binding.
+ * Service method invoked is getNewUUIDArray.
+ */
+ @Test
+ public void testSCANewUUIDArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
+ performTestNewUUIDArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigInteger.
+ */
+ @Test
+ public void testWSNewBigInteger() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewBigInteger(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigIntegerArray.
+ */
+ @Test
+ public void testWSNewBigIntegerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewBigIntegerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigDecimal.
+ */
+ @Test
+ public void testWSNewBigDecimal() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewBigDecimal(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigDecimalArray.
+ */
+ @Test
+ public void testWSNewBigDecimalArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewBigDecimalArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewCalendar.
+ */
+ @Test
+ public void testWSNewCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewCalendarArray.
+ */
+ @Test
+ public void testWSNewCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDate.
+ */
+ @Test
+ public void testWSNewDate() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewDate(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDateArray.
+ */
+ @Test
+ public void testWSNewDateArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewDateArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewQName.
+ */
+ @Test
+ public void testWSNewQName() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewQName(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewQNameArray.
+ */
+ @Test
+ public void testWSNewQNameArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewQNameArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewURI.
+ */
+ @Test
+ public void testWSNewURI() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewURI(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewURIArray.
+ */
+ @Test
+ public void testWSNewURIArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewURIArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewXMLGregorianCalendar.
+ */
+ @Test
+ public void testWSNewXMLGregorianCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewXMLGregorianCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewXMLGregorianCalendarArray.
+ */
+ @Test
+ public void testWSNewXMLGregorianCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewXMLGregorianCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDuration.
+ */
+ @Test
+ public void testWSNewDuration() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewDuration(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDurationArray.
+ */
+ @Test
+ public void testWSNewDurationArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewDurationArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewObject.
+ */
+ @Test
+ public void testWSNewObject() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewObject(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewObjectArray.
+ */
+ @Test
+ public void testWSNewObjectArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewObjectArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewImage.
+ */
+ @Test
+ public void testWSNewImage() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewImage(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewImageArray.
+ */
+ @Test
+ public void testWSNewImageArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewImageArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDataHandler.
+ */
+ @Test
+ public void testWSNewDataHandler() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewDataHandler(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDataHandlerArray.
+ */
+ @Test
+ public void testWSNewDataHandlerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewDataHandlerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewSource.
+ */
+ @Test
+ @Ignore("junit.framework.ComparisonFailure: null expected:<... encoding=\"UTF-8\"?><[a>A</a]>> but was:<... encoding=\"UTF-8\"?><[return xmlns=\"http://jaxb.databindings.itest.sca.tuscany.apache.org/\">A</return]>>")
+ public void testWSNewSource() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewSource(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewSourceArray.
+ */
+ @Test
+ @Ignore("TUSCANY-2386")
+ public void testWSNewSourceArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewSourceArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewUUID.
+ */
+ @Test
+ public void testWSNewUUID() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewUUID(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewUUIDArray.
+ */
+ @Test
+ public void testWSNewUUIDArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientWSComponent");
+ performTestNewUUIDArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewBigInteger.
+ */
+ @Test
+ public void testSCALocalNewBigInteger() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewBigInteger(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewBigIntegerArray.
+ */
+ @Test
+ public void testSCALocalNewBigIntegerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewBigIntegerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewBigDecimal.
+ */
+ @Test
+ public void testSCALocalNewBigDecimal() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewBigDecimal(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewBigDecimalArray.
+ */
+ @Test
+ public void testSCALocalNewBigDecimalArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewBigDecimalArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewCalendar.
+ */
+ @Test
+ public void testSCALocalNewCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewCalendarArray.
+ */
+ @Test
+ public void testSCALocalNewCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewDate.
+ */
+ @Test
+ public void testSCALocalNewDate() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewDate(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewDateArray.
+ */
+ @Test
+ public void testSCALocalNewDateArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewDateArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewQName.
+ */
+ @Test
+ public void testSCALocalNewQName() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewQName(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewQNameArray.
+ */
+ @Test
+ public void testSCALocalNewQNameArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewQNameArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewURI.
+ */
+ @Test
+ public void testSCALocalNewURI() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewURI(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewURIArray.
+ */
+ @Test
+ public void testSCALocalNewURIArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewURIArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewXMLGregorianCalendar.
+ */
+ @Test
+ public void testSCALocalNewXMLGregorianCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewXMLGregorianCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewXMLGregorianCalendarArray.
+ */
+ @Test
+ public void testSCALocalNewXMLGregorianCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewXMLGregorianCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewDuration.
+ */
+ @Test
+ public void testSCALocalNewDuration() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewDuration(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewDurationArray.
+ */
+ @Test
+ public void testSCALocalNewDurationArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewDurationArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewObject.
+ */
+ @Test
+ public void testSCALocalNewObject() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewObject(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewObjectArray.
+ */
+ @Test
+ public void testSCALocalNewObjectArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewObjectArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewImage.
+ */
+ @Test
+ public void testSCALocalNewImage() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewImage(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewImageArray.
+ */
+ @Test
+ public void testSCALocalNewImageArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewImageArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalLocalService service using SCA binding.
+ * Service method invoked is getNewDataHandler.
+ */
+ @Test
+ public void testSCALocalNewDataHandler() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewDataHandler(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewDataHandlerArray.
+ */
+ @Test
+ public void testSCALocalNewDataHandlerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewDataHandlerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewSource.
+ */
+ @Test
+ public void testSCALocalNewSource() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewSource(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewSourceArray.
+ */
+ @Test
+ public void testSCALocalNewSourceArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewSourceArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewUUID.
+ */
+ @Test
+ public void testSCALocalNewUUID() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewUUID(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesLocalService service using SCA binding.
+ * Service method invoked is getNewUUIDArray.
+ */
+ @Test
+ public void testSCALocalNewUUIDArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
+ performTestNewUUIDArray(serviceClient);
+ }
+
+ private void performTestNewBigInteger(StandardTypesServiceClient serviceClient) {
+ BigInteger bi = new BigInteger("1234567890123456789012345678901234");
+ BigInteger expected = bi.negate();
+ BigInteger actual = serviceClient.getNewBigIntegerForward(bi);
+ Assert.assertEquals(expected, actual);
+ }
+
+ private void performTestNewBigIntegerArray(StandardTypesServiceClient serviceClient) {
+ BigInteger[] bia = new BigInteger[2];
+ bia[0] = new BigInteger("1234567890123456789012345678901234");
+ bia[1] = new BigInteger("-98765432109876543210987654321");
+ BigInteger[] actual = serviceClient.getNewBigIntegerArrayForward(bia);
+ Assert.assertEquals(bia.length, actual.length);
+ for (int i = 0; i < bia.length; ++i) {
+ Assert.assertEquals(bia[i].negate(), actual[i]);
+ }
+ }
+
+ private void performTestNewBigDecimal(StandardTypesServiceClient serviceClient) {
+ BigDecimal bd = new BigDecimal("12345678901234567890.12345678901234");
+ BigDecimal expected = bd.negate();
+ BigDecimal actual = serviceClient.getNewBigDecimalForward(bd);
+ Assert.assertEquals(expected, actual);
+ }
+
+ private void performTestNewBigDecimalArray(StandardTypesServiceClient serviceClient) {
+ BigDecimal[] bda = new BigDecimal[2];
+ bda[0] = new BigDecimal("1234567890123456.789012345678901234");
+ bda[1] = new BigDecimal("-987654321098765.43210987654321");
+ BigDecimal[] actual = serviceClient.getNewBigDecimalArrayForward(bda);
+ Assert.assertEquals(bda.length, actual.length);
+ for (int i = 0; i < bda.length; ++i) {
+ Assert.assertEquals(bda[i].negate(), actual[i]);
+ }
+ }
+
+ private void performTestNewCalendar(StandardTypesServiceClient serviceClient) {
+ Calendar[] ca = new Calendar[3];
+ String[] tz = {"GMT+05:30", "GMT+00:00", "GMT-05:00"};
+ for (int i = 0; i < ca.length; ++i) {
+ ca[i] = Calendar.getInstance(TimeZone.getTimeZone(tz[i]));
+ ca[i].set(Calendar.DAY_OF_MONTH, i + 1);
+ }
+ for (int i = 0; i < ca.length; ++i) {
+ Calendar actual = serviceClient.getNewCalendarForward(ca[i]);
+ ca[i].add(Calendar.DAY_OF_MONTH, 5);
+ if (actual instanceof GregorianCalendar && ca[i] instanceof GregorianCalendar) {
+ // FIXME: Is this a problem?
+ // The instance returned by service method invoked over binding.ws seems to have a gregorianCutover
+ // different from the instance passed. Adjust the gregorianCutover as per the input instance.
+ ((GregorianCalendar)actual).setGregorianChange(((GregorianCalendar)ca[i]).getGregorianChange());
+ }
+ Assert.assertEquals(ca[i], actual);
+ }
+ }
+
+ private void performTestNewCalendarArray(StandardTypesServiceClient serviceClient) {
+ Calendar[] ca = new Calendar[3];
+ String[] tz = {"GMT+05:30", "GMT+00:00", "GMT-05:00"};
+ for (int i = 0; i < ca.length; ++i) {
+ ca[i] = Calendar.getInstance(TimeZone.getTimeZone(tz[i]));
+ ca[i].set(Calendar.DAY_OF_MONTH, i + 1);
+ }
+ Calendar[] actual = serviceClient.getNewCalendarArrayForward(ca);
+ Assert.assertEquals(ca.length, actual.length);
+ for (int i = 0; i < ca.length; ++i) {
+ ca[i].add(Calendar.DAY_OF_MONTH, 5);
+ if (actual[i] instanceof GregorianCalendar && ca[i] instanceof GregorianCalendar) {
+ // FIXME: Is this a problem?
+ // The instance returned by service method invoked over binding.ws seems to have a gregorianCutover
+ // different from the instance passed. Adjust the gregorianCutover as per the input instance.
+ ((GregorianCalendar)actual[i]).setGregorianChange(((GregorianCalendar)ca[i]).getGregorianChange());
+ }
+ Assert.assertEquals(ca[i], actual[i]);
+ }
+ }
+
+ private void performTestNewDate(StandardTypesServiceClient serviceClient) {
+ Date d = new Date();
+ Date expected = new Date(d.getTime() + 5 * 24 * 60 * 60 * 1000);
+ Date actual = serviceClient.getNewDateForward(d);
+ Assert.assertEquals(expected, actual);
+ }
+
+ private void performTestNewDateArray(StandardTypesServiceClient serviceClient) {
+ Date[] d = new Date[2];
+ Date[] expected = new Date[d.length];
+ for (int i = 0; i < d.length; ++i) {
+ d[i] = new Date();
+ d[i].setTime(d[i].getTime() + i * 24 * 60 * 60 * 1000);
+ expected[i] = new Date(d[i].getTime() + 5 * 24 * 60 * 60 * 1000);
+ }
+ Date[] actual = serviceClient.getNewDateArrayForward(d);
+ Assert.assertEquals(expected.length, actual.length);
+ for (int i = 0; i < expected.length; ++i) {
+ Assert.assertEquals(expected[i], actual[i]);
+ }
+ }
+
+ private void performTestNewQName(StandardTypesServiceClient serviceClient) {
+ QName[] qnames = new QName[3];
+ qnames[0] = new QName("localPart");
+ qnames[1] = new QName("namespaceUri", "localPart");
+ qnames[2] = new QName("namespaceUri", "localPart", "prefix");
+ QName[] expected = new QName[qnames.length];
+ for (int i = 0; i < qnames.length; ++i) {
+ expected[i] =
+ new QName(qnames[i].getNamespaceURI() + "q", qnames[i].getLocalPart() + "q",
+ qnames[i].getPrefix() + "q");
+ }
+ for (int i = 0; i < qnames.length; ++i) {
+ QName actual = serviceClient.getNewQNameForward(qnames[i]);
+ Assert.assertEquals(expected[i], actual);
+ }
+ }
+
+ private void performTestNewQNameArray(StandardTypesServiceClient serviceClient) {
+ QName[] qnames = new QName[4];
+ qnames[0] = new QName("localPart");
+ qnames[1] = new QName("namespaceUri", "localPart");
+ qnames[2] = new QName("namespaceUri", "localPart", "prefix");
+ qnames[3] = new QName("localPart2");
+ QName[] expected = new QName[qnames.length];
+ for (int i = 0; i < qnames.length; ++i) {
+ expected[i] =
+ new QName(qnames[i].getNamespaceURI() + "q", qnames[i].getLocalPart() + "q",
+ qnames[i].getPrefix() + "q");
+ }
+ QName[] actual = serviceClient.getNewQNameArrayForward(qnames);
+ Assert.assertEquals(expected.length, actual.length);
+ for (int i = 0; i < qnames.length; ++i) {
+ Assert.assertEquals(expected[i], actual[i]);
+ }
+ }
+
+ private void performTestNewURI(StandardTypesServiceClient serviceClient) {
+ URI[] uris = new URI[4];
+ uris[0] = URI.create("a/b/c");
+ uris[1] = URI.create("http://abc/");
+ uris[2] = URI.create("ftp://a/b");
+ uris[3] = URI.create("http://abc/").resolve("xyz");
+
+ for (int i = 0; i < uris.length; ++i) {
+ URI expected = uris[i].resolve("uri");
+ URI actual = serviceClient.getNewURIForward(uris[i]);
+ Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestNewURIArray(StandardTypesServiceClient serviceClient) {
+ URI[] uris = new URI[4];
+ uris[0] = URI.create("a/b/c");
+ // [rfeng] We need to have a trialign / to avoid the resolving problem
+ // FIXME: [vamsi] This is actually a data transformation problem. The array being returned from the service method is
+ // not making to the caller intact.
+ uris[1] = URI.create("http://abc/");
+ uris[2] = URI.create("ftp://a/b");
+ uris[3] = URI.create("http://abc/").resolve("xyz");
+
+ URI[] expected = new URI[uris.length];
+ for (int i = 0; i < uris.length; ++i) {
+ expected[i] = uris[i].resolve("uri");
+ }
+
+ URI[] actual = serviceClient.getNewURIArrayForward(uris);
+ Assert.assertEquals(expected.length, actual.length);
+ for (int i = 0; i < uris.length; ++i) {
+ Assert.assertEquals(expected[i], actual[i]);
+ }
+ }
+
+ private void performTestNewXMLGregorianCalendar(StandardTypesServiceClient serviceClient)
+ throws DatatypeConfigurationException {
+ DatatypeFactory df = DatatypeFactory.newInstance();
+ XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
+ xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
+ xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
+ xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));
+
+ for (int i = 0; i < xgcals.length; ++i) {
+ XMLGregorianCalendar actual = serviceClient.getNewXMLGregorianCalendarForward(xgcals[i]);
+ xgcals[i].setDay(xgcals[i].getDay() + 5);
+ Assert.assertEquals(xgcals[i], actual);
+ }
+ }
+
+ private void performTestNewXMLGregorianCalendarArray(StandardTypesServiceClient serviceClient)
+ throws DatatypeConfigurationException {
+ DatatypeFactory df = DatatypeFactory.newInstance();
+ XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
+ xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
+ xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
+ xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));
+
+ XMLGregorianCalendar[] actual = serviceClient.getNewXMLGregorianCalendarArrayForward(xgcals);
+ Assert.assertEquals(xgcals.length, actual.length);
+ for (int i = 0; i < xgcals.length; ++i) {
+ xgcals[i].setDay(xgcals[i].getDay() + 5);
+ Assert.assertEquals(xgcals[i], actual[i]);
+ }
+ }
+
+ private void performTestNewDuration(StandardTypesServiceClient serviceClient) throws DatatypeConfigurationException {
+ DatatypeFactory df = DatatypeFactory.newInstance();
+ Duration[] da = new Duration[3];
+ da[0] = df.newDuration(1000000000000L);
+ da[1] = df.newDurationDayTime(1000000000000L);
+ da[2] = df.newDurationYearMonth(true, 1, 3);
+
+ for (int i = 0; i < da.length; ++i) {
+ Assert.assertEquals(da[i].negate(), serviceClient.getNewDurationForward(da[i]));
+ }
+ }
+
+ private void performTestNewObject(StandardTypesServiceClient serviceClient) {
+ Object[] objs = new Object[5];
+ objs[0] = "Hello";
+ objs[1] = 10;
+ objs[2] = null;
+ objs[3] = -1.0;
+ objs[4] = null;
+
+ for (int i = 0; i < objs.length; ++i) {
+ Object expected = StandardTypesTransformer.getNewObject(objs[i]);
+ Object actual = serviceClient.getNewObjectForward(objs[i]);
+ Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestNewObjectArray(StandardTypesServiceClient serviceClient) {
+ Object[] objs = new Object[5];
+ objs[0] = "Hello";
+ objs[1] = 10;
+ objs[2] = null;
+ objs[3] = -1.0;
+ objs[4] = null;
+
+ Object[] actual = serviceClient.getNewObjectArrayForward(objs);
+ Assert.assertEquals(objs.length, actual.length);
+ for (int i = 0; i < objs.length; ++i) {
+ Object expected = StandardTypesTransformer.getNewObject(objs[i]);
+ Assert.assertEquals(expected, actual[i]);
+ }
+ }
+
+ private void performTestNewImage(StandardTypesServiceClient serviceClient) throws InterruptedException {
+ // Create some images to test with.
+ Image[] imgs = new Image[3];
+ imgs[0] = new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);
+ imgs[1] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ imgs[2] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+ imgs[0].getGraphics().drawLine(1, 1, 8, 8);
+ imgs[1].getGraphics().drawLine(8, 1, 1, 8);
+ imgs[2].getGraphics().drawLine(1, 8, 8, 1);
+
+ Image[] copy = imgs;
+ // Create the same images once again as the StandardTypesTransformer may manipulate the image passed.
+ imgs = new Image[3];
+ imgs[0] = new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);
+ imgs[1] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ imgs[2] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+ imgs[0].getGraphics().drawLine(1, 1, 8, 8);
+ imgs[1].getGraphics().drawLine(8, 1, 1, 8);
+ imgs[2].getGraphics().drawLine(1, 8, 8, 1);
+
+ // Make sure the images and copies are equal using ImageInfo
+ for(int i = 0; i < imgs.length; ++i) {
+ Assert.assertEquals(new ImageInfo(imgs[i]), new ImageInfo(copy[i]));
+ }
+
+ for (int i = 0; i < imgs.length; ++i) {
+ Image actual = serviceClient.getNewImageForward(imgs[i]);
+ Image expected = StandardTypesTransformer.getNewImage(copy[i]);
+ // Compare using ImageInfo
+ Assert.assertEquals(new ImageInfo(expected), new ImageInfo(actual));
+ }
+ }
+
+ private void performTestNewImageArray(StandardTypesServiceClient serviceClient) throws InterruptedException {
+ // Create some images to test with.
+ Image[] imgs = new Image[3];
+ imgs[0] = new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);
+ imgs[1] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ imgs[2] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+ imgs[0].getGraphics().drawLine(1, 1, 8, 8);
+ imgs[1].getGraphics().drawLine(8, 1, 1, 8);
+ imgs[2].getGraphics().drawLine(1, 8, 8, 1);
+
+ Image[] copy = imgs;
+ // Create the same images once again as the StandardTypesTransformer may manipulate the image passed.
+ imgs = new Image[3];
+ imgs[0] = new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);
+ imgs[1] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ imgs[2] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+ imgs[0].getGraphics().drawLine(1, 1, 8, 8);
+ imgs[1].getGraphics().drawLine(8, 1, 1, 8);
+ imgs[2].getGraphics().drawLine(1, 8, 8, 1);
+
+ // Make sure the images and copies are equal using ImageInfo
+ for(int i = 0; i < imgs.length; ++i) {
+ Assert.assertEquals(new ImageInfo(imgs[i]), new ImageInfo(copy[i]));
+ }
+
+ Image[] actual = serviceClient.getNewImageArrayForward(imgs);
+ Assert.assertEquals(imgs.length, actual.length);
+ for (int i = 0; i < imgs.length; ++i) {
+ Image expected = StandardTypesTransformer.getNewImage(copy[i]);
+ // Compare using ImageInfo
+ Assert.assertEquals(new ImageInfo(expected), new ImageInfo(actual[i]));
+ }
+ }
+
+ private void performTestNewDurationArray(StandardTypesServiceClient serviceClient)
+ throws DatatypeConfigurationException {
+ DatatypeFactory df = DatatypeFactory.newInstance();
+ Duration[] da = new Duration[3];
+ da[0] = df.newDuration(1000000000000L);
+ da[1] = df.newDurationDayTime(1000000000000L);
+ da[2] = df.newDurationYearMonth(true, 1, 3);
+
+ Duration[] actual = serviceClient.getNewDurationArrayForward(da);
+ Assert.assertEquals(da.length, actual.length);
+ for (int i = 0; i < da.length; ++i) {
+ Assert.assertEquals(da[i].negate(), actual[i]);
+ }
+ }
+
+ private void performTestNewDataHandler(StandardTypesServiceClient serviceClient) throws IOException {
+ DataHandler[] dha = new DataHandler[3];
+ dha[0] = new DataHandler("Some data", "text/plain");
+ dha[1] = new DataHandler(this.getClass().getClassLoader().getResource("standard-types-service.composite"));
+ dha[2] = new DataHandler(new ByteArrayDataSource("Some data2".getBytes()));
+
+ for (int i = 0; i < dha.length; ++i) {
+ DataHandler actual = serviceClient.getNewDataHandlerForward(dha[i]);
+ // Note: The DataHandler returned may use a different type of DataSource.
+ // Compare the data content instead of using equals().
+ Assert.assertTrue(compare(dha[i], actual));
+ }
+ }
+
+ private void performTestNewDataHandlerArray(StandardTypesServiceClient serviceClient) throws IOException {
+ DataHandler[] dha = new DataHandler[3];
+ dha[0] = new DataHandler("Some data", "text/plain");
+ dha[1] = new DataHandler(this.getClass().getClassLoader().getResource("standard-types-service.composite"));
+ dha[2] = new DataHandler(new ByteArrayDataSource("Some data2".getBytes()));
+
+ DataHandler[] actual = serviceClient.getNewDataHandlerArrayForward(dha);
+ Assert.assertEquals(dha.length, actual.length);
+ for (int i = 0; i < dha.length; ++i) {
+ // Note: The DataHandler returned may use a different type of DataSource.
+ // Compare the data content instead of using equals().
+ Assert.assertTrue(compare(dha[i], actual[i]));
+ }
+ }
+
+ private void performTestNewSource(StandardTypesServiceClient serviceClient) throws Exception {
+ String xml = new String("<a>A<b>B</b><c>C</c></a>");
+ Source[] srcs = new Source[3];
+ srcs[0] = new DOMSource(new String2Node().transform(xml, null));
+ srcs[1] = new SAXSource(new InputSource(new StringReader(xml)));
+ srcs[2] = new StreamSource(new StringReader(xml));
+
+ for (int i = 0; i < srcs.length; ++i) {
+ Source expected = StandardTypesTransformer.getNewSource(srcs[i]);
+ Source actual = serviceClient.getNewSourceForward(srcs[i]);
+ // [rfeng] The data may come back as a different source
+ Assert.assertEquals(sourceToString(expected), sourceToString(actual));
+ }
+ }
+
+ private void performTestNewSourceArray(StandardTypesServiceClient serviceClient) throws Exception {
+ String xml = new String("<a>A<b>B</b><c>C</c></a>");
+ Source[] srcs = new Source[3];
+ srcs[0] = new DOMSource(new String2Node().transform(xml, null));
+ srcs[1] = new SAXSource(new InputSource(new StringReader(xml)));
+ srcs[2] = new StreamSource(new StringReader(xml));
+
+ Source[] actual = serviceClient.getNewSourceArrayForward(srcs);
+ Source[] expected = new Source[srcs.length];
+ for(int i = 0; i < srcs.length; ++i) {
+ expected[i] = StandardTypesTransformer.getNewSource(srcs[i]);
+ }
+ Assert.assertEquals(srcs.length, actual.length);
+ for (int i = 0; i < srcs.length; ++i) {
+ // [rfeng] The data may come back as a different source
+ Assert.assertEquals(sourceToString(expected[i]), sourceToString(actual[i]));
+ }
+
+ }
+
+ private void performTestNewUUID(StandardTypesServiceClient serviceClient) {
+ UUID[] uuids = new UUID[3];
+ uuids[0] = UUID.nameUUIDFromBytes("ABCDEFGHJKLMNOPQRSTUVWXYZ".getBytes());
+ uuids[1] = UUID.nameUUIDFromBytes("abcdefghjklmnopqrstuvwxyz".getBytes());
+ uuids[2] = UUID.randomUUID();
+
+ for (int i = 0; i < uuids.length; ++i) {
+ UUID expected = UUID.fromString(uuids[i].toString() + "AAA");
+ UUID actual = serviceClient.getNewUUIDForward(uuids[i]);
+ Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestNewUUIDArray(StandardTypesServiceClient serviceClient) {
+ UUID[] uuids = new UUID[3];
+ uuids[0] = UUID.nameUUIDFromBytes("ABCDEFGHJKLMNOPQRSTUVWXYZ".getBytes());
+ uuids[1] = UUID.nameUUIDFromBytes("abcdefghjklmnopqrstuvwxyz".getBytes());
+ uuids[2] = UUID.randomUUID();
+
+ UUID[] actual = serviceClient.getNewUUIDArrayForward(uuids);
+ for (int i = 0; i < uuids.length; ++i) {
+ UUID expected = UUID.fromString(uuids[i].toString() + "AAA");
+ Assert.assertEquals(expected, actual[i]);
+ }
+ }
+
+ /**
+ * This method compares two DataHandlers.
+ * @return true if the data in the two handlers is the same.
+ */
+ private boolean compare(DataHandler dh1, DataHandler dh2) throws IOException {
+ InputStream inp1 = dh1.getInputStream();
+ InputStream inp2 = dh2.getInputStream();
+ for(;;) {
+ int i1 = inp1.read();
+ int i2 = inp2.read();
+ if(i1 == -1 && i2 == -1) {
+ return true;
+ } else if(i1 != -1 && i2 != -1) {
+ if(i1 != i2) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * This method returns the content of a source object as String.
+ */
+ private String sourceToString(Source s) throws Exception {
+ StringWriter sw = new StringWriter();
+ Result r = new StreamResult(sw);
+ TransformerFactory.newInstance().newTransformer().transform(s, r);
+ sw.close();
+ return sw.toString();
+ }
+
+ /**
+ * This class initializes with the width, height and pixel data of a java.awt.Image object.
+ */
+ private static class ImageInfo {
+ private int h, w, pixels[];
+ public ImageInfo(Image img) throws InterruptedException {
+ w = img.getWidth(null);
+ h = img.getHeight(null);
+ pixels = new int[w*h];
+ PixelGrabber pg = new PixelGrabber(img, 0, 0, w, h, pixels, 0, w);
+ pg.grabPixels();
+ }
+
+ public boolean equals(Object that) {
+ if(that == null) {
+ return false;
+ } else if(!(that instanceof ImageInfo)) {
+ return false;
+ }
+
+ ImageInfo that1 = (ImageInfo)that;
+ if(w != that1.w || h != that1.h || pixels == null || that1.pixels == null || pixels.length != that1.pixels.length) {
+ return false;
+ }
+ for(int i = 0; i < pixels.length; ++i) {
+ if(pixels[i] != that1.pixels[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName()+"[w = "+w+", h = "+h+", pixels = "+pixels+"]";
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/pom.xml b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/pom.xml
new file mode 100644
index 0000000000..ae506499d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/pom.xml
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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$ -->
+
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-jaxb-top-down</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Databinding Integration Tests - JAXB Top Down</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings-common</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency-->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-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.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</version>
+ </dependency>
+ <!-- Added by Simon Nash -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.12</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- End of addition -->
+
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloService.java
new file mode 100644
index 0000000000..352f805c7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloService.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.itest.databindings.jaxb;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for HelloService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface HelloService {
+ String getGreetings(String name);
+ String[] getGreetingsArray(String[] names);
+ List<String> getGreetingsList(List<String> names);
+ ArrayList<String> getGreetingsArrayList(ArrayList<String> names);
+ Map<String, String> getGreetingsMap(Map<String, String> namesMap);
+ HashMap<String, String> getGreetingsHashMap(HashMap<String, String> namesMap);
+ String getGreetingsVarArgs(String... names);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceClient.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceClient.java
new file mode 100644
index 0000000000..7bd95cec95
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceClient.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.itest.databindings.jaxb;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * The interface for HelloServiceClient.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface HelloServiceClient {
+ String getGreetingsForward(String name);
+ String[] getGreetingsArrayForward(String[] names);
+ List<String> getGreetingsListForward(List<String> names);
+ ArrayList<String> getGreetingsArrayListForward(ArrayList<String> names);
+ Map<String, String> getGreetingsMapForward(Map<String, String> namesMap);
+ HashMap<String, String> getGreetingsHashMapForward(HashMap<String, String> namesMap);
+ String getGreetingsVarArgsForward(String... names);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java
new file mode 100644
index 0000000000..8c0fb24da9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.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.itest.databindings.jaxb;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for PrimitivesService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface PrimitivesService {
+ boolean negateBoolean(boolean flag);
+ boolean[] negateBooleanArray(boolean[] flags);
+ boolean[] identityBooleanArray(boolean[] flags);
+ byte negateByte(byte b);
+ byte[] negateByteArray(byte[] ba);
+ byte[] identityByteArray(byte[] ba);
+ short negateShort(short s);
+ short[] negateShortArray(short[] s);
+ short[] identityShortArray(short[] sa);
+ int negateInt(int s);
+ int[] negateIntArray(int[] s);
+ int[] identityIntArray(int[] ia);
+ long negateLong(long l);
+ long[] negateLongArray(long[] la);
+ long[] identityLongArray(long[] la);
+ float negateFloat(float f);
+ float[] negateFloatArray(float[] fa);
+ float[] identityFloatArray(float[] fa);
+ double negateDouble(double d);
+ double[] negateDoubleArray(double[] da);
+ double[] identityDoubleArray(double[] da);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java
new file mode 100644
index 0000000000..3a5a81bae4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.databindings.jaxb;
+
+
+/**
+ * The interface for PrimitivesServiceClient.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PrimitivesServiceClient {
+ boolean negateBooleanForward(boolean flag);
+ boolean[] negateBooleanArrayForward(boolean[] flags);
+ boolean passByValueBooleanArray();
+ byte negateByteForward(byte b);
+ byte[] negateByteArrayForward(byte[] ba);
+ boolean passByValueByteArray();
+ short negateShortForward(short s);
+ short[] negateShortArrayForward(short[] sa);
+ boolean passByValueShortArray();
+ int negateIntForward(int i);
+ int[] negateIntArrayForward(int[] ia);
+ boolean passByValueIntArray();
+ long negateLongForward(long l);
+ long[] negateLongArrayForward(long[] la);
+ boolean passByValueLongArray();
+ float negateFloatForward(float f);
+ float[] negateFloatArrayForward(float[] fa);
+ boolean passByValueFloatArray();
+ double negateDoubleForward(double d);
+ double[] negateDoubleArrayForward(double[] da);
+ boolean passByValueDoubleArray();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java
new file mode 100644
index 0000000000..4be057fe68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.databindings.jaxb;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+
+/**
+ * The interface for StandardTypesService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface StandardTypesService {
+ BigInteger getNewBigInteger(BigInteger bi);
+ BigInteger[] getNewBigIntegerArray(BigInteger[] bia);
+
+ BigDecimal getNewBigDecimal(BigDecimal bd);
+ BigDecimal[] getNewBigDecimalArray(BigDecimal[] bda);
+
+ Calendar getNewCalendar(Calendar c);
+ Calendar[] getNewCalendarArray(Calendar[] ca);
+
+ Date getNewDate(Date d);
+ Date[] getNewDateArray(Date[] da);
+
+ QName getNewQName(QName qname);
+ QName[] getNewQNameArray(QName[] qnames);
+
+ URI getNewURI(URI uri);
+ URI[] getNewURIArray(URI[] uris);
+
+ XMLGregorianCalendar getNewXMLGregorianCalendar(XMLGregorianCalendar xgcal);
+ XMLGregorianCalendar[] getNewXMLGregorianCalendarArray(XMLGregorianCalendar[] xgcal);
+
+ Duration getNewDuration(Duration d);
+ Duration[] getNewDurationArray(Duration[] da);
+
+ Object getNewObject(Object obj);
+ Object[] getNewObjectArray(Object[] objs);
+
+ Image getNewImage(Image img);
+ Image[] getNewImageArray(Image[] imgs);
+
+ DataHandler getNewDataHandler(DataHandler dh);
+ DataHandler[] getNewDataHandlerArray(DataHandler[] dha);
+
+ Source getNewSource(Source src);
+ Source[] getNewSourceArray(Source[] srcs);
+
+ UUID getNewUUID(UUID uuid);
+ UUID[] getNewUUIDArray(UUID[] uuids);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java
new file mode 100644
index 0000000000..0c073cd054
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.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.itest.databindings.jaxb;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+
+/**
+ * The interface for StandardTypesServiceClient.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StandardTypesServiceClient {
+ BigInteger getNewBigIntegerForward(BigInteger bi);
+ BigInteger[] getNewBigIntegerArrayForward(BigInteger[] bia);
+
+ BigDecimal getNewBigDecimalForward(BigDecimal bd);
+ BigDecimal[] getNewBigDecimalArrayForward(BigDecimal[] bda);
+
+ Calendar getNewCalendarForward(Calendar c);
+ Calendar[] getNewCalendarArrayForward(Calendar[] ca);
+
+ Date getNewDateForward(Date d);
+ Date[] getNewDateArrayForward(Date[] da);
+
+ QName getNewQNameForward(QName qname);
+ QName[] getNewQNameArrayForward(QName[] qnames);
+
+ URI getNewURIForward(URI uri);
+ URI[] getNewURIArrayForward(URI[] uris);
+
+ XMLGregorianCalendar getNewXMLGregorianCalendarForward(XMLGregorianCalendar xgcal);
+ XMLGregorianCalendar[] getNewXMLGregorianCalendarArrayForward(XMLGregorianCalendar[] xgcals);
+
+ Duration getNewDurationForward(Duration d);
+ Duration[] getNewDurationArrayForward(Duration[] da);
+
+ Object getNewObjectForward(Object obj);
+ Object[] getNewObjectArrayForward(Object[] objs);
+
+ Image getNewImageForward(Image img);
+ Image[] getNewImageArrayForward(Image[] imgs);
+
+ DataHandler getNewDataHandlerForward(DataHandler dh);
+ DataHandler[] getNewDataHandlerArrayForward(DataHandler[] dha);
+
+ Source getNewSourceForward(Source src);
+ Source[] getNewSourceArrayForward(Source[] srcs);
+
+ UUID getNewUUIDForward(UUID uuid);
+ UUID[] getNewUUIDArrayForward(UUID[] uuids);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceClientImpl.java
new file mode 100644
index 0000000000..c4026fdb9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceClientImpl.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.itest.databindings.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of HelloServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ */
+@Service(HelloServiceClient.class)
+public class HelloServiceClientImpl {
+
+ private HelloService service;
+
+ @Reference
+ public void setHelloService(HelloService service) {
+ this.service = service;
+ }
+
+ public String getGreetingsForward(String name) {
+ return service.getGreetings(name);
+ }
+
+ public String[] getGreetingsArrayForward(String[] names) {
+ return service.getGreetingsArray(names);
+ }
+
+ public List<String> getGreetingsListForward(List<String> names) {
+ return service.getGreetingsList(names);
+ }
+
+ public Map<String, String> getGreetingsMapForward(Map<String, String> namesMap) {
+ return service.getGreetingsMap(namesMap);
+ }
+
+ public ArrayList<String> getGreetingsArrayListForward(ArrayList<String> names) {
+ return service.getGreetingsArrayList(names);
+ }
+
+ public HashMap<String, String> getGreetingsHashMapForward(HashMap<String, String> namesMap) {
+ return service.getGreetingsHashMap(namesMap);
+ }
+
+ public String getGreetingsVarArgsForward(String... names) {
+ return service.getGreetingsVarArgs(names[0], names[1], names[2]);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceImpl.java
new file mode 100644
index 0000000000..fc2dc64b7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceImpl.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.itest.databindings.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloService;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of HelloService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(interfaces = {HelloService.class})
+public class HelloServiceImpl implements HelloService {
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ public String[] getGreetingsArray(String[] names) {
+ String[] resps = new String[names.length];
+ for (int i = 0; i < names.length; ++i) {
+ resps[i] = "Hello " + names[i];
+ }
+ return resps;
+ }
+
+ public List<String> getGreetingsList(List<String> names) {
+ List<String> resps = new ArrayList<String>();
+ for (int i = 0; i < names.size(); ++i) {
+ resps.add("Hello " + names.get(i));
+ }
+ return resps;
+ }
+
+ public ArrayList<String> getGreetingsArrayList(ArrayList<String> names) {
+ ArrayList<String> resps = new ArrayList<String>();
+ for (int i = 0; i < names.size(); ++i) {
+ resps.add("Hello " + names.get(i));
+ }
+ return resps;
+ }
+
+ public Map<String, String> getGreetingsMap(Map<String, String> namesMap) {
+ for (Map.Entry<String, String> entry : namesMap.entrySet()) {
+ entry.setValue("Hello " + entry.getKey());
+ }
+ return namesMap;
+ }
+
+ public HashMap<String, String> getGreetingsHashMap(HashMap<String, String> namesMap) {
+ for (Map.Entry<String, String> entry : namesMap.entrySet()) {
+ entry.setValue("Hello " + entry.getKey());
+ }
+ return namesMap;
+ }
+
+ public String getGreetingsVarArgs(String... names) {
+ String resp = "Hello";
+ for(int i = 0; i < names.length; ++i) {
+ resp += (" "+names[i]);
+ }
+ return resp;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java
new file mode 100644
index 0000000000..ef1a907b29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesServiceClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of PrimitivesServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(PrimitivesServiceClient.class)
+public class PrimitivesServiceClientImpl {
+
+ private PrimitivesService service;
+
+ @Reference
+ public void setPrimitivesService(PrimitivesService service) {
+ this.service = service;
+ }
+ public boolean negateBooleanForward(boolean flag) {
+ return service.negateBoolean(flag);
+ }
+
+ public boolean[] negateBooleanArrayForward(boolean[] flags) {
+ return service.negateBooleanArray(flags);
+ }
+
+ public boolean passByValueBooleanArray() {
+ boolean[] req = new boolean[2];
+ boolean[] resp = service.identityBooleanArray(req);
+ return req != resp;
+ }
+
+ public byte negateByteForward(byte b) {
+ return service.negateByte(b);
+ }
+
+ public byte[] negateByteArrayForward(byte[] ba) {
+ return service.negateByteArray(ba);
+ }
+
+ public boolean passByValueByteArray() {
+ byte[] req = new byte[2];
+ byte[] resp = service.identityByteArray(req);
+ return req != resp;
+ }
+
+ public short negateShortForward(short s) {
+ return service.negateShort(s);
+ }
+
+ public short[] negateShortArrayForward(short[] s) {
+ return service.negateShortArray(s);
+ }
+
+ public boolean passByValueShortArray() {
+ short[] req = new short[2];
+ short[] resp = service.identityShortArray(req);
+ return req != resp;
+ }
+
+ public int negateIntForward(int i) {
+ return service.negateInt(i);
+ }
+
+ public int[] negateIntArrayForward(int[] ia) {
+ return service.negateIntArray(ia);
+ }
+
+ public boolean passByValueIntArray() {
+ int[] req = new int[2];
+ int[] resp = service.identityIntArray(req);
+ return req != resp;
+ }
+
+ public long negateLongForward(long l) {
+ return service.negateLong(l);
+ }
+
+ public long[] negateLongArrayForward(long[] la) {
+ return service.negateLongArray(la);
+ }
+
+ public boolean passByValueLongArray() {
+ long[] req = new long[2];
+ long[] resp = service.identityLongArray(req);
+ return req != resp;
+ }
+
+ public float negateFloatForward(float f) {
+ return service.negateFloat(f);
+ }
+
+ public float[] negateFloatArrayForward(float[] fa) {
+ return service.negateFloatArray(fa);
+ }
+
+ public boolean passByValueFloatArray() {
+ float[] req = new float[2];
+ float[] resp = service.identityFloatArray(req);
+ return req != resp;
+ }
+
+ public double negateDoubleForward(double d) {
+ return service.negateDouble(d);
+ }
+
+ public double[] negateDoubleArrayForward(double[] da) {
+ return service.negateDoubleArray(da);
+ }
+
+ public boolean passByValueDoubleArray() {
+ double[] req = new double[2];
+ double[] resp = service.identityDoubleArray(req);
+ return req != resp;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java
new file mode 100644
index 0000000000..e60ae41767
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.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.itest.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of PrimitivesService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(interfaces={PrimitivesService.class})
+public class PrimitivesServiceImpl implements PrimitivesService {
+
+ public boolean negateBoolean(boolean flag) {
+ return !flag;
+ }
+
+ public boolean[] negateBooleanArray(boolean[] flags) {
+ boolean[] resp = new boolean[flags.length];
+
+ for(int i = 0; i < flags.length; ++i) {
+ resp[i] = !flags[i];
+ }
+ return resp;
+ }
+
+ public boolean[] identityBooleanArray(boolean[] flags) {
+ return flags;
+ }
+
+ public byte negateByte(byte b) {
+ return (byte)-b;
+ }
+
+ public byte[] negateByteArray(byte[] ba) {
+ byte[] resp = new byte[ba.length];
+
+ for(int i = 0; i < ba.length; ++i) {
+ resp[i] = (byte)-ba[i];
+ }
+ return resp;
+ }
+
+ public byte[] identityByteArray(byte[] ba) {
+ return ba;
+ }
+
+ public short negateShort(short s) {
+ return (short)-s;
+ }
+
+ public short[] negateShortArray(short[] s) {
+ short[] resp = new short[s.length];
+
+ for(int i = 0; i < s.length; ++i) {
+ resp[i] = (short)-s[i];
+ }
+ return resp;
+ }
+
+ public short[] identityShortArray(short[] sa) {
+ return sa;
+ }
+
+ public int negateInt(int i) {
+ return -i;
+ }
+
+ public int[] negateIntArray(int[] ia) {
+ int[] resp = new int[ia.length];
+
+ for(int i = 0; i < ia.length; ++i) {
+ resp[i] = -ia[i];
+ }
+ return resp;
+ }
+
+ public int[] identityIntArray(int[] ia) {
+ return ia;
+ }
+
+ public long negateLong(long l) {
+ return -l;
+ }
+
+ public long[] negateLongArray(long[] la) {
+ long[] resp = new long[la.length];
+
+ for(int i = 0; i < la.length; ++i) {
+ resp[i] = -la[i];
+ }
+ return resp;
+ }
+
+ public long[] identityLongArray(long[] la) {
+ return la;
+ }
+
+ public float negateFloat(float f) {
+ return -f;
+ }
+
+ public float[] negateFloatArray(float[] fa) {
+ float[] resp = new float[fa.length];
+
+ for(int i = 0; i < fa.length; ++i) {
+ resp[i] = -fa[i];
+ }
+ return resp;
+ }
+
+ public float[] identityFloatArray(float[] fa) {
+ return fa;
+ }
+
+ public double negateDouble(double d) {
+ return -d;
+ }
+
+ public double[] negateDoubleArray(double[] da) {
+ double[] resp = new double[da.length];
+
+ for(int i = 0; i < da.length; ++i) {
+ resp[i] = -da[i];
+ }
+ return resp;
+ }
+
+ public double[] identityDoubleArray(double[] da) {
+ return da;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java
new file mode 100644
index 0000000000..8803eb262a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.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.itest.databindings.jaxb.impl;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesServiceClient;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of StandardTypesServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(StandardTypesServiceClient.class)
+public class StandardTypesServiceClientImpl implements StandardTypesServiceClient{
+
+ private StandardTypesService service;
+
+ @Reference
+ public void setStandardTypesService(StandardTypesService service) {
+ this.service = service;
+ }
+
+ public BigInteger getNewBigIntegerForward(BigInteger bi) {
+ return service.getNewBigInteger(bi);
+ }
+
+ public BigInteger[] getNewBigIntegerArrayForward(BigInteger[] bia) {
+ return service.getNewBigIntegerArray(bia);
+ }
+
+ public BigDecimal getNewBigDecimalForward(BigDecimal bd) {
+ return service.getNewBigDecimal(bd);
+ }
+
+ public BigDecimal[] getNewBigDecimalArrayForward(BigDecimal[] bda) {
+ return service.getNewBigDecimalArray(bda);
+ }
+ public Calendar getNewCalendarForward(Calendar c) {
+ return service.getNewCalendar(c);
+ }
+ public Calendar[] getNewCalendarArrayForward(Calendar[] ca) {
+ return service.getNewCalendarArray(ca);
+ }
+
+ public Date getNewDateForward(Date d) {
+ return service.getNewDate(d);
+ }
+
+ public Date[] getNewDateArrayForward(Date[] da) {
+ return service.getNewDateArray(da);
+ }
+
+ public QName getNewQNameForward(QName qname) {
+ return service.getNewQName(qname);
+ }
+
+ public QName[] getNewQNameArrayForward(QName[] qnames) {
+ return service.getNewQNameArray(qnames);
+ }
+
+ public URI getNewURIForward(URI uri) {
+ return service.getNewURI(uri);
+ }
+
+ public URI[] getNewURIArrayForward(URI[] uris) {
+ return service.getNewURIArray(uris);
+ }
+
+ public XMLGregorianCalendar getNewXMLGregorianCalendarForward(XMLGregorianCalendar xgcal) {
+ return service.getNewXMLGregorianCalendar(xgcal);
+ }
+
+ public XMLGregorianCalendar[] getNewXMLGregorianCalendarArrayForward(XMLGregorianCalendar[] xgcals) {
+ return service.getNewXMLGregorianCalendarArray(xgcals);
+ }
+
+ public Duration getNewDurationForward(Duration d) {
+ return service.getNewDuration(d);
+ }
+
+ public Duration[] getNewDurationArrayForward(Duration[] da) {
+ return service.getNewDurationArray(da);
+ }
+
+ public Object getNewObjectForward(Object obj) {
+ return service.getNewObject(obj);
+ }
+
+ public Object[] getNewObjectArrayForward(Object[] objs) {
+ return service.getNewObjectArray(objs);
+ }
+
+ public Image getNewImageForward(Image img) {
+ return service.getNewImage(img);
+ }
+
+ public Image[] getNewImageArrayForward(Image[] imgs) {
+ return service.getNewImageArray(imgs);
+ }
+
+ public DataHandler getNewDataHandlerForward(DataHandler dh) {
+ return service.getNewDataHandler(dh);
+ }
+
+ public DataHandler[] getNewDataHandlerArrayForward(DataHandler[] dha) {
+ return service.getNewDataHandlerArray(dha);
+ }
+
+
+ public Source getNewSourceForward(Source src) {
+ return service.getNewSource(src);
+ }
+
+ public Source[] getNewSourceArrayForward(Source[] srcs) {
+ return service.getNewSourceArray(srcs);
+ }
+
+ public UUID getNewUUIDForward(UUID uuid) {
+ return service.getNewUUID(uuid);
+ }
+
+ public UUID[] getNewUUIDArrayForward(UUID[] uuids) {
+ return service.getNewUUIDArray(uuids);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java
new file mode 100644
index 0000000000..46569311ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb.impl;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of StandardTypesService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(interfaces={StandardTypesService.class})
+public class StandardTypesServiceImpl implements StandardTypesService {
+ public BigInteger getNewBigInteger(BigInteger bi) {
+ return bi.negate();
+ }
+
+ public BigInteger[] getNewBigIntegerArray(BigInteger[] bia) {
+ BigInteger[] resp = new BigInteger[bia.length];
+ for(int i = 0; i < bia.length; ++i) {
+ resp[i] = bia[i].negate();
+ }
+ return resp;
+ }
+
+ public BigDecimal getNewBigDecimal(BigDecimal bd) {
+ return bd.negate();
+ }
+
+ public BigDecimal[] getNewBigDecimalArray(BigDecimal[] bda) {
+ BigDecimal[] resp = new BigDecimal[bda.length];
+ for(int i = 0; i < bda.length; ++i) {
+ resp[i] = bda[i].negate();
+ }
+ return resp;
+ }
+
+ public Calendar getNewCalendar(Calendar c) {
+ Calendar resp = (Calendar)c.clone();
+ resp.add(Calendar.DAY_OF_MONTH, 5);
+ return resp;
+ }
+
+ public Calendar[] getNewCalendarArray(Calendar[] ca) {
+ Calendar[] resp = new Calendar[ca.length];
+ for(int i = 0; i < ca.length; ++i) {
+ resp[i] = getNewCalendar(ca[i]);
+ }
+ return resp;
+ }
+
+ public Date getNewDate(Date d) {
+ return new Date(d.getTime() + 5*24*60*60*1000);
+ }
+
+ public Date[] getNewDateArray(Date[] da) {
+ Date[] resp = new Date[da.length];
+ for(int i = 0; i < da.length; ++i) {
+ resp[i] = getNewDate(da[i]);
+ }
+ return resp;
+ }
+
+ public QName getNewQName(QName qname) {
+ return new QName(qname.getNamespaceURI()+"q", qname.getLocalPart()+"q", qname.getPrefix()+"q");
+
+ }
+
+ public QName[] getNewQNameArray(QName[] qnames) {
+ QName[] resp = new QName[qnames.length];
+ for(int i = 0; i < qnames.length; ++i) {
+ resp[i] = getNewQName(qnames[i]);
+ }
+ return resp;
+ }
+
+ public URI getNewURI(URI uri) {
+ return uri.resolve("uri");
+ }
+
+ public URI[] getNewURIArray(URI[] uris) {
+ URI[] resp = new URI[uris.length];
+ for(int i = 0; i < uris.length; ++i) {
+ resp[i] = getNewURI(uris[i]);
+ }
+ return resp;
+ }
+
+ public XMLGregorianCalendar getNewXMLGregorianCalendar(XMLGregorianCalendar xgcal) {
+ xgcal = (XMLGregorianCalendar)xgcal.clone();
+ xgcal.setDay(xgcal.getDay()+5);
+ return xgcal;
+ }
+
+ public XMLGregorianCalendar[] getNewXMLGregorianCalendarArray(XMLGregorianCalendar[] xgcals) {
+ XMLGregorianCalendar[] resp = new XMLGregorianCalendar[xgcals.length];
+ for(int i = 0; i < xgcals.length; ++i) {
+ resp[i] = getNewXMLGregorianCalendar(xgcals[i]);
+ }
+ return resp;
+ }
+
+ public Duration getNewDuration(Duration d) {
+ return d.negate();
+ }
+
+ public Duration[] getNewDurationArray(Duration[] da) {
+ Duration[] resp = new Duration[da.length];
+ for(int i = 0; i < da.length; ++i) {
+ resp[i] = da[i].negate();
+ }
+ return resp;
+ }
+
+ public Object getNewObject(Object obj) {
+ return StandardTypesTransformer.getNewObject(obj);
+ }
+
+ public Object[] getNewObjectArray(Object[] objs) {
+ Object[] resp = new Object[objs.length];
+ for(int i = 0; i < objs.length; ++i) {
+ resp[i] = getNewObject(objs[i]);
+ }
+ return resp;
+ }
+
+ public Image getNewImage(Image img) {
+ return StandardTypesTransformer.getNewImage(img);
+ }
+
+ public Image[] getNewImageArray(Image[] imgs) {
+ Image[] resp = new Image[imgs.length];
+ for(int i = 0; i < imgs.length; ++i) {
+ resp[i] = getNewImage(imgs[i]);
+ }
+ return resp;
+ }
+
+ public DataHandler getNewDataHandler(DataHandler dh) {
+ // FIXME: transform the input
+ return dh;
+ }
+
+ public DataHandler[] getNewDataHandlerArray(DataHandler[] dha) {
+ DataHandler[] resp = new DataHandler[dha.length];
+ for(int i = 0; i < dha.length; ++i) {
+ resp[i] = dha[i];
+ }
+ return resp;
+ }
+
+ public Source getNewSource(Source src) {
+ return StandardTypesTransformer.getNewSource(src);
+ }
+
+ public Source[] getNewSourceArray(Source[] srcs) {
+ Source[] resp = new Source[srcs.length];
+ for(int i = 0; i < srcs.length; ++i) {
+ resp[i] = getNewSource(srcs[i]);
+ }
+ return resp;
+ }
+
+ public UUID getNewUUID(UUID uuid) {
+ return UUID.fromString(uuid.toString()+"AAA");
+ }
+
+ public UUID[] getNewUUIDArray(UUID[] uuids) {
+ UUID[] resp = new UUID[uuids.length];
+ for(int i = 0; i < uuids.length; ++i) {
+ resp[i] = getNewUUID(uuids[i]);
+ }
+ return resp;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java
new file mode 100644
index 0000000000..9d851455da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.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.itest.databindings.jaxb.impl;
+
+import java.awt.Image;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayReader;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+
+/**
+ * StandardTypesTransformer class that provide for transforming input provided to StandardTypesService methods.
+ *
+ * @version $Rev$ $Date$
+ */
+public class StandardTypesTransformer {
+
+ public static Object getNewObject(Object obj) {
+ if(obj instanceof String) {
+ return "Hello "+obj;
+ } else if(obj instanceof Integer) {
+ return new Integer(-((Integer)obj).intValue());
+ } else if(obj instanceof Double) {
+ return new Double(-((Double)obj).doubleValue());
+ }
+
+ return obj;
+ }
+
+ /**
+ * Returns a copy of the source object if the input is DOMSource, SAXSource or StreamSource.
+ * Returns the input object as is for other types.
+ */
+ public static Source getNewSource(Source src) {
+ Source ret = null;
+ if(src instanceof DOMSource) {
+ DOMSource dsrc = (DOMSource)src;
+ ret = new DOMSource(dsrc.getNode() != null ? dsrc.getNode().cloneNode(true) : null);
+ } else if(src instanceof SAXSource) {
+ SAXSource ssrc = (SAXSource)src;
+ if(ssrc.getInputSource().getByteStream() != null) {
+ InputStream inp = ssrc.getInputSource().getByteStream();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ int b;
+ try {
+ while((b = inp.read()) != -1) {
+ bout.write(b);
+ }
+ } catch (IOException ignored) {
+ }
+ try { bout.close();} catch (IOException ignored) {}
+ try { inp.reset();} catch (IOException ignored) {}
+ ret = new SAXSource(new InputSource(new ByteArrayInputStream(bout.toByteArray())));
+ } else if(ssrc.getInputSource().getCharacterStream() != null) {
+ Reader rdr = ssrc.getInputSource().getCharacterStream();
+ CharArrayWriter caw = new CharArrayWriter();
+ try {
+ int c;
+ while((c = rdr.read()) != -1) {
+ caw.append((char)c);
+ }
+ } catch (IOException ignored) {
+ }
+ caw.close();
+ try{ rdr.reset();} catch(IOException ignored) {}
+ ret = new SAXSource(new InputSource(new CharArrayReader(caw.toCharArray())));
+ } else {
+ ret = new SAXSource();
+ }
+ } else if(src instanceof StreamSource) {
+ StreamSource ssrc = (StreamSource)src;
+ if(ssrc.getInputStream() != null) {
+ InputStream inp = ssrc.getInputStream();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ int b;
+ try {
+ while((b = inp.read()) != -1) {
+ bout.write(b);
+ }
+ } catch (IOException ignored) {
+ }
+ try { bout.close();} catch (IOException ignored) {}
+ try { inp.reset();} catch (IOException ignored) {}
+ ret = new StreamSource(new ByteArrayInputStream(bout.toByteArray()));
+ } else if(ssrc.getReader() != null) {
+ Reader rdr = ssrc.getReader();
+ CharArrayWriter caw = new CharArrayWriter();
+ try {
+ int c;
+ while((c = rdr.read()) != -1) {
+ caw.append((char)c);
+ }
+ } catch (IOException ignored) {
+ }
+ caw.close();
+ try{ rdr.reset();} catch(IOException ignored) {}
+ ret = new StreamSource(new CharArrayReader(caw.toCharArray()));
+ } else {
+ ret = new StreamSource();
+ }
+ }
+
+ if(ret != null) {
+ ret.setSystemId(src.getSystemId());
+ } else {
+ ret = src;
+ }
+ return ret;
+ }
+
+ public static Image getNewImage(Image arg) {
+ arg.getGraphics().drawOval(2, 2, 7, 7);
+ return arg;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/hello-service.wsdl b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/hello-service.wsdl
new file mode 100644
index 0000000000..926e4154aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/hello-service.wsdl
@@ -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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<wsdl:definitions name="HelloService"
+ targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:tns="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xs:schema targetNamespace="http://util.java/"
+ version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:complexType name="arrayList">
+ <xs:complexContent>
+ <xs:extension base="abstractList">
+ <xs:sequence />
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType abstract="true" name="abstractList">
+ <xs:complexContent>
+ <xs:extension base="abstractCollection">
+ <xs:sequence />
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType abstract="true" name="abstractCollection">
+ <xs:sequence />
+ </xs:complexType>
+ <xs:complexType name="hashMap">
+ <xs:complexContent>
+ <xs:extension base="abstractMap">
+ <xs:sequence />
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType abstract="true" name="abstractMap">
+ <xs:sequence />
+ </xs:complexType>
+ </xs:schema>
+ <xs:schema targetNamespace="http://jaxb.dev.java.net/array"
+ version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:complexType final="#all" name="stringArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:ns0="http://util.java/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsList">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsListResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsArrayList">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="ns0:arrayList" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsArrayListResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="ns0:arrayList" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsMap">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsMapResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsHashMap">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="ns0:hashMap" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsHashMapResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="ns0:hashMap" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsVarArgs">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsVarArgsResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getGreetings">
+ <wsdl:part name="getGreetings" element="tns:getGreetings">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part name="getGreetingsResponse"
+ element="tns:getGreetingsResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsArray">
+ <wsdl:part name="getGreetingsArray"
+ element="tns:getGreetingsArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsArrayResponse">
+ <wsdl:part name="getGreetingsArrayResponse"
+ element="tns:getGreetingsArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsList">
+ <wsdl:part name="getGreetingsList"
+ element="tns:getGreetingsList">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsListResponse">
+ <wsdl:part name="getGreetingsListResponse"
+ element="tns:getGreetingsListResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsArrayList">
+ <wsdl:part name="getGreetingsArrayList"
+ element="tns:getGreetingsArrayList">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsArrayListResponse">
+ <wsdl:part name="getGreetingsArrayListResponse"
+ element="tns:getGreetingsArrayListResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsMap">
+ <wsdl:part name="getGreetingsMap"
+ element="tns:getGreetingsMap">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsMapResponse">
+ <wsdl:part name="getGreetingsMapResponse"
+ element="tns:getGreetingsMapResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsHashMap">
+ <wsdl:part name="getGreetingsHashMap"
+ element="tns:getGreetingsHashMap">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsHashMapResponse">
+ <wsdl:part name="getGreetingsHashMapResponse"
+ element="tns:getGreetingsHashMapResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsVarArgs">
+ <wsdl:part name="getGreetingsVarArgs"
+ element="tns:getGreetingsVarArgs">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsVarArgsResponse">
+ <wsdl:part name="getGreetingsVarArgsResponse"
+ element="tns:getGreetingsVarArgsResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloService">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetings"></wsdl:input>
+ <wsdl:output message="tns:getGreetingsResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsArray">
+ <wsdl:input message="tns:getGreetingsArray"></wsdl:input>
+ <wsdl:output message="tns:getGreetingsArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsList">
+ <wsdl:input message="tns:getGreetingsList"></wsdl:input>
+ <wsdl:output message="tns:getGreetingsListResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsArrayList">
+ <wsdl:input message="tns:getGreetingsArrayList">
+ </wsdl:input>
+ <wsdl:output message="tns:getGreetingsArrayListResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsMap">
+ <wsdl:input message="tns:getGreetingsMap">
+ </wsdl:input>
+ <wsdl:output message="tns:getGreetingsMapResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsHashMap">
+ <wsdl:input message="tns:getGreetingsHashMap"></wsdl:input>
+ <wsdl:output message="tns:getGreetingsHashMapResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsVarArgs">
+ <wsdl:input message="tns:getGreetingsVarArgs">
+ </wsdl:input>
+ <wsdl:output message="tns:getGreetingsVarArgsResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloServiceBinding" type="tns:HelloService">
+ <soap11:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetings">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsList">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsArrayList">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsMap">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsHashMap">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsVarArgs">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloServiceService">
+ <wsdl:port name="HelloServicePort"
+ binding="tns:HelloServiceBinding">
+ <soap11:address location="http://localhost:8085/hs-ep" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/helloservice.composite b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/helloservice.composite
new file mode 100644
index 0000000000..63151f6a2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/helloservice.composite
@@ -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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ name="HelloService">
+
+ <!-- Clients to test the service -->
+ <!-- A HelloServiceClient component that uses WS binding to invoke HelloService service.
+ The service component uses interface.wsdl on the service element.
+ This client component uses interface.wsdl on the reference element. -->
+ <component name="HelloServiceClientW2WComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloServiceClientImpl" />
+ <reference name="helloService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org/#wsdl.interface(HelloService)"/>
+ <binding.ws uri="http://localhost:8085/hs-ep-w"/>
+ </reference>
+ </component>
+
+ <!-- A HelloServiceClient component that uses WS binding to invoke HelloService service.
+ The service component uses interface.wsdl on the service element.
+ This client component uses interface.java on the reference element. -->
+ <component name="HelloServiceClientJ2WComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloServiceClientImpl" />
+ <reference name="helloService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.HelloService"/>
+ <binding.ws uri="http://localhost:8085/hs-ep-w"/>
+ </reference>
+ </component>
+
+ <!-- A HelloServiceClient component that uses WS binding to invoke HelloService service.
+ The service component uses interface.wsdl on the service element.
+ This client component uses interface.java on the reference element. -->
+ <component name="HelloServiceClientW2JComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloServiceClientImpl" />
+ <reference name="helloService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org/#wsdl.interface(HelloService)"/>
+ <binding.ws uri="http://localhost:8085/hs-ep-j"/>
+ </reference>
+ </component>
+
+ <!-- Components used to implement the services -->
+ <!-- A HelloService component that uses interface.wsdl -->
+ <component name="HelloServiceWSDLComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloServiceImpl"/>
+ <service name="HelloService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org/#wsdl.interface(HelloService)"/>
+ <binding.ws uri="http://localhost:8085/hs-ep-w"/>
+ </service>
+ </component>
+
+ <!-- A HelloService component that uses interface.java -->
+ <component name="HelloServiceJavaComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.HelloServiceImpl"/>
+ <service name="HelloService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.HelloService"/>
+ <binding.ws uri="http://localhost:8085/hs-ep-j"/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/primitives-service.wsdl b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/primitives-service.wsdl
new file mode 100644
index 0000000000..f366783e5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/primitives-service.wsdl
@@ -0,0 +1,927 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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$ -->
+
+<wsdl:definitions name="PrimitivesService"
+ targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:tns="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xs:schema targetNamespace="http://jaxb.dev.java.net/array"
+ version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:complexType final="#all" name="shortArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:short" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="intArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:int" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="floatArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:float" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="doubleArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:double" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="longArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:long" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="booleanArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:boolean" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="negateLongArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:long" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityByteArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateDoubleArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:double" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityFloatArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:float" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateLong">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ type="xs:long" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityIntArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:int" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateIntResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ type="xs:int" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateLongArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:long" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateInt">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ type="xs:int" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateFloatArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:float" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityDoubleArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:double" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateDouble">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ type="xs:double" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityByteArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateByte">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ type="xs:byte" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityLongArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:long" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateDoubleResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ type="xs:double" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityFloatArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:float" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateFloat">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ type="xs:float" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateShortArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:short" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateByteArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateLongResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ type="xs:long" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateShortArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:short" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateFloatArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:float" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateBoolean">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ type="xs:boolean" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateShort">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ type="xs:short" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateByteArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityBooleanArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:boolean" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityShortArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:short" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateBooleanResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ type="xs:boolean" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateFloatResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ type="xs:float" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityBooleanArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:boolean" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateBooleanArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:boolean" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateDoubleArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:double" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityDoubleArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:double" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateIntArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:int" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityIntArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:int" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateByteResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ type="xs:byte" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateBooleanArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:boolean" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateShortResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ type="xs:short" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="negateIntArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:int" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityShortArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:short" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="identityLongArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:long" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="negateLongArrayResponse">
+ <wsdl:part name="negateLongArrayResponse"
+ element="tns:negateLongArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityByteArrayResponse">
+ <wsdl:part name="identityByteArrayResponse"
+ element="tns:identityByteArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateDoubleArray">
+ <wsdl:part name="negateDoubleArray"
+ element="tns:negateDoubleArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityFloatArray">
+ <wsdl:part name="identityFloatArray"
+ element="tns:identityFloatArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateLong">
+ <wsdl:part name="negateLong" element="tns:negateLong">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityIntArray">
+ <wsdl:part name="identityIntArray"
+ element="tns:identityIntArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateIntResponse">
+ <wsdl:part name="negateIntResponse"
+ element="tns:negateIntResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateLongArray">
+ <wsdl:part name="negateLongArray"
+ element="tns:negateLongArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateInt">
+ <wsdl:part name="negateInt" element="tns:negateInt"></wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="negateFloatArrayResponse">
+ <wsdl:part name="negateFloatArrayResponse"
+ element="tns:negateFloatArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityDoubleArrayResponse">
+ <wsdl:part name="identityDoubleArrayResponse"
+ element="tns:identityDoubleArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateDouble">
+ <wsdl:part name="negateDouble" element="tns:negateDouble">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityByteArray">
+ <wsdl:part name="identityByteArray"
+ element="tns:identityByteArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateByte">
+ <wsdl:part name="negateByte" element="tns:negateByte">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityLongArrayResponse">
+ <wsdl:part name="identityLongArrayResponse"
+ element="tns:identityLongArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateDoubleResponse">
+ <wsdl:part name="negateDoubleResponse"
+ element="tns:negateDoubleResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityFloatArrayResponse">
+ <wsdl:part name="identityFloatArrayResponse"
+ element="tns:identityFloatArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateFloat">
+ <wsdl:part name="negateFloat" element="tns:negateFloat">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="negateShortArrayResponse">
+ <wsdl:part name="negateShortArrayResponse"
+ element="tns:negateShortArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateByteArrayResponse">
+ <wsdl:part name="negateByteArrayResponse"
+ element="tns:negateByteArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateLongResponse">
+ <wsdl:part name="negateLongResponse"
+ element="tns:negateLongResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateShortArray">
+ <wsdl:part name="negateShortArray"
+ element="tns:negateShortArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateFloatArray">
+ <wsdl:part name="negateFloatArray"
+ element="tns:negateFloatArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateBoolean">
+ <wsdl:part name="negateBoolean" element="tns:negateBoolean">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateShort">
+ <wsdl:part name="negateShort" element="tns:negateShort">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateByteArray">
+ <wsdl:part name="negateByteArray"
+ element="tns:negateByteArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityBooleanArray">
+ <wsdl:part name="identityBooleanArray"
+ element="tns:identityBooleanArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityShortArrayResponse">
+ <wsdl:part name="identityShortArrayResponse"
+ element="tns:identityShortArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateBooleanResponse">
+ <wsdl:part name="negateBooleanResponse"
+ element="tns:negateBooleanResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateFloatResponse">
+ <wsdl:part name="negateFloatResponse"
+ element="tns:negateFloatResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityBooleanArrayResponse">
+ <wsdl:part name="identityBooleanArrayResponse"
+ element="tns:identityBooleanArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateBooleanArray">
+ <wsdl:part name="negateBooleanArray"
+ element="tns:negateBooleanArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateDoubleArrayResponse">
+ <wsdl:part name="negateDoubleArrayResponse"
+ element="tns:negateDoubleArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityDoubleArray">
+ <wsdl:part name="identityDoubleArray"
+ element="tns:identityDoubleArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateIntArrayResponse">
+ <wsdl:part name="negateIntArrayResponse"
+ element="tns:negateIntArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityIntArrayResponse">
+ <wsdl:part name="identityIntArrayResponse"
+ element="tns:identityIntArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateByteResponse">
+ <wsdl:part name="negateByteResponse"
+ element="tns:negateByteResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateBooleanArrayResponse">
+ <wsdl:part name="negateBooleanArrayResponse"
+ element="tns:negateBooleanArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateShortResponse">
+ <wsdl:part name="negateShortResponse"
+ element="tns:negateShortResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="negateIntArray">
+ <wsdl:part name="negateIntArray" element="tns:negateIntArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityShortArray">
+ <wsdl:part name="identityShortArray"
+ element="tns:identityShortArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="identityLongArray">
+ <wsdl:part name="identityLongArray"
+ element="tns:identityLongArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="PrimitivesService">
+ <wsdl:operation name="negateBoolean">
+ <wsdl:input message="tns:negateBoolean">
+ </wsdl:input>
+ <wsdl:output message="tns:negateBooleanResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateBooleanArray">
+ <wsdl:input message="tns:negateBooleanArray"></wsdl:input>
+ <wsdl:output message="tns:negateBooleanArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityBooleanArray">
+ <wsdl:input message="tns:identityBooleanArray"></wsdl:input>
+ <wsdl:output message="tns:identityBooleanArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateByte">
+ <wsdl:input message="tns:negateByte">
+ </wsdl:input>
+ <wsdl:output message="tns:negateByteResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateByteArray">
+ <wsdl:input message="tns:negateByteArray"></wsdl:input>
+ <wsdl:output message="tns:negateByteArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityByteArray">
+ <wsdl:input message="tns:identityByteArray"></wsdl:input>
+ <wsdl:output message="tns:identityByteArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateShort">
+ <wsdl:input message="tns:negateShort">
+ </wsdl:input>
+ <wsdl:output message="tns:negateShortResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateShortArray">
+ <wsdl:input message="tns:negateShortArray"></wsdl:input>
+ <wsdl:output message="tns:negateShortArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityShortArray">
+ <wsdl:input message="tns:identityShortArray"></wsdl:input>
+ <wsdl:output message="tns:identityShortArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateInt">
+ <wsdl:input message="tns:negateInt">
+ </wsdl:input>
+ <wsdl:output message="tns:negateIntResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateIntArray">
+ <wsdl:input message="tns:negateIntArray"></wsdl:input>
+ <wsdl:output message="tns:negateIntArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityIntArray">
+ <wsdl:input message="tns:identityIntArray"></wsdl:input>
+ <wsdl:output message="tns:identityIntArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateLong">
+ <wsdl:input message="tns:negateLong">
+ </wsdl:input>
+ <wsdl:output message="tns:negateLongResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateLongArray">
+ <wsdl:input message="tns:negateLongArray"></wsdl:input>
+ <wsdl:output message="tns:negateLongArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityLongArray">
+ <wsdl:input message="tns:identityLongArray"></wsdl:input>
+ <wsdl:output message="tns:identityLongArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateFloat">
+ <wsdl:input message="tns:negateFloat">
+ </wsdl:input>
+ <wsdl:output message="tns:negateFloatResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateFloatArray">
+ <wsdl:input message="tns:negateFloatArray"></wsdl:input>
+ <wsdl:output message="tns:negateFloatArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityFloatArray">
+ <wsdl:input message="tns:identityFloatArray"></wsdl:input>
+ <wsdl:output message="tns:identityFloatArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateDouble">
+ <wsdl:input message="tns:negateDouble">
+ </wsdl:input>
+ <wsdl:output message="tns:negateDoubleResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateDoubleArray">
+ <wsdl:input message="tns:negateDoubleArray"></wsdl:input>
+ <wsdl:output message="tns:negateDoubleArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityDoubleArray">
+ <wsdl:input message="tns:identityDoubleArray"></wsdl:input>
+ <wsdl:output message="tns:identityDoubleArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="PrimitivesServiceBinding"
+ type="tns:PrimitivesService">
+ <soap11:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="negateBoolean">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateBooleanArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityBooleanArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateByte">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateByteArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityByteArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateShort">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateShortArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityShortArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateInt">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateIntArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityIntArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateLong">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateLongArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityLongArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateFloat">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateFloatArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityFloatArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateDouble">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="negateDoubleArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="identityDoubleArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="PrimitivesServiceService">
+ <wsdl:port name="PrimitivesServicePort"
+ binding="tns:PrimitivesServiceBinding">
+ <soap11:address location="http://localhost:8085/ps-ep" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/primitivesservice.composite b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/primitivesservice.composite
new file mode 100644
index 0000000000..85ca6d0789
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/primitivesservice.composite
@@ -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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="PrimitivesService">
+
+ <!-- Clients to test the service -->
+ <!-- A PrimitivesServiceClient component that uses WS binding to invoke PrimitivesService.
+ The service component uses interface.wsdl on the service element.
+ This client component uses interface.wsdl on the reference element. -->
+ <component name="PrimitivesServiceClientW2WComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.PrimitivesServiceClientImpl" />
+ <reference name="primitivesService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org/#wsdl.interface(PrimitivesService)"/>
+ <binding.ws uri="http://localhost:8085/ps-ep-w"/>
+ </reference>
+ </component>
+
+ <!-- A PrimitivesServiceClient component that uses WS binding to invoke PrimitivesService.
+ The service component uses interface.wsdl on the service element.
+ This client component uses interface.java on the reference element. -->
+ <component name="PrimitivesServiceClientJ2WComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.PrimitivesServiceClientImpl" />
+ <reference name="primitivesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService"/>
+ <binding.ws uri="http://localhost:8085/ps-ep-w"/>
+ </reference>
+ </component>
+
+ <!-- A PrimitivesServiceClient component that uses WS binding to invoke PrimitivesService.
+ The service component uses interface.java on the service element.
+ This client component uses interface.wsdl on the reference element. -->
+ <component name="PrimitivesServiceClientW2JComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.PrimitivesServiceClientImpl" />
+ <reference name="primitivesService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org/#wsdl.interface(PrimitivesService)"/>
+ <binding.ws uri="http://localhost:8085/ps-ep-j"/>
+ </reference>
+ </component>
+
+ <!-- Components used to implement the services -->
+ <!-- A PrimitivesService component that uses interface.java -->
+ <component name="PrimitivesServiceJavaComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.PrimitivesServiceImpl"/>
+ <service name="PrimitivesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService"/>
+ <binding.ws uri="http://localhost:8085/ps-ep-j"/>
+ </service>
+ </component>
+
+ <!-- A PrimitivesService component that uses interface.wsdl -->
+ <component name="PrimitivesServiceWSDLComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.PrimitivesServiceImpl"/>
+ <service name="PrimitivesService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org/#wsdl.interface(PrimitivesService)"/>
+ <binding.ws uri="http://localhost:8085/ps-ep-w"/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/standard-types-service.composite b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/standard-types-service.composite
new file mode 100644
index 0000000000..4788df78e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/standard-types-service.composite
@@ -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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="StandardTypesService">
+
+ <!-- Clients to test the service -->
+ <!-- A StandardTypesServiceClient component that uses WS binding to invoke StandardTypesService.
+ The service component uses interface.wsdl on the service element.
+ This client component uses interface.wsdl on the reference element. -->
+ <component name="StandardTypesServiceClientW2WComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesServiceClientImpl" />
+ <reference name="standardTypesService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org/#wsdl.interface(StandardTypesService)"/>
+ <binding.ws uri="http://localhost:8085/sts-ep-w"/>
+ </reference>
+ </component>
+
+ <!-- A StandardTypesServiceClient component that uses WS binding to invoke StandardTypesService.
+ The service component uses interface.wsdl on the service element.
+ This client component uses interface.java on the reference element. -->
+ <component name="StandardTypesServiceClientJ2WComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesServiceClientImpl" />
+ <reference name="standardTypesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService"/>
+ <binding.ws uri="http://localhost:8085/sts-ep-w"/>
+ </reference>
+ </component>
+
+ <!-- A StandardTypesServiceClient component that uses WS binding to invoke StandardTypesService.
+ The service component uses interface.java on the service element.
+ This client component uses interface.wsdl on the reference element. -->
+ <component name="StandardTypesServiceClientW2JComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesServiceClientImpl" />
+ <reference name="standardTypesService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org/#wsdl.interface(StandardTypesService)"/>
+ <binding.ws uri="http://localhost:8085/sts-ep-j"/>
+ </reference>
+ </component>
+
+ <!-- Components used to implement the services -->
+ <!-- A StandardTypesService component. -->
+ <component name="StandardTypesServiceJavaComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesServiceImpl"/>
+ <service name="StandardTypesService">
+ <interface.java interface="org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService"/>
+ <binding.ws uri="http://localhost:8085/sts-ep-j"/>
+ </service>
+ </component>
+
+ <!-- A StandardTypesService component. -->
+ <component name="StandardTypesServiceWSDLComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesServiceImpl"/>
+ <service name="StandardTypesService">
+ <interface.wsdl interface="http://jaxb.databindings.itest.sca.tuscany.apache.org/#wsdl.interface(StandardTypesService)"/>
+ <binding.ws uri="http://localhost:8085/sts-ep-w"/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/standard-types-service.wsdl b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/standard-types-service.wsdl
new file mode 100644
index 0000000000..5bfd1ea277
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/main/resources/wsdl/wrapped/standard-types-service.wsdl
@@ -0,0 +1,1155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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$ -->
+
+<wsdl:definitions name="StandardTypesService"
+ targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:tns="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xs:schema targetNamespace="http://jaxb.dev.java.net/array"
+ version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:complexType final="#all" name="anyTypeArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="base64BinaryArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ <xs:schema targetNamespace="http://jaxb.dev.java.net/array"
+ version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:complexType final="#all" name="dateTimeArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="durationArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:duration" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="integerArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:integer" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="anySimpleTypeArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:anySimpleType" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="QNameArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:QName" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="decimalArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:decimal" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType final="#all" name="base64BinaryArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType final="#all" name="stringArray">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="item" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://jaxb.databindings.itest.sca.tuscany.apache.org/"
+ xmlns:ns0="http://activation.javax/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getNewBigDecimalArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:decimal" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewImageArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewBigDecimal">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:decimal" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewURIArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewObjectArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDataHandler">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDateResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewBigInteger">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:integer" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDateArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewBigIntegerArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:integer" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewQNameArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:QName" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewURIResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewUUIDArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewCalendarArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewXMLGregorianCalendarArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:anySimpleType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewCalendarResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewCalendar">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewCalendarArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewImageArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewObjectResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDurationArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:duration" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element
+ name="getNewXMLGregorianCalendarArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:anySimpleType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewSource">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewObjectArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewUUIDResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewBigIntegerResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:integer" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewQNameArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:QName" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewUUIDArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewBigDecimalResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:decimal" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDateArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewURIArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDurationArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:duration" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewObject">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDataHandlerResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewQName">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:QName" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDate">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewUUID">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewXMLGregorianCalendarResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:anySimpleType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewBigIntegerArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:integer" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewSourceArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewImage">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewSourceArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewXMLGregorianCalendar">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:anySimpleType" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewQNameResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:QName" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDataHandlerArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewBigDecimalArrayResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="return" nillable="true" type="xs:decimal" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDuration">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:duration" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDataHandlerArray">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0"
+ name="arg0" nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewImageResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewSourceResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewDurationResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
+ nillable="true" type="xs:duration" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getNewURI">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
+ nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getNewBigDecimalArray">
+ <wsdl:part name="getNewBigDecimalArray"
+ element="tns:getNewBigDecimalArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewImageArrayResponse">
+
+ <wsdl:part name="getNewImageArrayResponse"
+ element="tns:getNewImageArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewBigDecimal">
+ <wsdl:part name="getNewBigDecimal"
+ element="tns:getNewBigDecimal">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewURIArray">
+ <wsdl:part name="getNewURIArray" element="tns:getNewURIArray">
+
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewObjectArray">
+ <wsdl:part name="getNewObjectArray"
+ element="tns:getNewObjectArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDataHandler">
+ <wsdl:part name="getNewDataHandler"
+ element="tns:getNewDataHandler">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDateResponse">
+ <wsdl:part name="getNewDateResponse"
+ element="tns:getNewDateResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewBigInteger">
+ <wsdl:part name="getNewBigInteger"
+ element="tns:getNewBigInteger">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDateArrayResponse">
+ <wsdl:part name="getNewDateArrayResponse"
+ element="tns:getNewDateArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewBigIntegerArray">
+ <wsdl:part name="getNewBigIntegerArray"
+ element="tns:getNewBigIntegerArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewQNameArrayResponse">
+ <wsdl:part name="getNewQNameArrayResponse"
+ element="tns:getNewQNameArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewURIResponse">
+ <wsdl:part name="getNewURIResponse"
+ element="tns:getNewURIResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewUUIDArrayResponse">
+ <wsdl:part name="getNewUUIDArrayResponse"
+ element="tns:getNewUUIDArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewCalendarArrayResponse">
+ <wsdl:part name="getNewCalendarArrayResponse"
+ element="tns:getNewCalendarArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewXMLGregorianCalendarArray">
+ <wsdl:part name="getNewXMLGregorianCalendarArray"
+ element="tns:getNewXMLGregorianCalendarArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewCalendarResponse">
+ <wsdl:part name="getNewCalendarResponse"
+ element="tns:getNewCalendarResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewCalendar">
+ <wsdl:part name="getNewCalendar" element="tns:getNewCalendar">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewCalendarArray">
+ <wsdl:part name="getNewCalendarArray"
+ element="tns:getNewCalendarArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewImageArray">
+ <wsdl:part name="getNewImageArray"
+ element="tns:getNewImageArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewObjectResponse">
+ <wsdl:part name="getNewObjectResponse"
+ element="tns:getNewObjectResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDurationArray">
+ <wsdl:part name="getNewDurationArray"
+ element="tns:getNewDurationArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewXMLGregorianCalendarArrayResponse">
+ <wsdl:part name="getNewXMLGregorianCalendarArrayResponse"
+ element="tns:getNewXMLGregorianCalendarArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewSource">
+ <wsdl:part name="getNewSource" element="tns:getNewSource">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewObjectArrayResponse">
+ <wsdl:part name="getNewObjectArrayResponse"
+ element="tns:getNewObjectArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewUUIDResponse">
+ <wsdl:part name="getNewUUIDResponse"
+ element="tns:getNewUUIDResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewBigIntegerResponse">
+ <wsdl:part name="getNewBigIntegerResponse"
+ element="tns:getNewBigIntegerResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewQNameArray">
+ <wsdl:part name="getNewQNameArray"
+ element="tns:getNewQNameArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewUUIDArray">
+ <wsdl:part name="getNewUUIDArray"
+ element="tns:getNewUUIDArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewBigDecimalResponse">
+ <wsdl:part name="getNewBigDecimalResponse"
+ element="tns:getNewBigDecimalResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDateArray">
+ <wsdl:part name="getNewDateArray"
+ element="tns:getNewDateArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewURIArrayResponse">
+ <wsdl:part name="getNewURIArrayResponse"
+ element="tns:getNewURIArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDurationArrayResponse">
+ <wsdl:part name="getNewDurationArrayResponse"
+ element="tns:getNewDurationArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewObject">
+ <wsdl:part name="getNewObject" element="tns:getNewObject">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDataHandlerResponse">
+ <wsdl:part name="getNewDataHandlerResponse"
+ element="tns:getNewDataHandlerResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewQName">
+ <wsdl:part name="getNewQName" element="tns:getNewQName">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDate">
+ <wsdl:part name="getNewDate" element="tns:getNewDate">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewUUID">
+ <wsdl:part name="getNewUUID" element="tns:getNewUUID">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewXMLGregorianCalendarResponse">
+ <wsdl:part name="getNewXMLGregorianCalendarResponse"
+ element="tns:getNewXMLGregorianCalendarResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewBigIntegerArrayResponse">
+ <wsdl:part name="getNewBigIntegerArrayResponse"
+ element="tns:getNewBigIntegerArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewSourceArray">
+ <wsdl:part name="getNewSourceArray"
+ element="tns:getNewSourceArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewImage">
+ <wsdl:part name="getNewImage" element="tns:getNewImage">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewSourceArrayResponse">
+ <wsdl:part name="getNewSourceArrayResponse"
+ element="tns:getNewSourceArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewXMLGregorianCalendar">
+ <wsdl:part name="getNewXMLGregorianCalendar"
+ element="tns:getNewXMLGregorianCalendar">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewQNameResponse">
+ <wsdl:part name="getNewQNameResponse"
+ element="tns:getNewQNameResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDataHandlerArrayResponse">
+ <wsdl:part name="getNewDataHandlerArrayResponse"
+ element="tns:getNewDataHandlerArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewBigDecimalArrayResponse">
+ <wsdl:part name="getNewBigDecimalArrayResponse"
+ element="tns:getNewBigDecimalArrayResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDuration">
+ <wsdl:part name="getNewDuration" element="tns:getNewDuration">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDataHandlerArray">
+ <wsdl:part name="getNewDataHandlerArray"
+ element="tns:getNewDataHandlerArray">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewImageResponse">
+ <wsdl:part name="getNewImageResponse"
+ element="tns:getNewImageResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewSourceResponse">
+ <wsdl:part name="getNewSourceResponse"
+ element="tns:getNewSourceResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewDurationResponse">
+ <wsdl:part name="getNewDurationResponse"
+ element="tns:getNewDurationResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getNewURI">
+ <wsdl:part name="getNewURI" element="tns:getNewURI"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="StandardTypesService">
+ <wsdl:operation name="getNewObject">
+ <wsdl:input message="tns:getNewObject"></wsdl:input>
+ <wsdl:output message="tns:getNewObjectResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewImage">
+ <wsdl:input message="tns:getNewImage"></wsdl:input>
+ <wsdl:output message="tns:getNewImageResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewSource">
+ <wsdl:input message="tns:getNewSource"></wsdl:input>
+ <wsdl:output message="tns:getNewSourceResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewBigInteger">
+ <wsdl:input message="tns:getNewBigInteger"></wsdl:input>
+ <wsdl:output message="tns:getNewBigIntegerResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewBigIntegerArray">
+ <wsdl:input message="tns:getNewBigIntegerArray">
+ </wsdl:input>
+ <wsdl:output message="tns:getNewBigIntegerArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewBigDecimal">
+ <wsdl:input message="tns:getNewBigDecimal"></wsdl:input>
+ <wsdl:output message="tns:getNewBigDecimalResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewBigDecimalArray">
+ <wsdl:input message="tns:getNewBigDecimalArray">
+ </wsdl:input>
+ <wsdl:output message="tns:getNewBigDecimalArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewCalendar">
+ <wsdl:input message="tns:getNewCalendar"></wsdl:input>
+ <wsdl:output message="tns:getNewCalendarResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewCalendarArray">
+ <wsdl:input message="tns:getNewCalendarArray"></wsdl:input>
+ <wsdl:output message="tns:getNewCalendarArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDate">
+ <wsdl:input message="tns:getNewDate"></wsdl:input>
+ <wsdl:output message="tns:getNewDateResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDateArray">
+ <wsdl:input message="tns:getNewDateArray"></wsdl:input>
+ <wsdl:output message="tns:getNewDateArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewQName">
+ <wsdl:input message="tns:getNewQName"></wsdl:input>
+ <wsdl:output message="tns:getNewQNameResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewQNameArray">
+ <wsdl:input message="tns:getNewQNameArray"></wsdl:input>
+ <wsdl:output message="tns:getNewQNameArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewURI">
+ <wsdl:input message="tns:getNewURI"></wsdl:input>
+ <wsdl:output message="tns:getNewURIResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewURIArray">
+ <wsdl:input message="tns:getNewURIArray"></wsdl:input>
+ <wsdl:output message="tns:getNewURIArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewXMLGregorianCalendar">
+ <wsdl:input message="tns:getNewXMLGregorianCalendar">
+ </wsdl:input>
+ <wsdl:output
+ message="tns:getNewXMLGregorianCalendarResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewXMLGregorianCalendarArray">
+ <wsdl:input message="tns:getNewXMLGregorianCalendarArray">
+ </wsdl:input>
+ <wsdl:output
+ message="tns:getNewXMLGregorianCalendarArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDuration">
+ <wsdl:input message="tns:getNewDuration"></wsdl:input>
+ <wsdl:output message="tns:getNewDurationResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDurationArray">
+ <wsdl:input message="tns:getNewDurationArray"></wsdl:input>
+ <wsdl:output message="tns:getNewDurationArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewObjectArray">
+ <wsdl:input message="tns:getNewObjectArray"></wsdl:input>
+ <wsdl:output message="tns:getNewObjectArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewImageArray">
+ <wsdl:input message="tns:getNewImageArray"></wsdl:input>
+ <wsdl:output message="tns:getNewImageArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDataHandler">
+ <wsdl:input message="tns:getNewDataHandler"></wsdl:input>
+ <wsdl:output message="tns:getNewDataHandlerResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDataHandlerArray">
+ <wsdl:input message="tns:getNewDataHandlerArray">
+ </wsdl:input>
+ <wsdl:output message="tns:getNewDataHandlerArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewSourceArray">
+ <wsdl:input message="tns:getNewSourceArray"></wsdl:input>
+ <wsdl:output message="tns:getNewSourceArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewUUID">
+ <wsdl:input message="tns:getNewUUID"></wsdl:input>
+ <wsdl:output message="tns:getNewUUIDResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewUUIDArray">
+ <wsdl:input message="tns:getNewUUIDArray"></wsdl:input>
+ <wsdl:output message="tns:getNewUUIDArrayResponse">
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:portType>
+ <wsdl:binding name="StandardTypesServiceBinding"
+ type="tns:StandardTypesService">
+ <soap11:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getNewObject">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewImage">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewSource">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewBigInteger">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewBigIntegerArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewBigDecimal">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewBigDecimalArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewCalendar">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewCalendarArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDate">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDateArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewQName">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewQNameArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewURI">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewURIArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewXMLGregorianCalendar">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewXMLGregorianCalendarArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDuration">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDurationArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewObjectArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewImageArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDataHandler">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewDataHandlerArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewSourceArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewUUID">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getNewUUIDArray">
+ <soap11:operation />
+ <wsdl:input>
+ <soap11:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap11:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="StandardTypesServiceService">
+ <wsdl:port name="StandardTypesServicePort"
+ binding="tns:StandardTypesServiceBinding">
+ <soap11:address location="http://localhost:8085/sts-ep"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/DatabindingTestCase.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/DatabindingTestCase.java
new file mode 100644
index 0000000000..37a521b1bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/DatabindingTestCase.java
@@ -0,0 +1,342 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb.topdown;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceClient;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DatabindingTestCase {
+
+ private static SCAClient client;
+ private static SCANode node;
+
+ /**
+ * Runs once before running the tests
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANodeFromClassLoader("wsdl/wrapped/helloservice.composite", null);
+ node.start();
+ client = (SCAClient)node;
+ }
+
+ /**
+ * Runs once after running the tests
+ */
+ @AfterClass
+ public static void tearDown() {
+ node.stop();
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetings.
+ */
+ @Test
+ public void testW2W() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2WComponent");
+ performTest(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsArray.
+ */
+ @Test
+ public void testW2WArray() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2WComponent");
+ performTestArray(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsList.
+ */
+ @Test
+ public void testW2WList() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2WComponent");
+ performTestList(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsArrayList.
+ */
+ @Test
+ public void testW2WArrayList() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2WComponent");
+ performTestArrayList(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsMap.
+ */
+ @Test
+ public void testW2WMap() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2WComponent");
+ performTestMap(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsHashMap.
+ */
+ @Test
+ public void testW2WHashMap() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2WComponent");
+ performTestHashMap(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsVarArgs.
+ */
+ @Test
+ public void testW2WVarArgs() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2WComponent");
+ performTestVarArgs(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetings.
+ */
+ @Test
+ public void testJ2W() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientJ2WComponent");
+ performTest(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsArray.
+ */
+ @Test
+ public void testJ2WArray() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientJ2WComponent");
+ performTestArray(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsList.
+ */
+ @Test
+ public void testJ2WList() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientJ2WComponent");
+ performTestList(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsArrayList.
+ */
+ @Test
+ public void testJ2WArrayList() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientJ2WComponent");
+ performTestArrayList(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsMap.
+ */
+ @Test
+ public void testJ2WMap() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientJ2WComponent");
+ performTestMap(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsHashMap.
+ */
+ @Test
+ public void testJ2WHashMap() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientJ2WComponent");
+ performTestHashMap(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsVarArgs.
+ */
+ @Test
+ public void testJ2WVarArgs() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientJ2WComponent");
+ performTestVarArgs(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetings.
+ */
+ @Test
+ public void testW2J() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2JComponent");
+ performTest(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsArray.
+ */
+ @Test
+ public void testW2JArray() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2JComponent");
+ performTestArray(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsList.
+ */
+ @Test
+ public void testW2JList() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2JComponent");
+ performTestList(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsArrayList.
+ */
+ @Test
+ public void testW2JArrayList() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2JComponent");
+ performTestArrayList(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsMap.
+ */
+ @Test
+ public void testW2JMap() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2JComponent");
+ performTestMap(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsHashMap.
+ */
+ @Test
+ public void testW2JHashMap() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2JComponent");
+ performTestHashMap(helloServiceClient);
+ }
+
+ /**
+ * Invokes the HelloService service using WS binding.
+ * Service method invoked is getGreetingsVarArgs.
+ */
+ @Test
+ public void testW2JVarArgs() throws Exception {
+ HelloServiceClient helloServiceClient = client.getService(HelloServiceClient.class, "HelloServiceClientW2JComponent");
+ performTestVarArgs(helloServiceClient);
+ }
+
+ private void performTest(HelloServiceClient helloServiceClient) {
+ String name = "Pandu";
+ String resp = helloServiceClient.getGreetingsForward(name);
+ Assert.assertEquals("Hello "+name, resp);
+ }
+
+ private void performTestArray(HelloServiceClient helloServiceClient) {
+ String[] names = {"Me", "Pandu"};
+ String[] resps = helloServiceClient.getGreetingsArrayForward(names);
+ for(int i = 0; i < names.length; ++i) {
+ Assert.assertEquals("Hello "+names[i], resps[i]);
+ }
+ }
+
+ private void performTestList(HelloServiceClient helloServiceClient) {
+ List<String> namesList = new ArrayList<String>();
+ namesList.add("Me");
+ namesList.add("Pandu");
+ namesList.add("Chinnipandu");
+ List<String> respList = helloServiceClient.getGreetingsListForward(namesList);
+ Assert.assertEquals(namesList.size(), respList.size());
+ for(int i = 0; i < namesList.size(); ++i) {
+ Assert.assertEquals("Hello "+namesList.get(i), respList.get(i));
+ }
+ }
+
+ private void performTestArrayList(HelloServiceClient helloServiceClient) {
+ ArrayList<String> namesList = new ArrayList<String>();
+ namesList.add("Me");
+ namesList.add("Pandu");
+ namesList.add("Chinnipandu");
+ ArrayList<String> respList = helloServiceClient.getGreetingsArrayListForward(namesList);
+ Assert.assertEquals(namesList.size(), respList.size());
+ for(int i = 0; i < namesList.size(); ++i) {
+ Assert.assertEquals("Hello "+namesList.get(i), respList.get(i));
+ }
+ }
+
+ private void performTestMap(HelloServiceClient helloServiceClient) {
+ Map<String, String> namesMap = new HashMap<String, String>();
+ namesMap.put("Me", null);
+ namesMap.put("Pandu", null);
+ namesMap.put("Chinnipandu", null);
+ Map<String, String> respMap = helloServiceClient.getGreetingsMapForward(namesMap);
+ Assert.assertEquals(namesMap.keySet().size(), respMap.keySet().size());
+ for(Map.Entry<String, String> entry: namesMap.entrySet()) {
+ Assert.assertEquals("Hello "+entry.getKey(), respMap.get(entry.getKey()));
+ }
+ }
+
+ private void performTestHashMap(HelloServiceClient helloServiceClient) {
+ HashMap<String, String> namesMap = new HashMap<String, String>();
+ namesMap.put("Me", null);
+ namesMap.put("Pandu", null);
+ namesMap.put("Chinnipandu", null);
+ Map<String, String> respMap = helloServiceClient.getGreetingsHashMapForward(namesMap);
+ Assert.assertEquals(namesMap.keySet().size(), respMap.keySet().size());
+ for(Map.Entry<String, String> entry: namesMap.entrySet()) {
+ Assert.assertEquals("Hello "+entry.getKey(), respMap.get(entry.getKey()));
+ }
+ }
+
+ private void performTestVarArgs(HelloServiceClient helloServiceClient) {
+ String[] names = { "Me", "You", "Pandu" }; // Do not change the array size from 3.
+ String expected = "Hello Me You Pandu";
+ String actual = helloServiceClient.getGreetingsVarArgsForward(names[0], names[1], names[2]);
+ Assert.assertEquals(expected, actual);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/PrimitivesDatabindingTestCase.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/PrimitivesDatabindingTestCase.java
new file mode 100644
index 0000000000..65b8a5abc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/PrimitivesDatabindingTestCase.java
@@ -0,0 +1,848 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb.topdown;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesServiceClient;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PrimitivesDatabindingTestCase {
+
+ private static SCAClient domain;
+ private static SCANode node;
+
+ /**
+ * Runs before each test method
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANodeFromClassLoader("wsdl/wrapped/primitivesservice.composite", null);
+ node.start();
+ domain = (SCAClient)node;
+ }
+
+ /**
+ * Runs after each test method
+ */
+ @AfterClass
+ public static void tearDown() {
+ node.stop();
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateBoolean.
+ */
+ @Test
+ public void testW2WNegateBoolean() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateBoolean(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateBooleanArray.
+ */
+ @Test
+ public void testW2WNegateBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateBooleanArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for boolean array.
+ */
+ @Test
+ public void testW2WPassByValueBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueBooleanArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateByte.
+ */
+ @Test
+ public void testW2WNegateByte() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateByte(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateByteArray.
+ */
+ @Test
+ public void testW2WNegateByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateByteArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for byte array.
+ */
+ @Test
+ public void testW2WPassByValueByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueByteArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateShort.
+ */
+ @Test
+ public void testW2WNegateShort() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateShort(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateShortArray.
+ */
+ @Test
+ public void testW2WNegateShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateShortArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for short array.
+ */
+ @Test
+ public void testW2WPassByValueShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueShortArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateInt.
+ */
+ @Test
+ public void testW2WNegateInt() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateInt(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateIntArray.
+ */
+ @Test
+ public void testW2WNegateIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateIntArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for int array.
+ */
+ @Test
+ public void testW2WPassByValueIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueIntArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateLong.
+ */
+ @Test
+ public void testW2WNegateLong() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateLong(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateLongArray.
+ */
+ @Test
+ public void testW2WNegateLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateLongArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for long array.
+ */
+ @Test
+ public void testW2WPassByValueLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueLongArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateFloat.
+ */
+ @Test
+ public void testW2WNegateFloat() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateFloat(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateFloatArray.
+ */
+ @Test
+ public void testW2WNegateFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateFloatArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for float array.
+ */
+ @Test
+ public void testW2WPassByValueFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueFloatArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateDouble.
+ */
+ @Test
+ public void testW2WNegateDouble() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateDouble(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateDoubleArray.
+ */
+ @Test
+ public void testW2WNegateDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ performTestNegateDoubleArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for double array.
+ */
+ @Test
+ public void testW2WPassByValueDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueDoubleArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateBoolean.
+ */
+ @Test
+ public void testJ2WNegateBoolean() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateBoolean(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateBooleanArray.
+ */
+ @Test
+ public void testJ2WNegateBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateBooleanArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for boolean array.
+ */
+ @Test
+ public void testJ2WPassByValueBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueBooleanArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateByte.
+ */
+ @Test
+ public void testJ2WNegateByte() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateByte(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateByteArray.
+ */
+ @Test
+ public void testJ2WNegateByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateByteArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for byte array.
+ */
+ @Test
+ public void testJ2WPassByValueByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueByteArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateShort.
+ */
+ @Test
+ public void testJ2WNegateShort() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateShort(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateShortArray.
+ */
+ @Test
+ public void testJ2WNegateShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateShortArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for short array.
+ */
+ @Test
+ public void testJ2WPassByValueShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueShortArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateInt.
+ */
+ @Test
+ public void testJ2WNegateInt() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateInt(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateIntArray.
+ */
+ @Test
+ public void testJ2WNegateIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateIntArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for int array.
+ */
+ @Test
+ public void testJ2WPassByValueIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueIntArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateLong.
+ */
+ @Test
+ public void testJ2WNegateLong() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateLong(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateLongArray.
+ */
+ @Test
+ public void testJ2WNegateLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateLongArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for long array.
+ */
+ @Test
+ public void testJ2WPassByValueLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueLongArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateFloat.
+ */
+ @Test
+ public void testJ2WNegateFloat() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateFloat(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateFloatArray.
+ */
+ @Test
+ public void testJ2WNegateFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateFloatArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for float array.
+ */
+ @Test
+ public void testJ2WPassByValueFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueFloatArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateDouble.
+ */
+ @Test
+ public void testJ2WNegateDouble() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateDouble(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateDoubleArray.
+ */
+ @Test
+ public void testJ2WNegateDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ performTestNegateDoubleArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for double array.
+ */
+ @Test
+ public void testJ2WPassByValueDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientJ2WComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueDoubleArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateBoolean.
+ */
+ @Test
+ public void testW2JNegateBoolean() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateBoolean(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateBooleanArray.
+ */
+ @Test
+ public void testW2JNegateBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateBooleanArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for boolean array.
+ */
+ @Test
+ public void testW2JPassByValueBooleanArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueBooleanArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateByte.
+ */
+ @Test
+ public void testW2JNegateByte() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateByte(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateByteArray.
+ */
+ @Test
+ public void testW2JNegateByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateByteArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for byte array.
+ */
+ @Test
+ public void testW2JPassByValueByteArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueByteArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateShort.
+ */
+ @Test
+ public void testW2JNegateShort() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateShort(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateShortArray.
+ */
+ @Test
+ public void testW2JNegateShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateShortArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for short array.
+ */
+ @Test
+ public void testW2JPassByValueShortArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueShortArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateInt.
+ */
+ @Test
+ public void testW2JNegateInt() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateInt(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateIntArray.
+ */
+ @Test
+ public void testW2JNegateIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateIntArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for int array.
+ */
+ @Test
+ public void testW2JPassByValueIntArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueIntArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateLong.
+ */
+ @Test
+ public void testW2JNegateLong() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateLong(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateLongArray.
+ */
+ @Test
+ public void testW2JNegateLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateLongArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for long array.
+ */
+ @Test
+ public void testW2JPassByValueLongArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueLongArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateFloat.
+ */
+ @Test
+ public void testW2JNegateFloat() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateFloat(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateFloatArray.
+ */
+ @Test
+ public void testW2JNegateFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateFloatArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for float array.
+ */
+ @Test
+ public void testW2JPassByValueFloatArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueFloatArray());
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateDouble.
+ */
+ @Test
+ public void testW2JNegateDouble() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateDouble(primitivesServiceClient);
+ }
+
+ /**
+ * Invokes the PrimitivesService service using WS binding.
+ * Service method invoked is negateDoubleArray.
+ */
+ @Test
+ public void testW2JNegateDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ performTestNegateDoubleArray(primitivesServiceClient);
+ }
+
+ /**
+ * Test the pass-by-value semantics of a remotable service with WS binding.
+ * Test for double array.
+ */
+ @Test
+ public void testW2JPassByValueDoubleArray() throws Exception {
+ PrimitivesServiceClient primitivesServiceClient = domain.getService(PrimitivesServiceClient.class, "PrimitivesServiceClientW2JComponent");
+ Assert.assertTrue(primitivesServiceClient.passByValueDoubleArray());
+ }
+
+ private void performTestNegateBoolean(PrimitivesServiceClient primitivesServiceClient) {
+ Assert.assertTrue(primitivesServiceClient.negateBooleanForward(false));
+ Assert.assertFalse(primitivesServiceClient.negateBooleanForward(true));
+ }
+
+ private void performTestNegateBooleanArray(PrimitivesServiceClient primitivesServiceClient) {
+ boolean flags[] = new boolean[2];
+ flags[0] = false;
+ flags[1] = true;
+ boolean[] respFlags = primitivesServiceClient.negateBooleanArrayForward(flags);
+ Assert.assertEquals(flags.length, respFlags.length);
+ for(int i = 0; i < flags.length; ++i) {
+ Assert.assertEquals(!flags[i], respFlags[i]);
+ }
+ }
+
+ private void performTestNegateByte(PrimitivesServiceClient primitivesServiceClient) {
+ byte[] ba = new byte[3];
+ ba[0] = -1;
+ ba[1] = 0;
+ ba[2] = 1;
+
+ for(int i = 0; i < ba.length; ++i) {
+ Assert.assertEquals((byte)-ba[i], primitivesServiceClient.negateByteForward(ba[i]));
+ }
+ }
+
+ private void performTestNegateByteArray(PrimitivesServiceClient primitivesServiceClient) {
+ byte[] ba = new byte[3];
+ ba[0] = -1;
+ ba[1] = 0;
+ ba[2] = 1;
+
+ byte[] r = primitivesServiceClient.negateByteArrayForward(ba);
+ Assert.assertEquals(ba.length, r.length);
+ for(int i = 0; i < ba.length; ++i) {
+ Assert.assertEquals((byte)-ba[i], r[i]);
+ }
+ }
+
+ private void performTestNegateShort(PrimitivesServiceClient primitivesServiceClient) {
+ short[] s = new short[3];
+ s[0] = -1;
+ s[1] = 0;
+ s[2] = 1;
+
+ for(int i = 0; i < s.length; ++i) {
+ Assert.assertEquals((short)-s[i], primitivesServiceClient.negateShortForward(s[i]));
+ }
+ }
+
+ private void performTestNegateShortArray(PrimitivesServiceClient primitivesServiceClient) {
+ short[] s = new short[3];
+ s[0] = -1;
+ s[1] = 0;
+ s[2] = 1;
+
+ short[] r = primitivesServiceClient.negateShortArrayForward(s);
+ Assert.assertEquals(s.length, r.length);
+ for(int i = 0; i < s.length; ++i) {
+ Assert.assertEquals((short)-s[i], r[i]);
+ }
+ }
+
+ private void performTestNegateInt(PrimitivesServiceClient primitivesServiceClient) {
+ int[] ia = new int[3];
+ ia[0] = -1;
+ ia[1] = 0;
+ ia[2] = 1;
+
+ for(int i = 0; i < ia.length; ++i) {
+ Assert.assertEquals(-ia[i], primitivesServiceClient.negateIntForward(ia[i]));
+ }
+ }
+
+ private void performTestNegateIntArray(PrimitivesServiceClient primitivesServiceClient) {
+ int[] ia = new int[3];
+ ia[0] = -1;
+ ia[1] = 0;
+ ia[2] = 1;
+
+ int[] r = primitivesServiceClient.negateIntArrayForward(ia);
+ Assert.assertEquals(ia.length, r.length);
+ for(int i = 0; i < ia.length; ++i) {
+ Assert.assertEquals(-ia[i], r[i]);
+ }
+ }
+
+ private void performTestNegateLong(PrimitivesServiceClient primitivesServiceClient) {
+ long[] la = new long[3];
+ la[0] = -1;
+ la[1] = 0;
+ la[2] = 1;
+
+ for(int i = 0; i < la.length; ++i) {
+ Assert.assertEquals(-la[i], primitivesServiceClient.negateLongForward(la[i]));
+ }
+ }
+
+ private void performTestNegateLongArray(PrimitivesServiceClient primitivesServiceClient) {
+ long[] la = new long[3];
+ la[0] = -1;
+ la[1] = 0;
+ la[2] = 1;
+
+ long[] r = primitivesServiceClient.negateLongArrayForward(la);
+ Assert.assertEquals(la.length, r.length);
+ for(int i = 0; i < la.length; ++i) {
+ Assert.assertEquals(-la[i], r[i]);
+ }
+ }
+
+ private void performTestNegateFloat(PrimitivesServiceClient primitivesServiceClient) {
+ float[] fa = new float[3];
+ fa[0] = -1;
+ fa[1] = 0;
+ fa[2] = 1;
+
+ for(int i = 0; i < fa.length; ++i) {
+ Assert.assertEquals(-fa[i], primitivesServiceClient.negateFloatForward(fa[i]));
+ }
+ }
+
+ private void performTestNegateFloatArray(PrimitivesServiceClient primitivesServiceClient) {
+ float[] ia = new float[3];
+ ia[0] = -1;
+ ia[1] = 0;
+ ia[2] = 1;
+
+ float[] r = primitivesServiceClient.negateFloatArrayForward(ia);
+ Assert.assertEquals(ia.length, r.length);
+ for(int i = 0; i < ia.length; ++i) {
+ Assert.assertEquals(-ia[i], r[i]);
+ }
+ }
+
+ private void performTestNegateDouble(PrimitivesServiceClient primitivesServiceClient) {
+ double[] da = new double[3];
+ da[0] = -1;
+ da[1] = 0;
+ da[2] = 1;
+
+ for(int i = 0; i < da.length; ++i) {
+ Assert.assertEquals(-da[i], primitivesServiceClient.negateDoubleForward(da[i]));
+ }
+ }
+
+ private void performTestNegateDoubleArray(PrimitivesServiceClient primitivesServiceClient) {
+ double[] da = new double[3];
+ da[0] = -1;
+ da[1] = 0;
+ da[2] = 1;
+
+ double[] r = primitivesServiceClient.negateDoubleArrayForward(da);
+ Assert.assertEquals(da.length, r.length);
+ for(int i = 0; i < da.length; ++i) {
+ Assert.assertEquals(-da[i], r[i]);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/StandardTypesDatabindingTestCase.java b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/StandardTypesDatabindingTestCase.java
new file mode 100644
index 0000000000..dc49f0f407
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/StandardTypesDatabindingTestCase.java
@@ -0,0 +1,1450 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.databindings.jaxb.topdown;
+
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.awt.image.PixelGrabber;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.Assert;
+
+import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.tuscany.sca.databinding.xml.String2Node;
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesServiceClient;
+import org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesTransformer;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.xml.sax.InputSource;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StandardTypesDatabindingTestCase {
+
+ private static SCAClient domain;
+ private static SCANode node;
+
+ /**
+ * Runs once before the tests
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANodeFromClassLoader("wsdl/wrapped/standard-types-service.composite", null);
+ node.start();
+ domain = (SCAClient)node;
+ }
+
+ /**
+ * Runs once after the tests
+ */
+ @AfterClass
+ public static void tearDown() {
+ node.stop();
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigInteger.
+ */
+ @Test
+ public void testW2WNewBigInteger() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewBigInteger(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigIntegerArray.
+ */
+ @Test
+ public void testW2WNewBigIntegerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewBigIntegerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigDecimal.
+ */
+ @Test
+ public void testW2WNewBigDecimal() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewBigDecimal(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigDecimalArray.
+ */
+ @Test
+ public void testW2WNewBigDecimalArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewBigDecimalArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewCalendar.
+ */
+ @Test
+ public void testW2WNewCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewCalendarArray.
+ */
+ @Test
+ public void testW2WNewCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDate.
+ */
+ @Test
+ public void testW2WNewDate() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewDate(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDateArray.
+ */
+ @Test
+ public void testW2WNewDateArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewDateArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewQName.
+ */
+ @Test
+ public void testW2WNewQName() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewQName(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewQNameArray.
+ */
+ @Test
+ public void testW2WNewQNameArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewQNameArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewURI.
+ */
+ @Test
+ public void testW2WNewURI() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewURI(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewURIArray.
+ */
+ @Test
+ public void testW2WNewURIArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewURIArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewXMLGregorianCalendar.
+ */
+ @Test
+ public void testW2WNewXMLGregorianCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewXMLGregorianCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewXMLGregorianCalendarArray.
+ */
+ @Test
+ public void testW2WNewXMLGregorianCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewXMLGregorianCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDuration.
+ */
+ @Test
+ public void testW2WNewDuration() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewDuration(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDurationArray.
+ */
+ @Test
+ public void testW2WNewDurationArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewDurationArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewObject.
+ */
+ @Test
+ public void testW2WNewObject() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewObject(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewObjectArray.
+ */
+ @Test
+ public void testW2WNewObjectArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewObjectArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewImage.
+ */
+ @Test
+ public void testW2WNewImage() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewImage(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewImageArray.
+ */
+ @Test
+ public void testW2WNewImageArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewImageArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDataHandler.
+ */
+ @Test
+ @Ignore("TUSCANY-2451")
+ public void testW2WNewDataHandler() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewDataHandler(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDataHandlerArray.
+ */
+ @Test
+ @Ignore("TUSCANY-2451")
+ public void testW2WNewDataHandlerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewDataHandlerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewSource.
+ */
+ @Test
+ //@Ignore("junit.framework.ComparisonFailure: null expected:<... encoding=\"UTF-8\"?><[a>A</a]>> but was:<... encoding=\"UTF-8\"?><[return xmlns=\"http://jaxb.databindings.itest.sca.tuscany.apache.org/\">A</return]>>")
+ public void testW2WNewSource() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewSource(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewSourceArray.
+ */
+ @Test
+ @Ignore("TUSCANY-2452")
+ public void testW2WNewSourceArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewSourceArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewUUID.
+ */
+ @Test
+ public void testW2WNewUUID() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewUUID(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewUUIDArray.
+ */
+ @Test
+ public void testW2WNewUUIDArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2WComponent");
+ performTestNewUUIDArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigInteger.
+ */
+ @Test
+ public void testJ2WNewBigInteger() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewBigInteger(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigIntegerArray.
+ */
+ @Test
+ public void testJ2WNewBigIntegerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewBigIntegerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigDecimal.
+ */
+ @Test
+ public void testJ2WNewBigDecimal() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewBigDecimal(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigDecimalArray.
+ */
+ @Test
+ public void testJ2WNewBigDecimalArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewBigDecimalArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewCalendar.
+ */
+ @Test
+ public void testJ2WNewCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewCalendarArray.
+ */
+ @Test
+ public void testJ2WNewCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDate.
+ */
+ @Test
+ public void testJ2WNewDate() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewDate(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDateArray.
+ */
+ @Test
+ public void testJ2WNewDateArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewDateArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewQName.
+ */
+ @Test
+ public void testJ2WNewQName() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewQName(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewQNameArray.
+ */
+ @Test
+ public void testJ2WNewQNameArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewQNameArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewURI.
+ */
+ @Test
+ public void testJ2WNewURI() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewURI(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewURIArray.
+ */
+ @Test
+ public void testJ2WNewURIArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewURIArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewXMLGregorianCalendar.
+ */
+ @Test
+ public void testJ2WNewXMLGregorianCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewXMLGregorianCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewXMLGregorianCalendarArray.
+ */
+ @Test
+ public void testJ2WNewXMLGregorianCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewXMLGregorianCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDuration.
+ */
+ @Test
+ public void testJ2WNewDuration() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewDuration(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDurationArray.
+ */
+ @Test
+ public void testJ2WNewDurationArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewDurationArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewObject.
+ */
+ @Test
+ public void testJ2WNewObject() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewObject(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewObjectArray.
+ */
+ @Test
+ public void testJ2WNewObjectArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewObjectArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewImage.
+ */
+ @Test
+ public void testJ2WNewImage() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewImage(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewImageArray.
+ */
+ @Test
+ public void testJ2WNewImageArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewImageArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDataHandler.
+ */
+ @Test
+ @Ignore("TUSCANY-2451")
+ public void testJ2WNewDataHandler() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewDataHandler(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDataHandlerArray.
+ */
+ @Test
+ @Ignore("TUSCANY-2451")
+ public void testJ2WNewDataHandlerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewDataHandlerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewSource.
+ */
+ @Test
+ //@Ignore("junit.framework.ComparisonFailure: null expected:<... encoding=\"UTF-8\"?><[a>A</a]>> but was:<... encoding=\"UTF-8\"?><[return xmlns=\"http://jaxb.databindings.itest.sca.tuscany.apache.org/\">A</return]>>")
+ public void testJ2WNewSource() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewSource(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewSourceArray.
+ */
+ @Test
+ @Ignore("TUSCANY-2452")
+ public void testJ2WNewSourceArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewSourceArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewUUID.
+ */
+ @Test
+ public void testJ2WNewUUID() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewUUID(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewUUIDArray.
+ */
+ @Test
+ public void testJ2WNewUUIDArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientJ2WComponent");
+ performTestNewUUIDArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigInteger.
+ */
+ @Test
+ public void testW2JNewBigInteger() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewBigInteger(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigIntegerArray.
+ */
+ @Test
+ public void testW2JNewBigIntegerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewBigIntegerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigDecimal.
+ */
+ @Test
+ public void testW2JNewBigDecimal() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewBigDecimal(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewBigDecimalArray.
+ */
+ @Test
+ public void testW2JNewBigDecimalArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewBigDecimalArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewCalendar.
+ */
+ @Test
+ public void testW2JNewCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewCalendarArray.
+ */
+ @Test
+ public void testW2JNewCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDate.
+ */
+ @Test
+ public void testW2JNewDate() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewDate(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDateArray.
+ */
+ @Test
+ public void testW2JNewDateArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewDateArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewQName.
+ */
+ @Test
+ public void testW2JNewQName() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewQName(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewQNameArray.
+ */
+ @Test
+ public void testW2JNewQNameArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewQNameArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewURI.
+ */
+ @Test
+ public void testW2JNewURI() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewURI(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewURIArray.
+ */
+ @Test
+ public void testW2JNewURIArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewURIArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewXMLGregorianCalendar.
+ */
+ @Test
+ public void testW2JNewXMLGregorianCalendar() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewXMLGregorianCalendar(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewXMLGregorianCalendarArray.
+ */
+ @Test
+ public void testW2JNewXMLGregorianCalendarArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewXMLGregorianCalendarArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDuration.
+ */
+ @Test
+ public void testW2JNewDuration() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewDuration(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDurationArray.
+ */
+ @Test
+ public void testW2JNewDurationArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewDurationArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewObject.
+ */
+ @Test
+ public void testW2JNewObject() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewObject(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewObjectArray.
+ */
+ @Test
+ public void testW2JNewObjectArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewObjectArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewImage.
+ */
+ @Test
+ public void testW2JNewImage() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewImage(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewImageArray.
+ */
+ @Test
+ public void testW2JNewImageArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewImageArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDataHandler.
+ */
+ @Test
+ @Ignore("TUSCANY-2451")
+ public void testW2JNewDataHandler() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewDataHandler(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewDataHandlerArray.
+ */
+ @Test
+ @Ignore("TUSCANY-2451")
+ public void testW2JNewDataHandlerArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewDataHandlerArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewSource.
+ */
+ @Test
+ //@Ignore("junit.framework.ComparisonFailure: null expected:<... encoding=\"UTF-8\"?><[a>A</a]>> but was:<... encoding=\"UTF-8\"?><[return xmlns=\"http://jaxb.databindings.itest.sca.tuscany.apache.org/\">A</return]>>")
+ public void testW2JNewSource() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewSource(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewSourceArray.
+ */
+ @Test
+ @Ignore("TUSCANY-2452")
+ public void testW2JNewSourceArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewSourceArray(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewUUID.
+ */
+ @Test
+ public void testW2JNewUUID() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewUUID(serviceClient);
+ }
+
+ /**
+ * Invokes the StandardTypesService service using WS binding.
+ * Service method invoked is getNewUUIDArray.
+ */
+ @Test
+ public void testW2JNewUUIDArray() throws Exception {
+ StandardTypesServiceClient serviceClient =
+ domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientW2JComponent");
+ performTestNewUUIDArray(serviceClient);
+ }
+
+ private void performTestNewBigInteger(StandardTypesServiceClient serviceClient) {
+ BigInteger bi = new BigInteger("1234567890123456789012345678901234");
+ BigInteger expected = bi.negate();
+ BigInteger actual = serviceClient.getNewBigIntegerForward(bi);
+ Assert.assertEquals(expected, actual);
+ }
+
+ private void performTestNewBigIntegerArray(StandardTypesServiceClient serviceClient) {
+ BigInteger[] bia = new BigInteger[2];
+ bia[0] = new BigInteger("1234567890123456789012345678901234");
+ bia[1] = new BigInteger("-98765432109876543210987654321");
+ BigInteger[] actual = serviceClient.getNewBigIntegerArrayForward(bia);
+ Assert.assertEquals(bia.length, actual.length);
+ for (int i = 0; i < bia.length; ++i) {
+ Assert.assertEquals(bia[i].negate(), actual[i]);
+ }
+ }
+
+ private void performTestNewBigDecimal(StandardTypesServiceClient serviceClient) {
+ BigDecimal bd = new BigDecimal("12345678901234567890.12345678901234");
+ BigDecimal expected = bd.negate();
+ BigDecimal actual = serviceClient.getNewBigDecimalForward(bd);
+ Assert.assertEquals(expected, actual);
+ }
+
+ private void performTestNewBigDecimalArray(StandardTypesServiceClient serviceClient) {
+ BigDecimal[] bda = new BigDecimal[2];
+ bda[0] = new BigDecimal("1234567890123456.789012345678901234");
+ bda[1] = new BigDecimal("-987654321098765.43210987654321");
+ BigDecimal[] actual = serviceClient.getNewBigDecimalArrayForward(bda);
+ Assert.assertEquals(bda.length, actual.length);
+ for (int i = 0; i < bda.length; ++i) {
+ Assert.assertEquals(bda[i].negate(), actual[i]);
+ }
+ }
+
+ private void performTestNewCalendar(StandardTypesServiceClient serviceClient) {
+ Calendar[] ca = new Calendar[3];
+ String[] tz = {"GMT+05:30", "GMT+00:00", "GMT-05:00"};
+ for (int i = 0; i < ca.length; ++i) {
+ ca[i] = Calendar.getInstance(TimeZone.getTimeZone(tz[i]));
+ ca[i].set(Calendar.DAY_OF_MONTH, i + 1);
+ }
+ for (int i = 0; i < ca.length; ++i) {
+ Calendar actual = serviceClient.getNewCalendarForward(ca[i]);
+ ca[i].add(Calendar.DAY_OF_MONTH, 5);
+ if (actual instanceof GregorianCalendar && ca[i] instanceof GregorianCalendar) {
+ // FIXME: Is this a problem?
+ // The instance returned by service method invoked over binding.ws seems to have a gregorianCutover
+ // different from the instance passed. Adjust the gregorianCutover as per the input instance.
+ ((GregorianCalendar)actual).setGregorianChange(((GregorianCalendar)ca[i]).getGregorianChange());
+ }
+ Assert.assertEquals(ca[i], actual);
+ }
+ }
+
+ private void performTestNewCalendarArray(StandardTypesServiceClient serviceClient) {
+ Calendar[] ca = new Calendar[3];
+ String[] tz = {"GMT+05:30", "GMT+00:00", "GMT-05:00"};
+ for (int i = 0; i < ca.length; ++i) {
+ ca[i] = Calendar.getInstance(TimeZone.getTimeZone(tz[i]));
+ ca[i].set(Calendar.DAY_OF_MONTH, i + 1);
+ }
+ Calendar[] actual = serviceClient.getNewCalendarArrayForward(ca);
+ Assert.assertEquals(ca.length, actual.length);
+ for (int i = 0; i < ca.length; ++i) {
+ ca[i].add(Calendar.DAY_OF_MONTH, 5);
+ if (actual[i] instanceof GregorianCalendar && ca[i] instanceof GregorianCalendar) {
+ // FIXME: Is this a problem?
+ // The instance returned by service method invoked over binding.ws seems to have a gregorianCutover
+ // different from the instance passed. Adjust the gregorianCutover as per the input instance.
+ ((GregorianCalendar)actual[i]).setGregorianChange(((GregorianCalendar)ca[i]).getGregorianChange());
+ }
+ Assert.assertEquals(ca[i], actual[i]);
+ }
+ }
+
+ private void performTestNewDate(StandardTypesServiceClient serviceClient) {
+ Date d = new Date();
+ Date expected = new Date(d.getTime() + 5 * 24 * 60 * 60 * 1000);
+ Date actual = serviceClient.getNewDateForward(d);
+ Assert.assertEquals(expected, actual);
+ }
+
+ private void performTestNewDateArray(StandardTypesServiceClient serviceClient) {
+ Date[] d = new Date[2];
+ Date[] expected = new Date[d.length];
+ for (int i = 0; i < d.length; ++i) {
+ d[i] = new Date();
+ d[i].setTime(d[i].getTime() + i * 24 * 60 * 60 * 1000);
+ expected[i] = new Date(d[i].getTime() + 5 * 24 * 60 * 60 * 1000);
+ }
+ Date[] actual = serviceClient.getNewDateArrayForward(d);
+ Assert.assertEquals(expected.length, actual.length);
+ for (int i = 0; i < expected.length; ++i) {
+ Assert.assertEquals(expected[i], actual[i]);
+ }
+ }
+
+ private void performTestNewQName(StandardTypesServiceClient serviceClient) {
+ QName[] qnames = new QName[3];
+ qnames[0] = new QName("localPart");
+ qnames[1] = new QName("namespaceUri", "localPart");
+ qnames[2] = new QName("namespaceUri", "localPart", "prefix");
+ QName[] expected = new QName[qnames.length];
+ for (int i = 0; i < qnames.length; ++i) {
+ expected[i] =
+ new QName(qnames[i].getNamespaceURI() + "q", qnames[i].getLocalPart() + "q",
+ qnames[i].getPrefix() + "q");
+ }
+ for (int i = 0; i < qnames.length; ++i) {
+ QName actual = serviceClient.getNewQNameForward(qnames[i]);
+ Assert.assertEquals(expected[i], actual);
+ }
+ }
+
+ private void performTestNewQNameArray(StandardTypesServiceClient serviceClient) {
+ QName[] qnames = new QName[4];
+ qnames[0] = new QName("localPart");
+ qnames[1] = new QName("namespaceUri", "localPart");
+ qnames[2] = new QName("namespaceUri", "localPart", "prefix");
+ qnames[3] = new QName("localPart2");
+ QName[] expected = new QName[qnames.length];
+ for (int i = 0; i < qnames.length; ++i) {
+ expected[i] =
+ new QName(qnames[i].getNamespaceURI() + "q", qnames[i].getLocalPart() + "q",
+ qnames[i].getPrefix() + "q");
+ }
+ QName[] actual = serviceClient.getNewQNameArrayForward(qnames);
+ Assert.assertEquals(expected.length, actual.length);
+ for (int i = 0; i < qnames.length; ++i) {
+ Assert.assertEquals(expected[i], actual[i]);
+ }
+ }
+
+ private void performTestNewURI(StandardTypesServiceClient serviceClient) {
+ URI[] uris = new URI[4];
+ uris[0] = URI.create("a/b/c");
+ uris[1] = URI.create("http://abc/");
+ uris[2] = URI.create("ftp://a/b");
+ uris[3] = URI.create("http://abc/").resolve("xyz");
+
+ for (int i = 0; i < uris.length; ++i) {
+ URI expected = uris[i].resolve("uri");
+ URI actual = serviceClient.getNewURIForward(uris[i]);
+ Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestNewURIArray(StandardTypesServiceClient serviceClient) {
+ URI[] uris = new URI[4];
+ uris[0] = URI.create("a/b/c");
+ // [rfeng] We need to have a trialign / to avoid the resolving problem
+ // FIXME: [vamsi] This is actually a data transformation problem. The array being returned from the service method is
+ // not making to the caller intact.
+ uris[1] = URI.create("http://abc/");
+ uris[2] = URI.create("ftp://a/b");
+ uris[3] = URI.create("http://abc/").resolve("xyz");
+
+ URI[] expected = new URI[uris.length];
+ for (int i = 0; i < uris.length; ++i) {
+ expected[i] = uris[i].resolve("uri");
+ }
+
+ URI[] actual = serviceClient.getNewURIArrayForward(uris);
+ Assert.assertEquals(expected.length, actual.length);
+ for (int i = 0; i < uris.length; ++i) {
+ Assert.assertEquals(expected[i], actual[i]);
+ }
+ }
+
+ private void performTestNewXMLGregorianCalendar(StandardTypesServiceClient serviceClient)
+ throws DatatypeConfigurationException {
+ DatatypeFactory df = DatatypeFactory.newInstance();
+ XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
+ xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
+ xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
+ xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));
+
+ for (int i = 0; i < xgcals.length; ++i) {
+ XMLGregorianCalendar actual = serviceClient.getNewXMLGregorianCalendarForward(xgcals[i]);
+ xgcals[i].setDay(xgcals[i].getDay() + 5);
+ Assert.assertEquals(xgcals[i], actual);
+ }
+ }
+
+ private void performTestNewXMLGregorianCalendarArray(StandardTypesServiceClient serviceClient)
+ throws DatatypeConfigurationException {
+ DatatypeFactory df = DatatypeFactory.newInstance();
+ XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
+ xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
+ xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
+ xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));
+
+ XMLGregorianCalendar[] actual = serviceClient.getNewXMLGregorianCalendarArrayForward(xgcals);
+ Assert.assertEquals(xgcals.length, actual.length);
+ for (int i = 0; i < xgcals.length; ++i) {
+ xgcals[i].setDay(xgcals[i].getDay() + 5);
+ Assert.assertEquals(xgcals[i], actual[i]);
+ }
+ }
+
+ private void performTestNewDuration(StandardTypesServiceClient serviceClient) throws DatatypeConfigurationException {
+ DatatypeFactory df = DatatypeFactory.newInstance();
+ Duration[] da = new Duration[3];
+ da[0] = df.newDuration(1000000000000L);
+ da[1] = df.newDurationDayTime(1000000000000L);
+ da[2] = df.newDurationYearMonth(true, 1, 3);
+
+ for (int i = 0; i < da.length; ++i) {
+ Assert.assertEquals(da[i].negate(), serviceClient.getNewDurationForward(da[i]));
+ }
+ }
+
+ private void performTestNewObject(StandardTypesServiceClient serviceClient) {
+ Object[] objs = new Object[5];
+ objs[0] = "Hello";
+ objs[1] = 10;
+ objs[2] = null;
+ objs[3] = -1.0;
+ objs[4] = null;
+
+ for (int i = 0; i < objs.length; ++i) {
+ Object expected = StandardTypesTransformer.getNewObject(objs[i]);
+ Object actual = serviceClient.getNewObjectForward(objs[i]);
+ Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestNewObjectArray(StandardTypesServiceClient serviceClient) {
+ Object[] objs = new Object[5];
+ objs[0] = "Hello";
+ objs[1] = 10;
+ objs[2] = null;
+ objs[3] = -1.0;
+ objs[4] = null;
+
+ Object[] actual = serviceClient.getNewObjectArrayForward(objs);
+ Assert.assertEquals(objs.length, actual.length);
+ for (int i = 0; i < objs.length; ++i) {
+ Object expected = StandardTypesTransformer.getNewObject(objs[i]);
+ Assert.assertEquals(expected, actual[i]);
+ }
+ }
+
+ private void performTestNewImage(StandardTypesServiceClient serviceClient) throws InterruptedException {
+ // Create some images to test with.
+ Image[] imgs = new Image[3];
+ imgs[0] = new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);
+ imgs[1] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ imgs[2] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+ imgs[0].getGraphics().drawLine(1, 1, 8, 8);
+ imgs[1].getGraphics().drawLine(8, 1, 1, 8);
+ imgs[2].getGraphics().drawLine(1, 8, 8, 1);
+
+ Image[] copy = imgs;
+ // Create the same images once again as the StandardTypesTransformer may manipulate the image passed.
+ imgs = new Image[3];
+ imgs[0] = new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);
+ imgs[1] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ imgs[2] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+ imgs[0].getGraphics().drawLine(1, 1, 8, 8);
+ imgs[1].getGraphics().drawLine(8, 1, 1, 8);
+ imgs[2].getGraphics().drawLine(1, 8, 8, 1);
+
+ // Make sure the images and copies are equal using ImageInfo
+ for(int i = 0; i < imgs.length; ++i) {
+ Assert.assertEquals(new ImageInfo(imgs[i]), new ImageInfo(copy[i]));
+ }
+
+ for (int i = 0; i < imgs.length; ++i) {
+ Image actual = serviceClient.getNewImageForward(imgs[i]);
+ Image expected = StandardTypesTransformer.getNewImage(copy[i]);
+ // Compare using ImageInfo
+ Assert.assertEquals(new ImageInfo(expected), new ImageInfo(actual));
+ }
+ }
+
+ private void performTestNewImageArray(StandardTypesServiceClient serviceClient) throws InterruptedException {
+ // Create some images to test with.
+ Image[] imgs = new Image[3];
+ imgs[0] = new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);
+ imgs[1] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ imgs[2] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+ imgs[0].getGraphics().drawLine(1, 1, 8, 8);
+ imgs[1].getGraphics().drawLine(8, 1, 1, 8);
+ imgs[2].getGraphics().drawLine(1, 8, 8, 1);
+
+ Image[] copy = imgs;
+ // Create the same images once again as the StandardTypesTransformer may manipulate the image passed.
+ imgs = new Image[3];
+ imgs[0] = new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);
+ imgs[1] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ imgs[2] = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+ imgs[0].getGraphics().drawLine(1, 1, 8, 8);
+ imgs[1].getGraphics().drawLine(8, 1, 1, 8);
+ imgs[2].getGraphics().drawLine(1, 8, 8, 1);
+
+ // Make sure the images and copies are equal using ImageInfo
+ for(int i = 0; i < imgs.length; ++i) {
+ Assert.assertEquals(new ImageInfo(imgs[i]), new ImageInfo(copy[i]));
+ }
+
+ Image[] actual = serviceClient.getNewImageArrayForward(imgs);
+ Assert.assertEquals(imgs.length, actual.length);
+ for (int i = 0; i < imgs.length; ++i) {
+ Image expected = StandardTypesTransformer.getNewImage(copy[i]);
+ // Compare using ImageInfo
+ Assert.assertEquals(new ImageInfo(expected), new ImageInfo(actual[i]));
+ }
+ }
+
+ private void performTestNewDurationArray(StandardTypesServiceClient serviceClient)
+ throws DatatypeConfigurationException {
+ DatatypeFactory df = DatatypeFactory.newInstance();
+ Duration[] da = new Duration[3];
+ da[0] = df.newDuration(1000000000000L);
+ da[1] = df.newDurationDayTime(1000000000000L);
+ da[2] = df.newDurationYearMonth(true, 1, 3);
+
+ Duration[] actual = serviceClient.getNewDurationArrayForward(da);
+ Assert.assertEquals(da.length, actual.length);
+ for (int i = 0; i < da.length; ++i) {
+ Assert.assertEquals(da[i].negate(), actual[i]);
+ }
+ }
+
+ private void performTestNewDataHandler(StandardTypesServiceClient serviceClient) throws IOException {
+ DataHandler[] dha = new DataHandler[3];
+ dha[0] = new DataHandler("Some data", "text/plain");
+ dha[1] = new DataHandler(this.getClass().getClassLoader().getResource("standard-types-service.composite"));
+ dha[2] = new DataHandler(new ByteArrayDataSource("Some data2".getBytes()));
+
+ for (int i = 0; i < dha.length; ++i) {
+ DataHandler actual = serviceClient.getNewDataHandlerForward(dha[i]);
+ // Note: The DataHandler returned may use a different type of DataSource.
+ // Compare the data content instead of using equals().
+ Assert.assertTrue(compare(dha[i], actual));
+ }
+ }
+
+ private void performTestNewDataHandlerArray(StandardTypesServiceClient serviceClient) throws IOException {
+ DataHandler[] dha = new DataHandler[3];
+ dha[0] = new DataHandler("Some data", "text/plain");
+ dha[1] = new DataHandler(this.getClass().getClassLoader().getResource("standard-types-service.composite"));
+ dha[2] = new DataHandler(new ByteArrayDataSource("Some data2".getBytes()));
+
+ DataHandler[] actual = serviceClient.getNewDataHandlerArrayForward(dha);
+ Assert.assertEquals(dha.length, actual.length);
+ for (int i = 0; i < dha.length; ++i) {
+ // Note: The DataHandler returned may use a different type of DataSource.
+ // Compare the data content instead of using equals().
+ Assert.assertTrue(compare(dha[i], actual[i]));
+ }
+ }
+
+ private void performTestNewSource(StandardTypesServiceClient serviceClient) throws Exception {
+ String xml = new String("<a>A<b>B</b><c>C</c></a>");
+ Source[] srcs = new Source[3];
+ srcs[0] = new DOMSource(new String2Node().transform(xml, null));
+ srcs[1] = new SAXSource(new InputSource(new StringReader(xml)));
+ srcs[2] = new StreamSource(new StringReader(xml));
+
+ for (int i = 0; i < srcs.length; ++i) {
+ Source expected = StandardTypesTransformer.getNewSource(srcs[i]);
+ Source actual = serviceClient.getNewSourceForward(srcs[i]);
+ // [rfeng] The data may come back as a different source
+ Assert.assertEquals(sourceToString(expected), sourceToString(actual));
+ }
+ }
+
+ private void performTestNewSourceArray(StandardTypesServiceClient serviceClient) throws Exception {
+ String xml = new String("<a>A<b>B</b><c>C</c></a>");
+ Source[] srcs = new Source[3];
+ srcs[0] = new DOMSource(new String2Node().transform(xml, null));
+ srcs[1] = new SAXSource(new InputSource(new StringReader(xml)));
+ srcs[2] = new StreamSource(new StringReader(xml));
+
+ Source[] actual = serviceClient.getNewSourceArrayForward(srcs);
+ Source[] expected = new Source[srcs.length];
+ for(int i = 0; i < srcs.length; ++i) {
+ expected[i] = StandardTypesTransformer.getNewSource(srcs[i]);
+ }
+ Assert.assertEquals(srcs.length, actual.length);
+ for (int i = 0; i < srcs.length; ++i) {
+ // [rfeng] The data may come back as a different source
+ Assert.assertEquals(sourceToString(expected[i]), sourceToString(actual[i]));
+ }
+
+ }
+
+ private void performTestNewUUID(StandardTypesServiceClient serviceClient) {
+ UUID[] uuids = new UUID[3];
+ uuids[0] = UUID.nameUUIDFromBytes("ABCDEFGHJKLMNOPQRSTUVWXYZ".getBytes());
+ uuids[1] = UUID.nameUUIDFromBytes("abcdefghjklmnopqrstuvwxyz".getBytes());
+ uuids[2] = UUID.randomUUID();
+
+ for (int i = 0; i < uuids.length; ++i) {
+ UUID expected = UUID.fromString(uuids[i].toString() + "AAA");
+ UUID actual = serviceClient.getNewUUIDForward(uuids[i]);
+ Assert.assertEquals(expected, actual);
+ }
+ }
+
+ private void performTestNewUUIDArray(StandardTypesServiceClient serviceClient) {
+ UUID[] uuids = new UUID[3];
+ uuids[0] = UUID.nameUUIDFromBytes("ABCDEFGHJKLMNOPQRSTUVWXYZ".getBytes());
+ uuids[1] = UUID.nameUUIDFromBytes("abcdefghjklmnopqrstuvwxyz".getBytes());
+ uuids[2] = UUID.randomUUID();
+
+ UUID[] actual = serviceClient.getNewUUIDArrayForward(uuids);
+ for (int i = 0; i < uuids.length; ++i) {
+ UUID expected = UUID.fromString(uuids[i].toString() + "AAA");
+ Assert.assertEquals(expected, actual[i]);
+ }
+ }
+
+ /**
+ * This method compares two DataHandlers.
+ * @return true if the data in the two handlers is the same.
+ */
+ private boolean compare(DataHandler dh1, DataHandler dh2) throws IOException {
+ InputStream inp1 = dh1.getInputStream();
+ InputStream inp2 = dh2.getInputStream();
+ for(;;) {
+ int i1 = inp1.read();
+ int i2 = inp2.read();
+ if(i1 == -1 && i2 == -1) {
+ return true;
+ } else if(i1 != -1 && i2 != -1) {
+ if(i1 != i2) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * This method returns the content of a source object as String.
+ */
+ private String sourceToString(Source s) throws Exception {
+ StringWriter sw = new StringWriter();
+ Result r = new StreamResult(sw);
+ TransformerFactory.newInstance().newTransformer().transform(s, r);
+ sw.close();
+ return sw.toString();
+ }
+
+ /**
+ * This class initializes with the width, height and pixel data of a java.awt.Image object.
+ */
+ private static class ImageInfo {
+ private int h, w, pixels[];
+ public ImageInfo(Image img) throws InterruptedException {
+ w = img.getWidth(null);
+ h = img.getHeight(null);
+ pixels = new int[w*h];
+ PixelGrabber pg = new PixelGrabber(img, 0, 0, w, h, pixels, 0, w);
+ pg.grabPixels();
+ }
+
+ public boolean equals(Object that) {
+ if(that == null) {
+ return false;
+ } else if(!(that instanceof ImageInfo)) {
+ return false;
+ }
+
+ ImageInfo that1 = (ImageInfo)that;
+ if(w != that1.w || h != that1.h || pixels == null || that1.pixels == null || pixels.length != that1.pixels.length) {
+ return false;
+ }
+ for(int i = 0; i < pixels.length; ++i) {
+ if(pixels[i] != that1.pixels[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName()+"[w = "+w+", h = "+h+", pixels = "+pixels+"]";
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxbgen/pom.xml b/sca-java-1.x/branches/sca-android/itest/databindings/jaxbgen/pom.xml
new file mode 100644
index 0000000000..648c16bf75
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxbgen/pom.xml
@@ -0,0 +1,262 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-databindings</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-jaxb</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA JAXB Databinding Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </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>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-xml</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-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.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</version>
+ </dependency>
+ <!-- Added by Simon Nash -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.12</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- End of addition -->
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <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>itest-databindings-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </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>
+ <version>1.9</version>
+ <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>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/databindings/jaxbgen/src/main/resources/greeter.composite b/sca-java-1.x/branches/sca-android/itest/databindings/jaxbgen/src/main/resources/greeter.composite
new file mode 100644
index 0000000000..ae0740e6fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/jaxbgen/src/main/resources/greeter.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"
+ 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)"/>
+ </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-android/itest/databindings/pom.xml b/sca-java-1.x/branches/sca-android/itest/databindings/pom.xml
new file mode 100644
index 0000000000..e607d4a6a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings</artifactId>
+ <name>Apache Tuscany SCA Databindings Integration Tests</name>
+ <version>1.4-SNAPSHOT</version>
+
+
+ <packaging>pom</packaging>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+ <modules>
+ <module>common</module>
+ <module>sdogen</module>
+ <module>jaxbgen</module>
+ <module>jaxb-bottom-up</module>
+ <module>jaxb-top-down</module>
+ <module>interop</module>
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/databindings/readme.html b/sca-java-1.x/branches/sca-android/itest/databindings/readme.html
new file mode 100644
index 0000000000..24a44e4ed7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/databindings/sdogen/pom.xml b/sca-java-1.x/branches/sca-android/itest/databindings/sdogen/pom.xml
new file mode 100644
index 0000000000..bfafd558f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/sdogen/pom.xml
@@ -0,0 +1,251 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-databindings</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA SDO Databinding Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</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>http://download.java.net/maven/1</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-xml</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${pom.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- Added by Mike Edwards -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.12</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- End of addition -->
+ </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>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-sdo-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>
+ <argument>true</argument>
+ </arguments>
+ </configuration>
+ </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>
+ <argument>true</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.1.1</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>
+ </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-android/itest/databindings/sdogen/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-android/itest/databindings/sdogen/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..3f9926604d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/databindings/sdogen/src/main/resources/generate/generate.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>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-android/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/domain/pom.xml b/sca-java-1.x/branches/sca-android/itest/domain/pom.xml
new file mode 100644
index 0000000000..930bcda79d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/pom.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-domain</artifactId>
+ <name>Apache Tuscany SCA Domain Integration Tests</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-launcher</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-monitor-logging</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </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-android/itest/domain/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..797ebb4024
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..1a63d4ff77
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddServiceImpl.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 calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.java
new file mode 100644
index 0000000000..93486d915e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.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 calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceUpdateImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService Update - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..2718ab8772
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/CalculatorService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The Calculator service interface.
+ */
+@Remotable
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..3cb255843f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/CalculatorServiceImpl.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 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 setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ public double add(double n1, double n2) {
+ System.out.println("CalculatorService - add " + n1 + " and " + n2);
+ return addService[1].add(addService[0].add(n1, n2), n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..ef6a8b375b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/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-android/itest/domain/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..8c33862f6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/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-android/itest/domain/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..db568cc762
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/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-android/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..c7fbc73c00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/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-android/itest/domain/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..615320e670
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/SubtractService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..abf2777c7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/java/calculator/SubtractServiceImpl.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 calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionA/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionA/Calculator.composite
new file mode 100644
index 0000000000..534e1a29af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionA/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorA">
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <service name="CalculatorService">
+ <binding.sca/>
+ </service>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..1b1c0291e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorA"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.composite
new file mode 100644
index 0000000000..bdb89803d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.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"
+ name="CalculatorB">
+
+ <component name="CalculatorServiceComponentB">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentB"/>
+ <reference name="divideService" target="DivideServiceComponentB" />
+ </component>
+
+ <component name="MultiplyServiceComponentB">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentB">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.composite
new file mode 100644
index 0000000000..c5af8dd3cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorC">
+
+ <component name="SubtractServiceComponentC">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ <service name="SubtractService">
+ <binding.sca/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionDependent/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionDependent/Calculator.composite
new file mode 100644
index 0000000000..df00387b23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionDependent/Calculator.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://dependent"
+ xmlns:dependent="http://dependent"
+ name="CalculatorB">
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ <service name="AddService">
+ <binding.ws uri="http://localhost:8085/AddServiceComponentB"/>
+ </service>
+ </component>
+
+ <component name="SubtractServiceComponentB">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8264a8243f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://dependent"
+ xmlns:sample="http://dependent">
+ <export namespace="http://dependent"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionPrimary/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionPrimary/Calculator.composite
new file mode 100644
index 0000000000..92d069c6c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionPrimary/Calculator.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"
+ targetNamespace="http://primary"
+ xmlns:primary="http://primary"
+ xmlns:dependent="http://dependent"
+ name="CalculatorA">
+
+ <include name="dependent:CalculatorB"/>
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <service name="CalculatorService">
+ <binding.sca/>
+ </service>
+ <reference name="addService" multiplicity="0..n" target="AddServiceComponentA AddServiceComponentB AddServiceComponentC">
+ <binding.sca/>
+ <binding.ws/>
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponentB" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA" />
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="AddServiceComponentA">
+ <implementation.java class="calculator.AddServiceImpl" />
+ <service name="AddService">
+ <binding.sca/>
+ </service>
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..e53c14a651
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/main/resources/contributionPrimary/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://primary"
+ xmlns:sample="http://primary">
+ <deployable composite="sample:CalculatorA"/>
+ <import namespace="http://dependent"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java b/sca-java-1.x/branches/sca-android/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java
new file mode 100644
index 0000000000..98f13df774
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.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.itest.domain;
+
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
+import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.CalculatorService;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class ContributionSPIsTestCase {
+
+ final static Logger logger = Logger.getLogger(ContributionSPIsTestCase.class.getName());
+
+ private static ModelFactoryExtensionPoint modelFactories;
+ private static WorkspaceFactory workspaceFactory;
+ private static XMLOutputFactory outputFactory;
+
+ private static ModelResolverExtensionPoint modelResolvers;
+
+ private static URLArtifactProcessorExtensionPoint urlProcessors;
+ private static URLArtifactProcessor<Contribution> contributionProcessor;
+
+ private static Workspace workspace;
+
+ private static List<String> problems = new ArrayList<String>();
+ private static ContributionDependencyBuilder dependencyBuilder;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ // Bootstrap a runtime to get a populated registry
+ // FIXME needs to be tidied so we can get the registry without all of the other configuration
+ // that is being repeated below
+ ReallySmallRuntime runtime = new ReallySmallRuntime(Thread.currentThread().getContextClassLoader());
+ runtime.start();
+ ExtensionPointRegistry registry = runtime.getExtensionPointRegistry();
+
+ // Create model factories
+ modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+ workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
+
+ // Create model resolvers
+ modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
+
+ // Create artifact processors
+ urlProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+
+ // Create contribution processor
+ contributionProcessor = urlProcessors.getProcessor(Contribution.class);
+
+ // Create workspace model to hold contribution information
+ workspace = workspaceFactory.createWorkspace();
+
+ MonitorFactory monitorFactory = registry.getExtensionPoint(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ dependencyBuilder = new ContributionDependencyBuilderImpl(monitor);
+
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testReadDependentContributions() throws Exception {
+ try {
+ // ====================================================================
+ // The contribution management phase. I.e. where a use is adding contributions
+ // prior to selecting a composite to run
+
+ // Load a contribution
+ // Note that this contribution is added before the contribution that it depends on
+ // as the contribution processing doesn't start until both have been added
+ URI uri = URI.create("contributionPrimary");
+ File file = new File("./src/main/resources/contributionPrimary");
+ URL url = file.toURI().toURL();
+ Contribution contribution = (Contribution)contributionProcessor.read(null,uri, url);
+ workspace.getContributions().add(contribution);
+ System.out.println("Added contributionPrimary");
+
+ // Load another contribution
+ uri = URI.create("contributionDependent");
+ file = new File("./src/main/resources/contributionDependent");
+ url = file.toURI().toURL();
+ contribution = (Contribution)contributionProcessor.read(null,uri, url);
+ workspace.getContributions().add(contribution);
+ System.out.println("Added contributionDependent");
+
+ // Choose a deployables as though a user had chosen it
+ List<Composite> deployables = workspace.getContributions().get(0).getDeployables();
+ QName chosenDeployableName = deployables.get(0).getName();
+ System.out.println("Composite chosen to deploy = " + chosenDeployableName);
+
+
+ // List the dependency problems
+ for (int i = 0, n = problems.size(); i < n ; i++) {
+ System.out.println("Problem: "+ problems.get(i));
+ }
+
+ // ====================================================================
+ // process the first chosen composite ready for a node to run the composite
+
+ // find the contribution that holds our chosen composite and all its dependencies
+ // we are using the first deployable composite from the first contribution
+ // so we really know this here really but lets find it anyway
+ List<Contribution> contributionsToDeploy = null;
+ String chosenDeployableLocation = null;
+ for (Contribution tmpContribution : workspace.getContributions()){
+ for (Composite deployable : tmpContribution.getDeployables()){
+ if (deployable.getName().equals(chosenDeployableName)){
+ contributionsToDeploy = dependencyBuilder.buildContributionDependencies(tmpContribution, workspace);
+ }
+ }
+ }
+
+ // load all the contributions in the dependency chain to find the chosen
+ // composite
+ List<Contribution> loadedContributions = new ArrayList<Contribution>();
+ for (Contribution tmpContribution : contributionsToDeploy){
+ Contribution loadedContribution = contribution(loadedContributions, tmpContribution.getURI(), tmpContribution.getLocation());
+ loadedContributions.add(loadedContribution);
+
+ // find the chosen composite artifact location
+ for ( Artifact artifact :loadedContribution.getArtifacts()){
+ if ( artifact.getURI().endsWith(".composite")){
+ Composite model = (Composite)artifact.getModel();
+ if (model.getName().equals(chosenDeployableName)){
+ chosenDeployableLocation = artifact.getLocation();
+ }
+ }
+ }
+ }
+
+ System.out.println("Composite chosen to deploy location = " + chosenDeployableLocation);
+ for (Contribution dependency : contributionsToDeploy){
+ System.out.println("Composite chosen to deploy dependency chain = " + dependency.getURI());
+ }
+
+/* At this point if there is more than one composite in the domain
+ * we would build the domain to configure all the endpoint URIs
+ * and then pass the individual composites off to the separate
+ * nodes that are going to run the
+ * TODO - I've skipped this part for clarity at the moment
+ *
+ // create a domain level composite
+ Composite domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA10_TUSCANY_NS, "domain"));
+
+ // etc.
+ */
+
+
+
+ // ====================================================================
+ // run the chosen composite
+ SCAContribution [] contributions = new SCAContribution[contributionsToDeploy.size()];
+ for (int i = 0; i < contributionsToDeploy.size(); i++) {
+ contributions[i] = new SCAContribution(contributionsToDeploy.get(i).getURI(), contributionsToDeploy.get(i).getLocation());
+ }
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+
+ SCANode node = nodeFactory.createSCANode(chosenDeployableLocation, contributions);
+
+ node.start();
+ SCAClient client = (SCAClient)node;
+ CalculatorService calculatorService =
+ client.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ System.out.println("Add 2.0 + 3.0 + 3.0 = " + calculatorService.add(2.0, 3.0));
+
+/*
+ AssemblyInspector assemblyInspector = new AssemblyInspector();
+ System.out.println(assemblyInspector.assemblyAsString(node));
+*/
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+
+ private Contribution contribution(List<Contribution> contributions, String contributionURI, String contributionLocation) throws ContributionReadException {
+ try {
+ URI uri = URI.create(contributionURI);
+ URL location = locationURL(contributionLocation);
+ Contribution contribution = (Contribution)contributionProcessor.read(null, uri, location);
+
+ ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
+ contributionProcessor.resolve(contribution, modelResolver);
+
+ return contribution;
+
+ } catch (ContributionReadException e) {
+ throw e;
+ } catch (ContributionResolveException e) {
+ throw new ContributionReadException(e);
+ } catch (MalformedURLException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ private static URL locationURL(String location) throws MalformedURLException {
+ URI uri = URI.create(location);
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+ File file = new File(location);
+ return file.toURI().toURL();
+ } else if (scheme.equals("file")) {
+ File file = new File(location.substring(5));
+ return file.toURI().toURL();
+ } else {
+ return uri.toURL();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/pom.xml b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/pom.xml
new file mode 100644
index 0000000000..bdb3784be3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/pom.xml
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>itest-exceptions-cross-binding-ws</artifactId>
+ <name>Apache Tuscany SCA WS Binding Exceptions Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</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>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <!-- Sun's JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <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>false</verbose>
+ <xnocompile>true</xnocompile>
+ <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>1.1.1</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/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</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl/StockExceptionTest.wsdl</wsdlFile>
+ <javaPackage>com.example.stock.sdo</javaPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java
new file mode 100644
index 0000000000..4f4fe50041
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.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.StockExceptionTest;
+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;
+
+/**
+ * JAXB version of StockExceptionTest impl
+ */
+@Service(StockExceptionTest.class)
+public class StockExchangeJaxB implements StockExceptionTest {
+
+ public StockExchangeJaxB() {
+
+ }
+
+ 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 ("UNDECLARED_SOURCE".equals(input.getName())) {
+
+ throw new TestNotDeclaredAtSourceFault("not declared", "fault info");
+
+ } else if ("UNDECLARED_TARGET".equals(input.getName())) {
+ throw new IllegalArgumentException("System fault");
+ }
+ 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-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java
new file mode 100644
index 0000000000..95496e1737
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.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();
+
+ Object testNotDeclaredAtTargetTest();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java
new file mode 100644
index 0000000000..842dd4e602
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.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.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 (InvalidSymbolSDOException e) {
+
+ e.printStackTrace();
+ } catch (MarketClosedSDOException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ public Object testNotDeclaredAtSourceTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("UNDECLARED_SOURCE");
+ stockOffer.setSymbol("XYZ");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ return exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ } catch (Exception e) {
+ return e;
+
+ }
+
+ }
+
+ public Object testNotDeclaredAtTargetTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("UNDECLARED_TARGET");
+ stockOffer.setSymbol("XYZ");
+ 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-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java
new file mode 100644
index 0000000000..74815dc6c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.ws.WebFault;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+
+/**
+ *
+ */
+@WebFault(name="InvalidSymbolFault", targetNamespace="http://scatesttool.stockexceptiontestservice")
+public class InvalidSymbolSDOException extends Exception {
+ private static final long serialVersionUID = -3824848763300476741L;
+
+ /**
+ *
+ */
+ 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-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java
new file mode 100644
index 0000000000..aba83723bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.ws.WebFault;
+
+/**
+ *
+ */
+@WebFault(name="MarketClosedFault", targetNamespace="http://scatesttool.stockexceptiontestservice")
+public class MarketClosedSDOException extends Exception {
+ private static final long serialVersionUID = 7652466275656958031L;
+
+
+ /**
+ * 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-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java
new file mode 100644
index 0000000000..ab65efbb58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.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.
+ */
+/**
+ * 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.osoa.sca.annotations.Remotable;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+/*
+ * StockExceptionTest java interface
+ */
+
+@Remotable
+public interface StockExceptionTest {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ StockOffer stockQuoteOffer(StockOffer param0) throws InvalidSymbolSDOException, MarketClosedSDOException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..acecdff613
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="ExceptionTest">
+ <include name="foo:intracomposite" />
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..460edab182
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 targetNamespace="http://foo" name="intracomposite" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="exchangeJaxbService" promote="exchangeJaxbComponent">
+ <interface.java interface="org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest" />
+ <binding.ws
+ wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)" />
+ </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" />
+ </component>
+
+ <reference name="stockTraderSDOReference" promote="stockTraderSDOComponent/exchangeJaxb">
+ <interface.java interface="org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest" />
+ <binding.ws
+ wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)" />
+ </reference>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..40e87953b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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:8085/services/exchangeJaxbService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
new file mode 100644
index 0000000000..fc49fa1d7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.osoa.sca.ServiceRuntimeException;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public class IntraCompositeTestCase extends TestCase {
+ private SCADomain domain;
+ private StockTraderSDO stockTrader;
+
+ 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(ServiceRuntimeException.class, ret.getClass());
+
+ }
+
+ public void testNotDeclaredAtTargetException() {
+
+ Object ret = stockTrader.testNotDeclaredAtTargetTest();
+
+ assertNotNull(ret);
+
+ assertEquals(ServiceRuntimeException.class, ret.getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("intracomposite.composite");
+ stockTrader = domain.getService(StockTraderSDO.class, "stockTraderSDOComponent");
+ assertNotNull(stockTrader);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/pom.xml b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/pom.xml
new file mode 100644
index 0000000000..3d4a4a3880
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/pom.xml
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>itest-exceptions-cross-binding</artifactId>
+ <name>Apache Tuscany SCA Cross-Binding Exceptions Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</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>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <!-- JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <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>false</verbose>
+ <xnocompile>true</xnocompile>
+ <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>1.1.1</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</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.4-SNAPSHOT</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-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java
new file mode 100644
index 0000000000..f5e36db7cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.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.impl;
+
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+public interface StockExceptionTestJAXB extends StockExceptionTest {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java
new file mode 100644
index 0000000000..e84ae633e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.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.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 (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-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java
new file mode 100644
index 0000000000..74815dc6c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.ws.WebFault;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+
+/**
+ *
+ */
+@WebFault(name="InvalidSymbolFault", targetNamespace="http://scatesttool.stockexceptiontestservice")
+public class InvalidSymbolSDOException extends Exception {
+ private static final long serialVersionUID = -3824848763300476741L;
+
+ /**
+ *
+ */
+ 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-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java
new file mode 100644
index 0000000000..5fe40935ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.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.test.exceptions.sdohandgen;
+
+import javax.xml.ws.WebFault;
+
+/**
+ *
+ */
+@WebFault(name="MarketClosedFault", targetNamespace="http://scatesttool.stockexceptiontestservice")
+public class MarketClosedSDOException extends Exception {
+ private static final long serialVersionUID = 7652466275656958031L;
+
+ /**
+ * 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-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java
new file mode 100644
index 0000000000..ab65efbb58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.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.
+ */
+/**
+ * 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.osoa.sca.annotations.Remotable;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+/*
+ * StockExceptionTest java interface
+ */
+
+@Remotable
+public interface StockExceptionTest {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ StockOffer stockQuoteOffer(StockOffer param0) throws InvalidSymbolSDOException, MarketClosedSDOException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..872fd721d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="ExceptionTest">
+
+ <include name="foo:intracomposite" />
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..83526cb6a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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" targetNamespace="http://foo" 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" target="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-android/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..d70cdad313
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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:8085/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..33b830c856
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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:8085/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
new file mode 100644
index 0000000000..3371f63e4a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.test.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.osoa.sca.ServiceRuntimeException;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public class IntraCompositeTestCase extends TestCase {
+ private SCADomain domain;
+
+ private StockTraderSDO stockTrader;
+
+ 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(ServiceRuntimeException.class, ret.getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("ExceptionTest.composite");
+ stockTrader = domain.getService(StockTraderSDO.class, "stockTraderSDOComponent");
+ assertNotNull(stockTrader);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/pom.xml b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/pom.xml
new file mode 100644
index 0000000000..bd6646344d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-exceptions-simple-ws</artifactId>
+ <name>Apache Tuscany Test for Simple Exceptions over Web Services</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.java
new file mode 100644
index 0000000000..764f31b7cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.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 com.example;
+
+public class BusinessException extends Exception {
+
+ private String clientName;
+
+ public BusinessException(String message) {
+ super(message);
+ }
+
+ public BusinessException(String message, String clientName) {
+ super(message);
+ this.clientName = clientName;
+ }
+
+ public String getClientName() {
+ return clientName;
+ }
+
+ public void setClientName(String clientName) {
+ this.clientName = clientName;
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java
new file mode 100644
index 0000000000..1b597984e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.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 com.example;
+
+public class BusinessExceptionMinimal extends Exception {
+
+ public BusinessExceptionMinimal(String message) {
+ super(message);
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.java
new file mode 100644
index 0000000000..0c72b52ed9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.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 com.example;
+
+public interface ExampleClient {
+ void runTest();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.java
new file mode 100644
index 0000000000..d6545b5a23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.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 com.example;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ExampleClient.class)
+@Scope("COMPOSITE")
+public class ExampleClientImpl implements ExampleClient {
+
+ private ExampleService myService;
+
+ @Reference
+ public void setMyService(ExampleService myService) {
+ this.myService = myService;
+ }
+
+ public void runTest() {
+ try {
+ Object result = myService.hello("John");
+ System.out.println("myService returned " + result.getClass().getName());
+ } catch (BusinessException e) {
+ System.out.println("caught exception from hello(): " + e.getMessage() + " for " + e.getClientName());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java
new file mode 100644
index 0000000000..987d2107b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.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 com.example;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+//@Service(ExampleClient.class)
+@Scope("COMPOSITE")
+//public class ExampleClientMinimalImpl implements ExampleClient {
+public class ExampleClientMinimalImpl {
+ @Reference
+ protected ExampleServiceMinimal myService;
+
+ public void runTest() {
+ try {
+ //Object result = myService.hello("John");
+ myService.throwException("John");
+ //System.out.println("myService returned " + result.getClass().getName());
+ } catch (BusinessExceptionMinimal e) {
+ System.out.println("caught exception from hello(): " + e.getMessage() );
+ }
+ }
+
+ public String hello(String name) throws BusinessExceptionMinimal{
+ throw new BusinessExceptionMinimal("bad news");
+ }
+ public void throwException(String name) throws BusinessExceptionMinimal{
+ throw new BusinessExceptionMinimal("bad news");
+ }
+
+
+ public static void main(String[] args) {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.java
new file mode 100644
index 0000000000..30ea559694
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.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 com.example;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExampleService {
+
+ String hello(String name) throws BusinessException;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.java
new file mode 100644
index 0000000000..b3b6f033e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.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 com.example;
+
+public class ExampleServiceImpl implements ExampleService {
+ public String hello(String name) throws BusinessException {
+ throw new BusinessException("bad news", name);
+ // return "Hello, " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java
new file mode 100644
index 0000000000..aa8591872e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.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 com.example;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExampleServiceMinimal {
+
+ public String hello(String name) throws Exception;
+ public void throwException(String name) throws BusinessExceptionMinimal;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java
new file mode 100644
index 0000000000..728be51428
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.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 com.example;
+
+public class ExampleServiceMinimalImpl implements ExampleServiceMinimal {
+ public String hello(String name) throws Exception {
+ throw new BusinessExceptionMinimal("minimal bad news" + name);
+ // return "Hello, " + name;
+ }
+
+ public void throwException(String name) throws BusinessExceptionMinimal {
+ throw new BusinessExceptionMinimal("minimal bad news" + name);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/resources/example.composite b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/resources/example.composite
new file mode 100644
index 0000000000..505132277c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/resources/example.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"
+ targetNamespace="http://www.example.com"
+ xmlns:hw="http://www.example.com"
+ name="example">
+
+ <component name="ExampleClientComponent">
+ <implementation.java class="com.example.ExampleClientImpl" />
+ <reference name="myService">
+ <interface.wsdl interface="http://example.com/#wsdl.interface(ExampleServicePortType)" />
+ <binding.ws wsdlElement="http://example.com/#wsdl.port(ExampleService/ExampleServiceSOAP11port_http)" />
+ </reference>
+ </component>
+
+ <component name="ExampleComponent">
+ <implementation.java class="com.example.ExampleServiceImpl"/>
+ <service name="ExampleService">
+ <interface.wsdl interface="http://example.com/#wsdl.interface(ExampleServicePortType)" />
+ <binding.ws wsdlElement="http://example.com/#wsdl.port(ExampleService/ExampleServiceSOAP11port_http)" />
+ </service>
+ </component>
+
+ <component name="ExampleClientMinimalComponent">
+ <implementation.java class="com.example.ExampleClientMinimalImpl" />
+ <reference name="myService">
+ <interface.java interface="com.example.ExampleServiceMinimal"/>
+ <binding.ws uri="http://localhost:8085/ExampleMinimalComponent" />
+ </reference>
+ </component>
+
+ <component name="ExampleMinimalComponent">
+ <implementation.java class="com.example.ExampleServiceMinimalImpl" />
+ <service name="ExampleServiceMinimal">
+ <interface.java interface="com.example.ExampleServiceMinimal"/>
+ <binding.ws uri="http://localhost:8085/ExampleMinimalComponent" />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl
new file mode 100644
index 0000000000..628e6ca6ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:ns0="http://example.com/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns1="http://example.com/xsd"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://example.com/">
+ <wsdl:types>
+ <xs:schema xmlns:ns="http://example.com/" attributeFormDefault="qualified" elementFormDefault="qualified"
+ targetNamespace="http://example.com/">
+ <xs:complexType name="Exception">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="Exception" nillable="true" type="xs:anyType" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="BusinessException">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="BusinessException" nillable="true" type="ns1:BusinessException" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="hello">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="helloResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="helloRequest">
+ <wsdl:part name="parameters" element="ns0:hello" />
+ </wsdl:message>
+ <wsdl:message name="helloResponse">
+ <wsdl:part name="parameters" element="ns0:helloResponse" />
+ </wsdl:message>
+ <wsdl:message name="BusinessException">
+ <wsdl:part name="parameters" element="ns0:BusinessException" />
+ </wsdl:message>
+ <wsdl:portType name="ExampleServicePortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="ns0:helloRequest" wsaw:Action="urn:hello" />
+ <wsdl:output message="ns0:helloResponse" wsaw:Action="urn:helloResponse" />
+ <wsdl:fault message="ns0:BusinessException" name="BusinessException"
+ wsaw:Action="urn:helloBusinessException" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="ExampleServiceSOAP11Binding" type="ns0:ExampleServicePortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="urn:hello" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="BusinessException">
+ <soap:fault use="literal" name="BusinessException" />
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ExampleServiceSOAP12Binding" type="ns0:ExampleServicePortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ <wsdl:operation name="hello">
+ <soap12:operation soapAction="urn:hello" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="BusinessException">
+ <soap12:fault use="literal" name="BusinessException" />
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ExampleServiceHttpBinding" type="ns0:ExampleServicePortType">
+ <http:binding verb="POST" />
+ <wsdl:operation name="hello">
+ <http:operation location="ExampleService/hello" />
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello" />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ExampleService">
+ <wsdl:port name="ExampleServiceSOAP11port_http" binding="ns0:ExampleServiceSOAP11Binding">
+ <soap:address location="http://localhost:8085/axis2/services/ExampleService" />
+ </wsdl:port>
+ <wsdl:port name="ExampleServiceSOAP12port_http" binding="ns0:ExampleServiceSOAP12Binding">
+ <soap12:address location="http://localhost:8085/axis2/services/ExampleService" />
+ </wsdl:port>
+ <wsdl:port name="ExampleServiceHttpport" binding="ns0:ExampleServiceHttpBinding">
+ <http:address location="http://localhost:8085/axis2/services/ExampleService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java
new file mode 100644
index 0000000000..7310a0f1e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.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 com.example;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExampleMinimalTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private ExampleClientMinimalImpl client;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("example.composite");
+ client = scaDomain.getService(ExampleClientMinimalImpl.class, "ExampleClientMinimalComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ client.runTest();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.java b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.java
new file mode 100644
index 0000000000..740af4f43d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.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 com.example;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExampleTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private ExampleClient client;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("example.composite");
+ client = scaDomain.getService(ExampleClient.class, "ExampleClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ client.runTest();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions/pom.xml b/sca-java-1.x/branches/sca-android/itest/exceptions/pom.xml
new file mode 100644
index 0000000000..43b0956e05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-exceptions</artifactId>
+ <name>Apache Tuscany SCA Exceptions Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java
new file mode 100644
index 0000000000..b95b0ccb31
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.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.exceptions;
+
+
+public class Checked extends Exception {
+ private static final long serialVersionUID = -129752837478357452L;
+
+ /**
+ *
+ */
+ 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-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java
new file mode 100644
index 0000000000..5740e053a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 void testing();
+
+ public Checked getTheBad();
+
+ public String getTheGood();
+
+ public UnChecked getTheUgly();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java
new file mode 100644
index 0000000000..f923133ee9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.exceptions;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Remote exception thrower
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface ExceptionRemoteThrower extends ExceptionThrower {
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java
new file mode 100644
index 0000000000..55d81102d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.exceptions;
+
+
+/**
+ * Local exception thrower
+ * @version $Rev$ $Date$
+ */
+public interface ExceptionThrower {
+ public static final Checked BAD = new Checked("theBad");
+ public static final UnChecked UGLY = new UnChecked("theUgly");
+ public static final String SO_THEY_SAY = "All is good that ends good.";
+
+ public String theGood() throws Checked;
+
+ public String theBad() throws Checked;
+
+ public String theUgly() throws Checked;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java
new file mode 100644
index 0000000000..453528444d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.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 UnChecked extends RuntimeException {
+ private static final long serialVersionUID = -1318118082838092244L;
+
+ /**
+ *
+ */
+ 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-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java
new file mode 100644
index 0000000000..1987490a0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.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.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;
+
+ 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-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java
new file mode 100644
index 0000000000..c4cb52f94c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.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.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.Checked;
+import org.apache.tuscany.sca.test.exceptions.ExceptionRemoteThrower;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(ExceptionRemoteThrower.class)
+public class ExceptionRemoteThrowerImpl implements ExceptionRemoteThrower {
+ public String theBad() throws Checked {
+ throw BAD;
+ }
+
+ public String theGood() throws Checked {
+ return SO_THEY_SAY;
+ }
+
+ public String theUgly() throws Checked {
+ throw UGLY;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java
new file mode 100644
index 0000000000..cf8740ba56
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.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.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.Checked;
+import org.apache.tuscany.sca.test.exceptions.ExceptionThrower;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(ExceptionThrower.class)
+public class ExceptionThrowerImpl implements ExceptionThrower {
+
+ public String theBad() throws Checked {
+ throw BAD;
+ }
+
+ public String theGood() throws Checked {
+ return SO_THEY_SAY;
+ }
+
+ public String theUgly() throws Checked {
+ throw UGLY;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.java
new file mode 100644
index 0000000000..f82a30d529
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.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.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.ExceptionRemoteThrower;
+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 RemoteExceptionHandlerImpl implements ExceptionHandler {
+ static final String INIT = "INIT";
+
+ private ExceptionRemoteThrower exceptionThrower;
+
+ private String theGood;
+
+ private Checked theBad;
+
+ private UnChecked theUgly;
+
+ 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(ExceptionRemoteThrower exceptionThrower) {
+ this.exceptionThrower = exceptionThrower;
+ }
+
+ public String getTheGood() {
+ return theGood;
+ }
+
+ public Checked getTheBad() {
+ return theBad;
+ }
+
+ public UnChecked getTheUgly() {
+ return theUgly;
+ }
+
+ public ExceptionRemoteThrower getExceptionThrower() {
+ return exceptionThrower;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..d27797c2fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/main/resources/ExceptionTest.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:foo="http://foo" targetNamespace="http://foo"
+ name="ExceptionTest">
+ <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>
+
+ <component name="mainRemote">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.RemoteExceptionHandlerImpl" />
+ <reference name="exceptionThrower" target="exceptionThrowerRemote" />
+ </component>
+
+ <component name="exceptionThrowerRemote">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionRemoteThrowerImpl" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java b/sca-java-1.x/branches/sca-android/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java
new file mode 100644
index 0000000000..f84205c096
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.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.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExceptionsTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ /**
+ * Test exception handling over a local interface
+ */
+ public void testLocal() {
+ ExceptionHandler exceptionHandler = domain.getService(ExceptionHandler.class, "main");
+ exceptionHandler.testing();
+ assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood() );
+ assertNotNull(exceptionHandler.getTheBad());
+ assertEquals( Checked.class, exceptionHandler.getTheBad().getClass());
+ assertSame(ExceptionThrower.BAD, exceptionHandler.getTheBad());
+ assertNotNull(exceptionHandler.getTheUgly());
+ assertEquals( UnChecked.class, exceptionHandler.getTheUgly().getClass());
+ assertSame(ExceptionThrower.UGLY, exceptionHandler.getTheUgly());
+ }
+
+ /**
+ * Test exception handling over a remotable interface
+ */
+ public void testRemote() {
+ ExceptionHandler exceptionHandler = domain.getService(ExceptionHandler.class, "mainRemote");
+ exceptionHandler.testing();
+ assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood() );
+ assertNotNull(exceptionHandler.getTheBad());
+ assertEquals( Checked.class, exceptionHandler.getTheBad().getClass());
+ assertNotSame(ExceptionThrower.BAD, exceptionHandler.getTheBad());
+ assertNotNull(exceptionHandler.getTheUgly());
+ assertEquals( UnChecked.class, exceptionHandler.getTheUgly().getClass());
+
+ // [rfeng] We're not in a position to copy non business exceptions
+ // assertNotSame(ExceptionThrower.UGLY, exceptionHandler.getTheUgly());
+
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("ExceptionTest.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/extended-api/pom.xml b/sca-java-1.x/branches/sca-android/itest/extended-api/pom.xml
new file mode 100644
index 0000000000..26545ef2d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+
+ <groupId>org.apache.tuscany.sca</groupId>
+
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+
+ <version>1.4-SNAPSHOT</version>
+
+ <scope>runtime</scope>
+
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/extended-api/src/main/resources/BasicService.composite b/sca-java-1.x/branches/sca-android/itest/extended-api/src/main/resources/BasicService.composite
new file mode 100644
index 0000000000..128b33b16f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/extended-api/src/main/resources/MathService.composite b/sca-java-1.x/branches/sca-android/itest/extended-api/src/main/resources/MathService.composite
new file mode 100644
index 0000000000..8e99d3da60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java b/sca-java-1.x/branches/sca-android/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java
new file mode 100644
index 0000000000..c480235d88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.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.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 description: Locate a service using Domain.getService() from an
+ * unmanaged client and invoke a method on that service
+ */
+ @Test
+ public void unmanagedLocateService() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.negate(99));
+ }
+
+ /**
+ * Test description: Locate a service using Domain.getService() from an
+ * managed client. A service is located from this unmanaged test client and a method
+ * is invoked. The method implementation of the service will also use Domain.getService
+ */
+ @Test
+ public void managedLocateService() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.delegateNegate(99));
+ }
+
+ /**
+ * Test description: Attempt to locate a service with an invalid name.
+ */
+ @Test(expected = ServiceRuntimeException.class)
+ public void badComponentName() {
+ BasicService service = domain.getService(BasicService.class, "IvalidServiceName");
+ service.negate(-1);
+ }
+
+ @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-android/itest/interfaces/pom.xml b/sca-java-1.x/branches/sca-android/itest/interfaces/pom.xml
new file mode 100644
index 0000000000..65de919e10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-interfaces</artifactId>
+ <name>Apache Tuscany Interface Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java
new file mode 100644
index 0000000000..5bc872ef83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.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.itest.interfaces;
+
+
+/**
+ * only for callBack
+ */
+public interface LocalCallbackInterface {
+
+ public void callbackMethod(String str);
+
+ public void modifyParameter(ParameterObject po);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java
new file mode 100644
index 0000000000..7bfcf5de11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.interfaces;
+
+import org.osoa.sca.annotations.OneWay;
+
+/*
+ * itest for interface: local,method-overloading
+ */
+public interface LocalClientComponent {
+
+ String foo1(ParameterObject po);
+
+ String foo1(String str) throws Exception;
+
+ String foo2(String str, int i);
+
+ String foo2(int i, String str) throws Exception;
+
+ void callback(String str);
+
+ void callModifyParameter();
+
+ @OneWay
+ void onewayMethod(String str);
+
+ String getCallbackValue();
+
+ String getOnewayValue();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java
new file mode 100644
index 0000000000..d4f7694e8f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.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.itest.interfaces;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(LocalClientComponent.class)
+public class LocalClientComponentImpl implements LocalClientComponent, LocalCallbackInterface {
+
+ @Reference
+ protected LocalServiceComponent aCallBackService;
+ private static String callbackValue;
+ private static String onewayValue;
+
+ public String foo1(ParameterObject po) {
+ po.field1 = "AComponent";
+ return "AComponent";
+ }
+
+ public String foo1(String str) throws Exception {
+ return str + "AComponent";
+ }
+
+ public String foo2(String str, int i) {
+ return str + "AComponent" + i;
+ }
+
+ public String foo2(int i, String str) throws Exception {
+ return str + "AComponent" + i;
+ }
+
+ public void callback(String str) {
+ aCallBackService.callback(str);
+ }
+
+ public void callbackMethod(String str) {
+ callbackValue = str;
+ }
+
+ public void callModifyParameter() {
+ this.aCallBackService.modifyParameter();
+ }
+
+ public String getCallbackValue() {
+ return callbackValue;
+ }
+
+ public void onewayMethod(String str) {
+ onewayValue = str;
+ try {
+ Thread.sleep(200);
+ } catch (Exception e) {
+ //do nothing
+ }
+ }
+
+ public String getOnewayValue() {
+ return onewayValue;
+ }
+
+ public void modifyParameter(ParameterObject po) {
+ po.field1 = "AComponent";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java
new file mode 100644
index 0000000000..4772303fab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.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.itest.interfaces;
+
+import org.osoa.sca.annotations.Callback;
+
+/**
+ * Local be-directional callBackService
+ */
+@Callback(LocalCallbackInterface.class)
+public interface LocalServiceComponent {
+
+ String foo(String str);
+
+ void callback(String str);
+
+ void modifyParameter();
+
+ ParameterObject getPO();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java
new file mode 100644
index 0000000000..e100636b23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.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.itest.interfaces;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+@Service(LocalServiceComponent.class)
+public class LocalServiceComponentImpl implements LocalServiceComponent {
+
+ @Callback
+ protected LocalCallbackInterface callback;
+
+ private static ParameterObject po;
+
+ public void callback(String str) {
+ callback.callbackMethod(str);
+ }
+
+ public void modifyParameter() {
+ po = new ParameterObject("CallBack");
+ callback.modifyParameter(po);
+ }
+
+ public String foo(String str) {
+ return str;
+ }
+
+ public ParameterObject getPO() {
+ return po;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java
new file mode 100644
index 0000000000..0bc8d10904
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.interfaces;
+
+import java.io.Serializable;
+
+public class ParameterObject implements Serializable {
+ private static final long serialVersionUID = 1L;
+ public String field1;
+
+ public ParameterObject() {
+ this.field1 = null;
+ }
+
+ public ParameterObject(String field1) {
+ this.field1 = field1;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this)
+ return true;
+ if (o instanceof ParameterObject) {
+ ParameterObject other = (ParameterObject)o;
+ if (field1 != null)
+ return field1.equals(other.field1);
+ }
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java
new file mode 100644
index 0000000000..e2b70313ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.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.interfaces;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * only for callBack
+ */
+@Remotable
+public interface RemoteCallbackInterface {
+
+ public void callbackMethod(String str);
+
+ public void modifyParameter(ParameterObject po);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java
new file mode 100644
index 0000000000..dd591eabeb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.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.
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.interfaces;
+
+import org.osoa.sca.annotations.Remotable;
+
+/*
+ * different signatures
+ */
+
+@Remotable
+public interface RemoteClientComponent {
+
+ String foo1(ParameterObject po);
+ String foo3(ParameterObject po);
+
+ String foo2(int i, String str1) throws Exception;
+
+ void callback(String str);
+
+ void callModifyParameter();
+
+ String getCallbackValue();
+
+ void onewayMethod(String str);
+
+ String getOnewayValue();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java
new file mode 100644
index 0000000000..d4731f35d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.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.itest.interfaces;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(RemoteClientComponent.class)
+public class RemoteClientComponentImpl implements RemoteClientComponent, RemoteCallbackInterface {
+
+ @Reference
+ protected RemoteServiceComponent aCallBackService;
+ private static String callbackValue;
+ private static String onewayValue;
+
+ public String foo1(ParameterObject po) {
+ po.field1 = "BComponent";
+ return "BComponent";
+ }
+
+ @AllowsPassByReference
+ public String foo3(ParameterObject po) {
+ po.field1 = "BComponent";
+ return "BComponent";
+ }
+
+ public String foo2(int i, String str) throws Exception {
+ return str + "BComponent" + i;
+ }
+
+ public void callback(String str) {
+ aCallBackService.callback(str);
+ }
+
+ public void callModifyParameter() {
+ this.aCallBackService.modifyParameter();
+ }
+
+ public void callbackMethod(String str) {
+ callbackValue = str;
+ }
+
+ public String getCallbackValue() {
+ return callbackValue;
+ }
+
+ public void onewayMethod(String str) {
+ onewayValue = str;
+ try {
+ Thread.sleep(200);
+ } catch (Exception e) {
+ //do nothing
+ }
+ }
+
+ public String getOnewayValue() {
+ return onewayValue;
+ }
+
+ public void modifyParameter(ParameterObject po) {
+ po.field1 = "BComponent";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java
new file mode 100644
index 0000000000..6c40db0e70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.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.interfaces;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(RemoteCallbackInterface.class)
+public interface RemoteServiceComponent {
+
+ String foo(String str);
+
+ void callback(String str);
+
+ void modifyParameter();
+
+ ParameterObject getPO();
+
+ String[] bar(int[][] intArray);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java
new file mode 100644
index 0000000000..3804d31902
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.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.itest.interfaces;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+@Service(RemoteServiceComponent.class)
+public class RemoteServiceComponentImpl implements RemoteServiceComponent {
+
+ @Callback
+ protected RemoteCallbackInterface callback;
+
+ private static ParameterObject po;
+
+ public void callback(String str) {
+ callback.callbackMethod(str);
+ }
+
+ public void modifyParameter() {
+ po = new ParameterObject("CallBack");
+ callback.modifyParameter(po);
+ }
+
+ public String foo(String str) {
+ return str;
+ }
+
+ public ParameterObject getPO() {
+ return po;
+ }
+
+ public String[] bar(int[][] intArray) {
+ return new String[] {"int"};
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/resources/InterfacesTest.composite b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/resources/InterfacesTest.composite
new file mode 100644
index 0000000000..0361d8c83c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/main/resources/InterfacesTest.composite
@@ -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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="InterfacesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="LocalClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalClientComponentImpl" />
+ <reference name="aCallBackService" target="LocalServiceComponent" />
+ </component>
+
+ <component name="RemoteClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.RemoteClientComponentImpl" />
+ <reference name="aCallBackService" target="RemoteServiceComponent" />
+ </component>
+
+ <component name="LocalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalServiceComponentImpl" />
+ </component>
+
+ <component name="RemoteServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.RemoteServiceComponentImpl" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java b/sca-java-1.x/branches/sca-android/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java
new file mode 100644
index 0000000000..013cdd4f15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.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.itest.interfaces;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class InterfacesTestCase {
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("InterfacesTest.composite");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testLocalClient() {
+ LocalServiceComponent service = domain.getService(LocalServiceComponent.class, "LocalServiceComponent");
+ LocalClientComponent local = domain.getService(LocalClientComponent.class, "LocalClientComponent");
+
+ try {
+ ParameterObject po = new ParameterObject();
+ assertEquals("AComponent", local.foo1(po));
+ assertEquals("AComponent", po.field1);
+
+ assertEquals("AAComponent", local.foo1("A"));
+
+ assertEquals("AAComponent1", local.foo2("A", 1));
+ assertEquals("AAComponent1", local.foo2(1, "A"));
+ } catch (Exception e) {
+ fail();
+ }
+
+ try {
+ // test local callback
+ local.callback("CallBack");
+ Thread.sleep(100);
+ assertEquals("CallBack", local.getCallbackValue());
+
+ local.callModifyParameter();
+ Thread.sleep(100);
+ assertEquals("AComponent", service.getPO().field1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("CallBack failed");
+ }
+
+ try {
+ local.onewayMethod("OneWay");
+ Thread.sleep(100);
+ assertEquals("OneWay", local.getOnewayValue());
+ } catch (Exception e) {
+ fail("OneWay failed");
+ }
+ }
+
+ @Test
+ public void testRemoteClient() {
+ RemoteServiceComponent service = domain.getService(RemoteServiceComponent.class, "RemoteServiceComponent");
+ RemoteClientComponent remote = domain.getService(RemoteClientComponent.class, "RemoteClientComponent");
+
+ try {
+ // Test Pass By Value
+ ParameterObject po = new ParameterObject("NotBComponent");
+ assertEquals("BComponent", remote.foo1(po));
+ assertEquals("NotBComponent", po.field1);
+
+ assertEquals("BBComponent1", remote.foo2(1, "B"));
+
+ // Test allowsPassByReference
+ assertEquals("BComponent", remote.foo3(po));
+ assertEquals("BComponent", po.field1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+
+ try {
+ remote.callback("CallBack");
+ Thread.sleep(100);
+ assertEquals("CallBack", remote.getCallbackValue());
+
+ remote.callModifyParameter();
+ Thread.sleep(100);
+ assertEquals("CallBack", service.getPO().field1);
+ } catch (Exception e) {
+ fail("CallBack failed");
+ }
+
+ try {
+ remote.onewayMethod("OneWay");
+ Thread.sleep(100);
+ assertEquals("OneWay", remote.getOnewayValue());
+ } catch (Exception e) {
+ fail("OneWay failed");
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-client/pom.xml b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/pom.xml
new file mode 100644
index 0000000000..2369b8489e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-interop-soap-client</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA WS Interop Client Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/interopdoc.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noInterfaces>true</noInterfaces>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>
+ ${basedir}/src/main/resources/wsdl/interopdoc.wsdl</wsdlFile>
+ <javaPackage>org.soapinterop</javaPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java
new file mode 100644
index 0000000000..ffffb96686
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.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.test.interop.client;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Service;
+import org.soapinterop.ComplexDocument;
+import org.soapinterop.DocTestPortType;
+import org.soapinterop.SimpleDocument1;
+import org.soapinterop.SingleTag;
+
+/**
+ * This class implements the DocTest service component.
+ */
+@Service(DocTestPortType.class)
+public class LoopbackInteropDocServiceComponentImpl implements DocTestPortType {
+
+ public ComplexDocument ComplexDocument(ComplexDocument param0){
+ return param0;
+ }
+
+ public SimpleDocument1 SimpleDocument(SimpleDocument1 param4) {
+ return param4;
+ }
+
+ public SingleTag SingleTag(SingleTag param2) {
+ return param2;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/resources/default.composite b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/resources/default.composite
new file mode 100644
index 0000000000..7fd5cc0d65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/resources/default.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"
+ name="interop.client">
+
+ <component name="InteropDocComponentService">
+ <implementation.java class="org.apache.tuscany.test.interop.client.LoopbackInteropDocServiceComponentImpl"/>
+
+ <service name="DocTestPortType">
+ <!-- interface.wsdl interface="http://soapinterop.org/#wsdl.interface(DocTestPortType)"/ -->
+ <interface.java interface="org.soapinterop.DocTestPortType"/>
+ <binding.ws wsdlElement="http://soapinterop.org/#wsdl.endpoint(interopDocSvc/interopDocPort)"/>
+ </service>
+ </component>
+
+
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/resources/wsdl/interopdoc.wsdl b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/resources/wsdl/interopdoc.wsdl
new file mode 100644
index 0000000000..90d8a754b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/main/resources/wsdl/interopdoc.wsdl
@@ -0,0 +1,195 @@
+<?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: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: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: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" />
+ <!-- soap:address location="http://mssoapinterop.org/asmx/simple.asmx"/ -->
+ <!-- soap:address location="http://easysoap.sourceforge.net/cgi-bin/interopserver"/ -->
+ <!-- soap:address location="http://www.mssoapinterop.org/remoting/ServiceAllTypes.soap"/ -->
+ <http-conf:client
+ xmlns:http-conf="http://celtix.objectweb.org/transports/http/configuration"
+ AllowChunking="false" />
+ </port>
+
+ </service>
+
+</definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java
new file mode 100644
index 0000000000..dc1ba48580
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-client/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.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.test.interop.client;
+
+import java.rmi.RemoteException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.soapinterop.ArrayOfSimpleDocument;
+import org.soapinterop.ChildDocument;
+import org.soapinterop.ComplexDocument;
+import org.soapinterop.DocTestPortType;
+import org.soapinterop.SimpleDocument;
+import org.soapinterop.SimpleDocument1;
+import org.soapinterop.SingleTag;
+
+import commonj.sdo.helper.DataFactory;
+
+public class InteropDocClientTestCase extends TestCase {
+ private SCADomain scaDomain;
+
+ private DataFactory dataFactory;
+
+ private DocTestPortType interopDoc;
+
+ public InteropDocClientTestCase(){};
+
+
+ @Override
+ protected void setUp() throws Exception {
+
+ scaDomain = SCADomain.newInstance("default.composite");
+ interopDoc = locateInteropDocService();
+
+ //Get the SDO DataFactory
+ dataFactory = DataFactory.INSTANCE;
+ }
+
+
+ public void testSingleTag() throws RemoteException {
+
+ assertNotNull(interopDoc);
+
+ // Create the input
+ SingleTag input = (SingleTag) dataFactory.create(SingleTag.class);
+
+ // Invoke the service
+ SingleTag output = interopDoc.SingleTag(input);
+
+ // Test the results
+ assertNotNull(output);
+
+ }
+
+ public void testSimpleDocument() throws RemoteException {
+
+ assertNotNull(interopDoc);
+
+ // Create the input
+ SimpleDocument1 input = (SimpleDocument1) dataFactory.create(SimpleDocument1.class);
+ input.setValue("123");
+
+ // Invoke the service
+ SimpleDocument1 output = interopDoc.SimpleDocument(input);
+
+ // Test the results
+ assertNotNull(output);
+ assertEquals("123", output.getValue());
+
+ }
+
+ public void testComplexDocument() throws RemoteException {
+
+ assertNotNull(interopDoc);
+
+ // Create the input
+ ComplexDocument input = (ComplexDocument) dataFactory.create(ComplexDocument.class);
+ input.setAnAttribute("789");
+ ChildDocument childDocument = (ChildDocument) dataFactory.create(ChildDocument.class);
+ SimpleDocument simpleDocument = (SimpleDocument) dataFactory.create(SimpleDocument.class);
+
+ SimpleDocument1 simpleDocument1 = (SimpleDocument1) dataFactory.create(SimpleDocument1.class);
+
+ simpleDocument.setSimpleDocument(simpleDocument1);
+ simpleDocument1.setValue("456");
+ ArrayOfSimpleDocument arrayOfSimpleDocument = (ArrayOfSimpleDocument) dataFactory.create(ArrayOfSimpleDocument.class);
+
+ arrayOfSimpleDocument.getSimpleDocument().add(simpleDocument1);
+ childDocument.setChildSimpleDoc(arrayOfSimpleDocument);
+ input.setChild(childDocument);
+
+ // Invoke the service
+ ComplexDocument output = interopDoc.ComplexDocument(input);
+
+ // Test the results
+ assertNotNull(output);
+ assertEquals("789", output.getAnAttribute());
+ assertNotNull(output.getChild());
+ assertNotNull(output.getChild().getChildSimpleDoc());
+
+ // FIXME Add more tests of the output document
+
+ }
+
+
+ /**
+ * Locate the interop service to test
+ *
+ * @return
+ */
+ protected DocTestPortType locateInteropDocService() {
+ String interopLocation = System.getProperty("interopLocation");
+
+ // Valid service names are:
+ // RemoteInteropDocService: the live interop Web Service
+ // LocalHostInteropDocService: the interop Web Service hosted by Tuscany on localhost
+ // LoopbackInteropDocServiceComponent: a dummy loopback service component
+
+ // To specify the service name run mvn -interopLocation="Remote"
+
+ if (interopLocation == null)
+ interopLocation = "Remote";
+
+ return scaDomain.getService(DocTestPortType.class, interopLocation + "InteropDocService");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/pom.xml b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/pom.xml
new file mode 100644
index 0000000000..9ac6661a5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/pom.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-interop-soap-round2-client</artifactId>
+ <name>Apache Tuscany SCA WS SOAP Round2 Interop Client Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/interoptestdoclit.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noInterfaces>true</noInterfaces>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl/interoptestdoclit.wsdl</wsdlFile>
+ <javaPackage>org.soapinterop.wsdl.interop.test.doc.lit</javaPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/java/org/apache/tuscany/test/interop/client/InteropTestDocLit.java b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/java/org/apache/tuscany/test/interop/client/InteropTestDocLit.java
new file mode 100644
index 0000000000..ca3031c646
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/java/org/apache/tuscany/test/interop/client/InteropTestDocLit.java
@@ -0,0 +1,44 @@
+package org.apache.tuscany.test.interop.client;
+import org.soapinterop.wsdl.interop.test.doc.lit.WSDLInteropTestDocLitPortType;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ *
+ *
+ */
+public class InteropTestDocLit {
+ private WSDLInteropTestDocLitPortType interopTestDocLitPortType =null;
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+
+ }
+ WSDLInteropTestDocLitPortType getInteropTestDocLitPortType() {
+ return interopTestDocLitPortType;
+ }
+ void setInteropTestDocLitPortType(WSDLInteropTestDocLitPortType interopTestDocLitPortType) {
+ this.interopTestDocLitPortType = interopTestDocLitPortType;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/resources/default.composite b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/resources/default.composite
new file mode 100644
index 0000000000..9bde77ef37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/resources/default.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"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="InteropClient">
+
+ <dbsdo:import.sdo location="wsdl/interoptestdoclit.wsdl"/>
+ <dbsdo:import.sdo factory="org.soapinterop.xsd.XsdFactory"/>
+
+ <reference name="RemoteInteropDocService">
+<!--
+ <interface.wsdl interface="http://soapinterop.org/WSDLInteropTestDocLit#wsdl.interface(WSDLInteropTestDocLitPortType)"/>
+ <binding.ws port="http://soapinterop.org/WSDLInteropTestDocLit#wsdl.endpoint(WSDLInteropTestDocLitService/WSDLInteropTestDocLitPort)"/>
+-->
+
+ <interface.java interface="org.soapinterop.wsdl.interop.test.doc.lit.WSDLInteropTestDocLitPortType"/>
+ <binding.ws endpoint="http://soapinterop.org/WSDLInteropTestDocLit#wsdl.endpoint(WSDLInteropTestDocLitService/WSDLInteropTestDocLitPort)"
+ location="wsdl/interoptestdoclit.wsdl" />
+ </reference>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/resources/wsdl/interoptestdoclit.wsdl b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/resources/wsdl/interoptestdoclit.wsdl
new file mode 100644
index 0000000000..e08039cedb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/main/resources/wsdl/interoptestdoclit.wsdl
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<definitions name="WSDLInteropTestDocLitService"
+ targetNamespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://soapinterop.org/WSDLInteropTestDocLit"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd1="http://soapinterop.org/xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <types>
+ <schema targetNamespace="http://soapinterop.org/xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ elementFormDefault="qualified">
+ <complexType name="ArrayOfstring_literal">
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="1" name="string" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <complexType name="SOAPStruct">
+ <all>
+ <element name="varFloat" type="xsd:float"/>
+ <element name="varInt" type="xsd:int"/>
+ <element name="varString" type="xsd:string"/>
+ </all>
+ </complexType>
+
+ <element name="echoStringParam" type="xsd:string"/>
+
+ <element name="echoStringReturn" type="xsd:string"/>
+ <element name="echoStringArrayParam" type="xsd1:ArrayOfstring_literal"/>
+
+ <element name="echoStringArrayReturn" type="xsd1:ArrayOfstring_literal"/>
+
+ <element name="echoStructParam" type="xsd1:SOAPStruct"/>
+
+ <element name="echoStructReturn" type="xsd1:SOAPStruct"/>
+ </schema>
+ </types>
+ <message name="echoString">
+ <part element="xsd1:echoStringParam" name="a"/>
+ </message>
+ <message name="echoStringResponse">
+ <part element="xsd1:echoStringReturn" name="result"/>
+ </message>
+ <message name="echoStringArray">
+ <part element="xsd1:echoStringArrayParam" name="a"/>
+ </message>
+ <message name="echoStringArrayResponse">
+ <part element="xsd1:echoStringArrayReturn" name="result"/>
+ </message>
+ <message name="echoStruct">
+ <part element="xsd1:echoStructParam" name="a"/>
+ </message>
+ <message name="echoStructResponse">
+ <part element="xsd1:echoStructReturn" name="result"/>
+ </message>
+ <message name="echoVoid"/>
+ <message name="echoVoidResponse"/>
+
+ <portType name="WSDLInteropTestDocLitPortType">
+ <operation name="echoString">
+ <input message="tns:echoString" name="echoString"/>
+ <output message="tns:echoStringResponse" name="echoStringResponse"/>
+ </operation>
+ <operation name="echoStringArray">
+ <input message="tns:echoStringArray" name="echoStringArray"/>
+ <output message="tns:echoStringArrayResponse" name="echoStringArrayResponse"/>
+ </operation>
+ <operation name="echoStruct">
+ <input message="tns:echoStruct" name="echoStruct"/>
+ <output message="tns:echoStructResponse" name="echoStructResponse"/>
+ </operation>
+ <operation name="echoVoid">
+ <input message="tns:echoVoid" name="echoVoid"/>
+ <output message="tns:echoVoidResponse" name="echoVoidResponse"/>
+ </operation>
+ </portType>
+ <binding name="WSDLInteropTestDocLitPortBinding"
+ type="tns:WSDLInteropTestDocLitPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="echoString">
+ <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+ <input name="echoString">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </input>
+ <output name="echoStringResponse">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </output>
+ </operation>
+ <operation name="echoStringArray">
+ <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+ <input name="echoStringArray">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </input>
+ <output name="echoStringArrayResponse">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </output>
+ </operation>
+ <operation name="echoStruct">
+ <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+ <input name="echoStruct">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </input>
+ <output name="echoStructResponse">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </output>
+ </operation>
+ <operation name="echoVoid">
+ <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+ <input name="echoVoid">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </input>
+ <output name="echoVoidResponse">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="WSDLInteropTestDocLitService">
+ <port binding="tns:WSDLInteropTestDocLitPortBinding"
+ name="WSDLInteropTestDocLitPort">
+ <soap:address
+ location="http://mssoapinterop.org/stkv3/wsdl/interopTestDocLit.wsdl"/>
+ <http-conf:client xmlns:http-conf="http://celtix.objectweb.org/transports/http/configuration"
+ AllowChunking="false"/>
+ </port>
+ </service>
+</definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java
new file mode 100644
index 0000000000..bb379c89cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-round2-client/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.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.test.interop.client;
+
+import java.rmi.RemoteException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.soapinterop.wsdl.interop.test.doc.lit.WSDLInteropTestDocLitPortType;
+import org.soapinterop.xsd.ArrayOfstring_literal;
+import org.soapinterop.xsd.SOAPStruct;
+import org.soapinterop.xsd.XsdPackage;
+
+import commonj.sdo.helper.DataFactory;
+
+/**
+ * This test case is part of the tuscany interop tests. This is a reduced version of the SOAPBuilders InteropTest test, document/literal mode. This
+ * version has operations such as echoString, echoArrayOfString and echoStruct.
+ *
+ * <p>
+ * The WSDL for the external service used in this test case can be downloaded from http://www.mssoapinterop.org/stkV3/wsdl/InteropTestDocLit.wsdl.
+ * This is part of the WSDL interop test from Microsoft and more details aobout this test case are found at
+ * http://www.mssoapinterop.org/stkV3/wsdl/WSDLInterop-0118.htm
+ */
+public class InteropTestDocLitTestCase extends TestCase {
+
+ private WSDLInteropTestDocLitPortType doc = null;
+
+ private DataFactory dataFactory;
+
+
+ protected void setUp() throws Exception {
+ setApplicationSCDL(InteropTestDocLit.class, "META-INF/sca/default.scdl");
+ addExtension("test.extensions", InteropTestDocLit.class.getClassLoader().getResource("META-INF/tuscany/extensions/test-extensions.scdl"));
+
+ super.setUp();
+
+ // Get the SDO DataFactory
+ dataFactory = DataFactory.INSTANCE;
+
+ // Locate the service to test
+ doc = locateInteropDocService();
+ }
+
+ /**
+ * Locate the interop service to test
+ *
+ * @return
+ */
+ protected WSDLInteropTestDocLitPortType locateInteropDocService() {
+
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ return compositeContext.locateService(WSDLInteropTestDocLitPortType.class, "RemoteInteropDocService");
+
+ }
+
+ /**
+ * test echo void
+ *
+ * @throws RemoteException
+ */
+ public void testEchoVoid() throws RemoteException {
+ doc.echoVoid();
+ assertTrue(true);
+ }
+
+ /**
+ * test echo string
+ *
+ * @throws RemoteException
+ */
+ public void testEchoString() throws RemoteException {
+ String input = "a test string";
+ String output = doc.echoString(input);
+ assertEquals(input, output);
+ }
+
+ /**
+ * test echo string
+ *
+ * @throws RemoteException
+ */
+ public void testEchoStringArray() throws RemoteException {
+
+ ArrayOfstring_literal input = (ArrayOfstring_literal) dataFactory.create(ArrayOfstring_literal.class);
+ List inStrings = Arrays.asList(new String[] { "petra", "sue" });
+ input.set(XsdPackage.ARRAY_OFSTRING_LITERAL__STRING, inStrings);
+
+ ArrayOfstring_literal output = doc.echoStringArray(input);
+
+ List outStrings = output.getString();
+ assertNotNull(outStrings);
+ assertEquals(2, outStrings.size());
+ assertEquals("petra", outStrings.get(0));
+ assertEquals("sue", outStrings.get(1));
+ }
+
+ /**
+ * test echo struct
+ *
+ * @throws RemoteException
+ */
+ public void testEchoStruct() throws RemoteException {
+ SOAPStruct input = (SOAPStruct) dataFactory.create(SOAPStruct.class);
+ input.setVarInt(200);
+ input.setVarFloat(.002f);
+ input.setVarString("Hello");
+ SOAPStruct output = doc.echoStruct(input);
+ assertEquals(input.getVarInt(), output.getVarInt());
+ assertEquals(input.getVarFloat(), output.getVarFloat());
+ assertEquals(input.getVarString(), output.getVarString());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-service/pom.xml b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/pom.xml
new file mode 100644
index 0000000000..76285e3926
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/pom.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>itest-interop-soap-service</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA WS Interop Service Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+<dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/interopdoc.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noInterfaces>true</noInterfaces>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl/interopdoc.wsdl</wsdlFile>
+ <javaPackage>org.soapinterop</javaPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java
new file mode 100644
index 0000000000..c34941f43e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.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.test.interop.server;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Service;
+import org.soapinterop.ComplexDocument;
+import org.soapinterop.DocTestPortType;
+import org.soapinterop.SimpleDocument1;
+import org.soapinterop.SingleTag;
+
+/**
+ * This class implements the HelloWorld service component.
+ */
+@Service(DocTestPortType.class)
+public class InteropDocServiceComponentImpl implements DocTestPortType {
+
+ public ComplexDocument ComplexDocument(ComplexDocument param2) throws RemoteException {
+ return param2;
+ }
+
+ public SimpleDocument1 SimpleDocument(SimpleDocument1 param0) throws RemoteException {
+ return param0;
+ }
+
+ public SingleTag SingleTag(SingleTag param4) throws RemoteException {
+ return param4;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/resources/wsdl/interopdoc.wsdl b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/resources/wsdl/interopdoc.wsdl
new file mode 100644
index 0000000000..820c26ca34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/resources/wsdl/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-android/itest/interop-soap-service/src/main/webapp/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/webapp/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..3fbc73616e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/webapp/META-INF/sca/default.scdl
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="interop.server">
+
+ <import.sdo location="wsdl/interopdoc.wsdl"/>
+ <!-- import.wsdl wsdlLocation="wsdl/interopdoc.wsdl"/ -->
+
+ <service name="InteropDocService">
+ <!-- interface.wsdl interface="http://soapinterop.org/#wsdl.interface(DocTestPortType)"/ -->
+ <interface.java interface="org.soapinterop.DocTestPortType"/>
+
+ <binding.ws endpoint="http://soapinterop.org/#wsdl.endpoint(interopDocSvc/interopDocPort)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1"
+ location="wsdl/interopdoc.wsdl"
+ />
+
+ <reference>InteropDocServiceComponent/DocTestPortType</reference>
+ </service>
+
+ <component name="InteropDocServiceComponent">
+ <implementation.java class="org.apache.tuscany.test.interop.server.InteropDocServiceComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..8cf95fb789
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,51 @@
+<?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 Interop Test Server</display-name>
+
+ <context-param>
+ <param-name>systemScdlPath</param-name>
+ <param-value>/META-INF/sca/webapp.system.scdl</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>applicationScdlPath</param-name>
+ <param-value>/META-INF/sca/default.scdl</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <display-name>Tuscany Servlet</display-name>
+ <servlet-class>org.apache.tuscany.runtime.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-android/itest/interop-soap-service/t.bat b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/t.bat
new file mode 100755
index 0000000000..0f83dedc37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/interop-soap-service/t.bat
@@ -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.
+
+
+@echo off
+pushd target
+jar -xf ..\apache-tomcat-5.5.17.zip
+popd
+copy target\sample-helloworldws-1.0-SNAPSHOT.war target\apache-tomcat-5.5.17\webapps
+rem pushd target\apache-tomcat-5.5.17\webapps
+rem md sample-helloworldws-1.0-SNAPSHOT
+rem cd sample-helloworldws-1.0-SNAPSHOT
+rem jar -xf ..\sample-helloworldws-1.0-SNAPSHOT.war
+pushd target\apache-tomcat-5.5.17\shared
+rem jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip"
+jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip"
+popd
+rem hack
+mkdir target\apache-tomcat-5.5.17\shared\extension
+copy target\apache-tomcat-5.5.17\shared\lib\axis2-1.0-SNAPSHOT.jar target\apache-tomcat-5.5.17\shared\extension
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-args/pom.xml b/sca-java-1.x/branches/sca-android/itest/jms-args/pom.xml
new file mode 100644
index 0000000000..32ad3099c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-args/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-jms-args</artifactId>
+
+ <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-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- uses ActiveMQ 5.1 as 4.1 Session.createQueue does not work using
+ a temporary queue name -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.1.0</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java
new file mode 100644
index 0000000000..51ce5f4f24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the OneWay service.
+ */
+@Service(MyService.class)
+public class ClientImpl implements MyService {
+
+ private MyService serviceA;
+
+ @Reference
+ public void setServiceA(MyService service) {
+ this.serviceA = service;
+ }
+
+ public void sayHello(String name, String n2) {
+ serviceA.sayHello(name, n2);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.java b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.java
new file mode 100644
index 0000000000..487e5f2cbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/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.binding.jms;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyService {
+
+ @OneWay
+ void sayHello(String name, String n2);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.java
new file mode 100644
index 0000000000..18324d5d1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.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.binding.jms;
+
+
+public class ServiceImpl implements MyService {
+
+ public static Object lock = new Object();
+ public static String name;
+ public static String n2;
+
+ public void sayHello(String name, String n2) {
+ System.out.println("SelectorServiceImpl1 " + name + n2);
+ ServiceImpl.name = name;
+ ServiceImpl.n2 = n2;
+ synchronized (ServiceImpl.lock) {
+ ServiceImpl.lock.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/resources/jndi.properties b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/resources/jndi.properties
new file mode 100644
index 0000000000..bb431a592b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/resources/jndi.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory, ConnectionFactory2
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+topic.ServiceTopic = ServiceTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/resources/selectors/selectors.composite b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/resources/selectors/selectors.composite
new file mode 100644
index 0000000000..74c352934f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-args/src/main/resources/selectors/selectors.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://jms"
+ xmlns:itest="http://jms"
+ name="DefinitionsTests">
+
+ <component name="Client1">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ClientImpl"/>
+ <reference name="serviceA">
+ <binding.jms uri="jms:MyService" />
+ </reference>
+ </component>
+
+ <component name="Service1">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ServiceImpl"/>
+ <service name="MyService">
+ <binding.jms />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-args/src/test/java/org/apache/tuscany/sca/binding/jms/ArgsTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms-args/src/test/java/org/apache/tuscany/sca/binding/jms/ArgsTestCase.java
new file mode 100644
index 0000000000..228366d596
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-args/src/test/java/org/apache/tuscany/sca/binding/jms/ArgsTestCase.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.binding.jms;
+
+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 ArgsTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "selectors/selectors.composite");
+ }
+
+ @Test
+ public void testSayHello() throws Exception {
+ MyService client1 = scaDomain.getService(MyService.class, "Client1");
+
+ client1.sayHello("petra", "beate");
+
+ synchronized(ServiceImpl.lock) {
+ if (ServiceImpl.name == null) {
+ ServiceImpl.lock.wait(5000);
+ }
+ }
+
+ assertEquals("petra", ServiceImpl.name);
+ assertEquals("beate", ServiceImpl.n2);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/pom.xml b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/pom.xml
new file mode 100644
index 0000000000..1dd26c7a41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-jms-callbacks</artifactId>
+ <name>Apache Tuscany SCA JMS Tests for callbacks</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-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- uses ActiveMQ 5.1 as 4.1 Session.createQueue does not work using
+ a temporary queue name -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.1.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java
new file mode 100644
index 0000000000..d4cd5df431
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.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.jms;
+
+
+/**
+ * The client interface
+ */
+public interface JMSClient {
+
+ void aClientMethod();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClientImpl.java b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClientImpl.java
new file mode 100644
index 0000000000..9d75685a8a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClientImpl.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.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Remote Web service client with callback interface
+ */
+@Service(JMSClient.class)
+public class JMSClientImpl implements JMSClient, JMSServiceCallback {
+
+ @Reference protected JMSService myService;
+
+ public static String result;
+ public static Object lock = new Object();
+
+ public void aClientMethod() {
+ System.out.println("aClientMethod " + this + " on thread " + Thread.currentThread());
+ myService.someMethod(" -> someMethod "); // calls the server
+ System.out.println("aClientMethod return from someMethod on thread " + Thread.currentThread());
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("receiveResult " + this + " '" + result + "' on thread " + Thread.currentThread());
+ JMSClientImpl.result = result;
+
+ // wakeup the waiting testcase
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSService.java b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSService.java
new file mode 100644
index 0000000000..9c2c657b55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSService.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.jms;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The remote service that will be invoked by the client
+ */
+@Remotable
+@Callback(JMSServiceCallback.class)
+public interface JMSService {
+
+ @OneWay
+ void someMethod(String arg);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceCallback.java b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceCallback.java
new file mode 100644
index 0000000000..5697d819c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceCallback.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.binding.jms;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The callback interface for {@link JMSService}.
+ */
+@Remotable
+public interface JMSServiceCallback {
+
+ @OneWay
+ void receiveResult(String result);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceImpl.java
new file mode 100644
index 0000000000..b15b40c8a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceImpl.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.jms;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements MyService and uses a callback.
+ */
+@Service(JMSService.class)
+public class JMSServiceImpl implements JMSService {
+
+ private JMSServiceCallback myServiceCallback;
+
+ @Callback
+ public void setMyServiceCallback(JMSServiceCallback myServiceCallback) {
+ System.out.println("setMyServiceCallback on thread " + Thread.currentThread() + " cb: " + myServiceCallback);
+ this.myServiceCallback = myServiceCallback;
+ }
+
+ public void someMethod(String arg) {
+ System.out.println("someMethod '" + arg + "' on thread " + Thread.currentThread());
+ try {
+ myServiceCallback.receiveResult(arg + " -> receiveResult ");
+ } catch(Exception e) {
+ System.out.println("RuntimeException invoking receiveResult: " + e.toString());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/jndi.properties b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/jndi.properties
new file mode 100644
index 0000000000..608fe747f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/jndi.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.ServiceQueue = ServiceQueue
+queue.CallbackQueue = CallbackQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/simple/client.composite b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/simple/client.composite
new file mode 100644
index 0000000000..93d8acb65b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/simple/client.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"
+ targetNamespace="http://jms"
+ name="CallbackClientComposite">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.JMSClientImpl" />
+ <reference name="myService">
+ <binding.jms uri="jms:ServiceQueue"/>
+ <callback>
+ <binding.jms uri="jms:CallbackQueue"/>
+ </callback>
+ </reference>
+ </component>
+
+ <component name="ServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.JMSServiceImpl" />
+ <service name="JMSService">
+ <binding.jms uri="jms:ServiceQueue"/>
+ <callback>
+ <binding.jms uri="jms:CallbackQueue"/>
+ </callback>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/simple/tempq.composite b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/simple/tempq.composite
new file mode 100644
index 0000000000..636e951d03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/main/resources/simple/tempq.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"
+ targetNamespace="http://jms"
+ name="CallbackClientComposite">
+
+<!--
+
+The client component does not define the callback destination so a temporary queue should be used
+
+-->
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.JMSClientImpl" />
+ <reference name="myService">
+ <binding.jms uri="jms:ServiceQueue"/>
+ <callback>
+ <binding.jms />
+ </callback>
+ </reference>
+ </component>
+
+ <component name="ServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.JMSServiceImpl" />
+ <service name="JMSService">
+ <binding.jms uri="jms:ServiceQueue"/>
+ <callback>
+ <binding.jms />
+ </callback>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/CallbackTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/CallbackTestCase.java
new file mode 100644
index 0000000000..cb9acb1bc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/CallbackTestCase.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.jms;
+
+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;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class CallbackTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ JMSClient client = scaDomain.getService(JMSClient.class, "ClientComponent");
+
+ client.aClientMethod();
+
+ // wait for up to 5 seconds but should wake up as soon as done
+ synchronized(JMSClientImpl.lock) {
+ JMSClientImpl.lock.wait(5000);
+ }
+
+ assertEquals(" -> someMethod -> receiveResult ", JMSClientImpl.result);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/TempCallbackQTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/TempCallbackQTestCase.java
new file mode 100644
index 0000000000..9f450574df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/TempCallbackQTestCase.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.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.MalformedURLException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class TempCallbackQTestCase {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void init() throws MalformedURLException {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/tempq.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ JMSClient client = scaDomain.getService(JMSClient.class, "ClientComponent");
+
+ client.aClientMethod();
+
+ // wait for up to 5 seconds but should wake up as soon as done
+ synchronized (JMSClientImpl.lock) {
+ JMSClientImpl.lock.wait(5000);
+ }
+
+ assertEquals(" -> someMethod -> receiveResult ", JMSClientImpl.result);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-definitions/pom.xml b/sca-java-1.x/branches/sca-android/itest/jms-definitions/pom.xml
new file mode 100644
index 0000000000..a142978fde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-definitions/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-jms-definitions</artifactId>
+ <name>Apache Tuscany SCA JMS Tests for properties</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-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- uses ActiveMQ 5.1 as 4.1 Session.createQueue does not work using
+ a temporary queue name -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.1.0</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
new file mode 100644
index 0000000000..4d00d2df0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the OneWay service.
+ */
+@Service(OneWayService.class)
+public class OneWayClientImpl implements OneWayService {
+
+ private OneWayService serviceA;
+
+ @Reference
+ public void setServiceA(OneWayService service) {
+ this.serviceA = service;
+ }
+
+ public void sayHello(String name) {
+ serviceA.sayHello(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
new file mode 100644
index 0000000000..377f227ceb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.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.jms;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface OneWayService {
+
+ @OneWay
+ void sayHello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
new file mode 100644
index 0000000000..6b763874df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.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.jms;
+
+public class OneWayServiceImpl implements OneWayService {
+
+ public static Object lock = new Object();
+ public static String name;
+
+ public void sayHello(String name) {
+ OneWayServiceImpl.name = name;
+ synchronized (OneWayServiceImpl.lock) {
+ OneWayServiceImpl.lock.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..ff389c7014
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/definitions.xml
@@ -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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:itest="http://jms"
+ targetNamespace="http://jms" >
+
+ <binding.jms name="itest:TestService" >
+ <destination name="MyServiceQueue" create="never"/>
+ <connectionFactory name="MyConnectionFactory"/>
+ </binding.jms>
+
+ </definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/definitions/definitions.composite b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/definitions/definitions.composite
new file mode 100644
index 0000000000..99e4e5016e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/definitions/definitions.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://jms"
+ xmlns:itest="http://jms"
+ name="DefinitionsTests">
+
+ <component name="OneWayClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayClientImpl"/>
+ <reference name="serviceA">
+ <binding.jms requestConnection="itest:TestService" />
+ </reference>
+ </component>
+
+ <component name="OneWayService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <binding.jms requestConnection="itest:TestService" />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/jndi.properties b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/jndi.properties
new file mode 100644
index 0000000000..f7555e0beb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/main/resources/jndi.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = MyConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.MyServiceQueue= MyServiceQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/test/java/org/apache/tuscany/sca/binding/jms/DefinitionsTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/test/java/org/apache/tuscany/sca/binding/jms/DefinitionsTestCase.java
new file mode 100644
index 0000000000..9de3bff7c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-definitions/src/test/java/org/apache/tuscany/sca/binding/jms/DefinitionsTestCase.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.binding.jms;
+
+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 DefinitionsTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "definitions/definitions.composite");
+ }
+
+ @Test
+ public void testSayHello() throws Exception {
+ OneWayService client = scaDomain.getService(OneWayService.class, "OneWayClient");
+
+ client.sayHello("petra");
+
+ // wait for up to 5 seconds but should wake up as soon as done
+ synchronized(OneWayServiceImpl.lock) {
+ if (OneWayServiceImpl.name == null) {
+ OneWayServiceImpl.lock.wait(5000);
+ }
+ }
+
+ assertEquals("petra", OneWayServiceImpl.name);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-selectors/pom.xml b/sca-java-1.x/branches/sca-android/itest/jms-selectors/pom.xml
new file mode 100644
index 0000000000..2a39634927
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-selectors/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-jms-selectors</artifactId>
+ <name>Apache Tuscany SCA JMS Tests for selectors</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-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- uses ActiveMQ 5.1 as 4.1 Session.createQueue does not work using
+ a temporary queue name -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.1.0</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java
new file mode 100644
index 0000000000..0ad6440593
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the OneWay service.
+ */
+@Service(SelectorService.class)
+public class ClientImpl implements SelectorService {
+
+ private SelectorService serviceA;
+
+ @Reference
+ public void setServiceA(SelectorService service) {
+ this.serviceA = service;
+ }
+
+ public void sayHello(String name) {
+ serviceA.sayHello(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorService.java b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorService.java
new file mode 100644
index 0000000000..f26a3ce68b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorService.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.jms;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface SelectorService {
+
+ @OneWay
+ void sayHello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl1.java b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl1.java
new file mode 100644
index 0000000000..fb53c877e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl1.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.jms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SelectorServiceImpl1 implements SelectorService {
+
+ public static Object lock = new Object();
+ public static List<String> names = new ArrayList<String>();
+
+ public void sayHello(String name) {
+ System.out.println("SelectorServiceImpl1 " + name);
+ SelectorServiceImpl1.names.add(name);
+ if (names.size() == 2) {
+ synchronized (SelectorServiceImpl1.lock) {
+ SelectorServiceImpl1.lock.notify();
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl2.java b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl2.java
new file mode 100644
index 0000000000..1bbaf5d6f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl2.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.binding.jms;
+
+public class SelectorServiceImpl2 implements SelectorService {
+
+ public static Object lock = new Object();
+ public static String name;
+
+ public void sayHello(String name) {
+ if (SelectorServiceImpl2.name != null) {
+ throw new IllegalStateException("name already set");
+ }
+ System.out.println("SelectorServiceImpl2 " + name);
+ SelectorServiceImpl2.name = name;
+ synchronized (SelectorServiceImpl2.lock) {
+ SelectorServiceImpl2.lock.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl3.java b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl3.java
new file mode 100644
index 0000000000..4bdc4edcb5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl3.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.binding.jms;
+
+public class SelectorServiceImpl3 implements SelectorService {
+
+ public static Object lock = new Object();
+ public static String name;
+
+ public void sayHello(String name) {
+ if (SelectorServiceImpl3.name != null) {
+ throw new IllegalStateException("name already set");
+ }
+ System.out.println("SelectorServiceImpl3 " + name);
+ SelectorServiceImpl3.name = name;
+ synchronized (SelectorServiceImpl3.lock) {
+ SelectorServiceImpl3.lock.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/resources/jndi.properties b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/resources/jndi.properties
new file mode 100644
index 0000000000..bb431a592b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/resources/jndi.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory, ConnectionFactory2
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+topic.ServiceTopic = ServiceTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/resources/selectors/selectors.composite b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/resources/selectors/selectors.composite
new file mode 100644
index 0000000000..83fb50531b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/main/resources/selectors/selectors.composite
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://jms"
+ xmlns:itest="http://jms"
+ name="DefinitionsTests">
+
+ <component name="Client1">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ClientImpl"/>
+ <reference name="serviceA">
+ <binding.jms uri="jms:ServiceTopic" >
+ <headers JMSType="type1" />
+ </binding.jms>
+ </reference>
+ </component>
+
+ <component name="Client2">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ClientImpl"/>
+ <reference name="serviceA">
+ <binding.jms uri="jms:ServiceTopic" >
+ <headers JMSType="type2" />
+ </binding.jms>
+ </reference>
+ </component>
+
+ <component name="Service1">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.SelectorServiceImpl1"/>
+ <service name="SelectorService">
+ <binding.jms uri="jms:ServiceTopic" />
+ </service>
+ </component>
+
+ <component name="Service2">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.SelectorServiceImpl2"/>
+ <service name="SelectorService">
+ <binding.jms uri="jms:ServiceTopic" >
+ <SubscriptionHeaders JMSSelector="JMSType = 'type1'"/>
+ </binding.jms>
+ </service>
+ </component>
+
+ <component name="Service3">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.SelectorServiceImpl3"/>
+ <service name="SelectorService">
+ <binding.jms uri="jms:ServiceTopic" >
+ <SubscriptionHeaders JMSSelector="JMSType = 'type2'"/>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/test/java/org/apache/tuscany/sca/binding/jms/SelectorsTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/test/java/org/apache/tuscany/sca/binding/jms/SelectorsTestCase.java
new file mode 100644
index 0000000000..ea548c22e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms-selectors/src/test/java/org/apache/tuscany/sca/binding/jms/SelectorsTestCase.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.jms;
+
+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 SelectorsTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "selectors/selectors.composite");
+ }
+
+ @Test
+ public void testSayHello() throws Exception {
+ SelectorService client1 = scaDomain.getService(SelectorService.class, "Client1");
+ SelectorService client2 = scaDomain.getService(SelectorService.class, "Client2");
+
+ client1.sayHello("petra");
+ client2.sayHello("beate");
+
+ // wait for up to 5 seconds but should wake up as soon as done
+ synchronized(SelectorServiceImpl2.lock) {
+ if (SelectorServiceImpl2.name == null) {
+ SelectorServiceImpl2.lock.wait(5000);
+ }
+ }
+ synchronized(SelectorServiceImpl3.lock) {
+ if (SelectorServiceImpl3.name == null) {
+ SelectorServiceImpl3.lock.wait(5000);
+ }
+ }
+ synchronized(SelectorServiceImpl1.lock) {
+ if (SelectorServiceImpl1.names.size() != 2) {
+ SelectorServiceImpl1.lock.wait(5000);
+ }
+ }
+
+ assertEquals("petra", SelectorServiceImpl2.name);
+ assertEquals("beate", SelectorServiceImpl3.name);
+ assertEquals(2, SelectorServiceImpl1.names.size());
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/pom.xml b/sca-java-1.x/branches/sca-android/itest/jms/pom.xml
new file mode 100644
index 0000000000..0630174ace
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-jms</artifactId>
+ <name>Apache Tuscany SCA JMS Tests</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-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java
new file mode 100644
index 0000000000..7b1c63d437
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.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.jms;
+
+public class CheckedExcpetion extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public CheckedExcpetion(String s) {
+ super(s);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java
new file mode 100644
index 0000000000..46bf911def
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.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.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExceptionService {
+
+ public void throwChecked() throws CheckedExcpetion;
+
+ public void throwUnChecked();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java
new file mode 100644
index 0000000000..cd3c09e17f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(ExceptionService.class)
+public class ExceptionServiceClient implements ExceptionService {
+
+ private ExceptionService service;
+
+ @Reference
+ public void setService(ExceptionService service) {
+ this.service = service;
+ }
+
+ public void throwChecked() throws CheckedExcpetion {
+ service.throwChecked();
+ }
+
+ public void throwUnChecked() {
+ service.throwUnChecked();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java
new file mode 100644
index 0000000000..ab293a5df1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.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.binding.jms;
+
+public class ExceptionServiceImpl implements ExceptionService {
+
+ public void throwChecked() throws CheckedExcpetion {
+ throw new CheckedExcpetion("foo");
+ }
+
+ public void throwUnChecked() {
+ throw new RuntimeException("bla");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java
new file mode 100644
index 0000000000..86d4719646
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldClientImpl implements HelloWorldService {
+
+ private HelloWorldService serviceA;
+
+ @Reference
+ public void setServiceA(HelloWorldService service) {
+ this.serviceA = service;
+ }
+
+ public String sayHello(String name) {
+ return serviceA.sayHello(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java
new file mode 100644
index 0000000000..abb29aec4c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldService {
+ String sayHello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..21d2de2cf0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.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.jms;
+
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ public String sayHello(String name) {
+ if ("bang".equals(name)) {
+ throw new RuntimeException("blem wit");
+ }
+ return "jmsHello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java
new file mode 100644
index 0000000000..d4cd5df431
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.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.jms;
+
+
+/**
+ * The client interface
+ */
+public interface JMSClient {
+
+ void aClientMethod();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java
new file mode 100644
index 0000000000..464072b42d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.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.jms;
+
+
+/**
+ * The client interface
+ */
+public interface MsgClient {
+
+ void aClientMethod();
+ void op2();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java
new file mode 100644
index 0000000000..b4d1cbccda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(MsgClient.class)
+public class MsgClientImpl implements MsgClient {
+
+ @Reference protected MsgClientService myService;
+
+ public void aClientMethod() {
+ myService.aClientMethod();
+ }
+
+ public void op2() {
+ myService.op2();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java
new file mode 100644
index 0000000000..e8242467cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.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.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The client interface
+ */
+@Remotable
+public interface MsgClientService {
+
+ void aClientMethod();
+
+ void op2();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java
new file mode 100644
index 0000000000..d376d74295
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.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.binding.jms;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Remotable;
+
+
+@Remotable
+@AllowsPassByReference
+public interface MsgService {
+
+ void onMessage(javax.jms.Message msg);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java
new file mode 100644
index 0000000000..142343e349
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.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.binding.jms;
+
+import javax.jms.Message;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(MsgService.class)
+public class MsgServiceImpl implements MsgService {
+
+ public static Object lock = new Object();
+ public static Message msg;
+
+ public void onMessage(Message msg) {
+ MsgServiceImpl.msg = msg;
+ synchronized(lock) {
+ lock.notifyAll();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
new file mode 100644
index 0000000000..218cccf64c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the OneWay service.
+ */
+@Service(OneWayService.class)
+public class OneWayClientImpl implements OneWayService {
+
+ private OneWayService serviceA;
+
+ @Reference
+ public void setServiceA(OneWayService service) {
+ this.serviceA = service;
+ }
+
+ public void sayHello(String name) {
+ serviceA.sayHello(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java
new file mode 100644
index 0000000000..9795089952
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.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.jms;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface OneWayObjectService {
+
+ @OneWay
+ void sayHello(Object name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java
new file mode 100644
index 0000000000..25a89fc5b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.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.jms;
+
+public class OneWayObjectServiceImpl implements OneWayObjectService {
+
+ public static Object mutex = new Object();
+ public static Object name;
+
+ public void sayHello(Object name) {
+ OneWayObjectServiceImpl.name = name;
+ synchronized (OneWayObjectServiceImpl.mutex) {
+ OneWayObjectServiceImpl.mutex.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
new file mode 100644
index 0000000000..f16f853ba7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.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.jms;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface OneWayService {
+
+ @OneWay
+ void sayHello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
new file mode 100644
index 0000000000..bff4536fa0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.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.jms;
+
+public class OneWayServiceImpl implements OneWayService {
+
+ public static Object mutex = new Object();
+ public static String name;
+
+ public void sayHello(String name) {
+ OneWayServiceImpl.name = name;
+ synchronized (OneWayServiceImpl.mutex) {
+ OneWayServiceImpl.mutex.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java
new file mode 100644
index 0000000000..cfe7a649d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.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.jms;
+
+import javax.jms.Message;
+import javax.jms.Session;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.provider.XMLTextMessageProcessor;
+
+public class TestMessageProcessor extends XMLTextMessageProcessor {
+
+ public static boolean insertPayloadIntoJMSMessageCalled;
+ public static boolean extractPayloadFromJMSMessageCalled;
+ public static boolean setOperationNameCalled;
+
+ public TestMessageProcessor(JMSBinding jmsBinding) {
+ super(jmsBinding);
+ }
+ public Object extractPayloadFromJMSMessage(Message message) {
+ extractPayloadFromJMSMessageCalled = true;
+ return super.extractPayloadFromJMSMessage(message);
+ }
+
+ public String getOperationName(Message message) {
+ // is this used?
+ return super.getOperationName(message);
+ }
+
+ public Message insertPayloadIntoJMSMessage(Session session, Object payload) {
+ insertPayloadIntoJMSMessageCalled = true;
+ return super.insertPayloadIntoJMSMessage(session, payload);
+ }
+
+ public void setOperationName(String operationName, Message message) {
+ setOperationNameCalled = true;
+ super.setOperationName(operationName, message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/defaults/client.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/defaults/client.composite
new file mode 100644
index 0000000000..991b0cf11b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/defaults/client.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="DefaultClientComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms uri="jms:HelloWorldService" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/defaults/service.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/defaults/service.composite
new file mode 100644
index 0000000000..3f299bc787
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/defaults/service.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"
+ name="DefaultServiceComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/dynamic/client.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/dynamic/client.composite
new file mode 100644
index 0000000000..afa4135f1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/dynamic/client.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"
+ name="DynamicComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms>
+ <destination name="DestQueueA"/>
+ <!-- No response destination defined means a temporary queue will be used -->
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/exceptions/client.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/exceptions/client.composite
new file mode 100644
index 0000000000..8bb7f86252
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/exceptions/client.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="ExceptionClientComposite">
+
+ <component name="ExceptionServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ExceptionServiceClient"/>
+ <reference name="service" />
+ </component>
+
+ <reference name="service" promote="ExceptionServiceClient/service">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.ExceptionService" />
+ <binding.jms uri="jms:ExceptionService" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/exceptions/service.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/exceptions/service.composite
new file mode 100644
index 0000000000..052ff9d985
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/exceptions/service.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"
+ name="ExceptionServiceComposite">
+
+ <component name="ExceptionService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ExceptionServiceImpl"/>
+ <service name="ExceptionService">
+ <binding.jms />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/external/client.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/external/client.composite
new file mode 100644
index 0000000000..7a0013be4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/external/client.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="ExternalClientComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/external/service.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/external/service.composite
new file mode 100644
index 0000000000..b9f33e5afc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/external/service.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"
+ name="ExternalServiceComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/jndi.properties b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/jndi.properties
new file mode 100644
index 0000000000..9abdff215d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/jndi.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.RequestQueue = RequestQueue
+queue.ResponseQueue = ResponseQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/nonSCAclient/service.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/nonSCAclient/service.composite
new file mode 100644
index 0000000000..1baa4af6b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/nonSCAclient/service.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="ServiceComposite">
+
+ <component name="DefaultService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61618"
+ messageProcessor="XMLTextMessage">
+ </binding.jms>
+ </service>
+ </component>
+
+ <component name="TextService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61618"
+ messageProcessor="TextMessage"
+ uri="jms:TextDest" />
+ </service>
+ </component>
+
+ <component name="ObjectService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayObjectServiceImpl"/>
+ <service name="OneWayObjectService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61618"
+ messageProcessor="ObjectMessage"
+ uri="jms:ObjectDest" />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/oneway/OneWayClient.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/oneway/OneWayClient.composite
new file mode 100644
index 0000000000..bed0663f58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/oneway/OneWayClient.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"
+ name="OneWayClientComposite">
+
+ <component name="OneWayClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="OneWayClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.OneWayService" />
+ <binding.jms>
+ <destination name="DestQueueA"/>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/oneway/OneWayService.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/oneway/OneWayService.composite
new file mode 100644
index 0000000000..3d08de7d51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/oneway/OneWayService.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="OneWayServiceComposite">
+
+ <component name="OneWayService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <binding.jms>
+ <destination name="DestQueueA" create="always"/>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/properties/properties.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/properties/properties.composite
new file mode 100644
index 0000000000..43bd611b24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/properties/properties.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"
+ targetNamespace="http://jms"
+ name="PropertiesClientComposite">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.MsgClientImpl" />
+ <reference name="myService">
+ <binding.jms uri="jms:ServiceQueue">
+ <headers JMSType="myType"
+ JMSCorrelationID="xyz"
+ JMSDeliveryMode="PERSISTENT"
+ JMSTimeToLive="4321"
+ JMSPriority="7">
+ <property name="headP1">myHeadP1</property>
+ </headers>
+ <operationProperties name="op2" nativeOperation="nativeOp2">
+ <headers JMSType="op2Type"
+ JMSCorrelationID="op2CID"
+ JMSDeliveryMode="NON_PERSISTENT"
+ JMSTimeToLive="6"
+ JMSPriority="8">
+ <property name="op2P2">foo</property>
+ </headers>
+ </operationProperties>
+ </binding.jms>
+ </reference>
+ </component>
+
+ <component name="ServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.MsgServiceImpl" />
+ <service name="MsgService">
+ <binding.jms uri="jms:ServiceQueue"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/client.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/client.composite
new file mode 100644
index 0000000000..3e16e794cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/client.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="SimpleClientComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms>
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/mpclient.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/mpclient.composite
new file mode 100644
index 0000000000..69c0ef305e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/mpclient.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="MPClientComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms messageProcessor="org.apache.tuscany.sca.binding.jms.TestMessageProcessor">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/service.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/service.composite
new file mode 100644
index 0000000000..2ab92923f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/service.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"
+ name="SimpleServiceComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms>
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/uriclient.composite b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/uriclient.composite
new file mode 100644
index 0000000000..83ef9c3c95
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/main/resources/simple/uriclient.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="URIClientComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms uri="jms:DestQueueA" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java
new file mode 100644
index 0000000000..dca9386637
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.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.jms;
+
+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;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class DefaultsTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "defaults/client.composite", "defaults/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java
new file mode 100644
index 0000000000..f4750e5453
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.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.jms;
+
+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;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class DynamicReplyQTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "dynamic/client.composite", "simple/service.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Beate", helloWorldService.sayHello("Beate"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
new file mode 100644
index 0000000000..ba3e697e13
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.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.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class ExceptionsTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "exceptions/client.composite", "exceptions/service.composite");
+ }
+
+ @Test
+ @Ignore // TUSCANY-2593, currently fails for some jaxws reason?
+ public void testChecked() {
+ ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient");
+ try {
+ service.throwChecked();
+ fail();
+ } catch (CheckedExcpetion e) {
+ assertEquals("foo", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testUnChecked() {
+ ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient");
+ try {
+ service.throwUnChecked();
+ fail();
+ } catch (Exception e) {
+ assertEquals("bla", e.getCause().getCause().getMessage());
+ }
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java
new file mode 100644
index 0000000000..c34ad07901
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.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.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests using the JMS binding with an external JMS broker
+ */
+public class ExternalBrokerTestCase {
+
+ private static SCADomain scaDomain;
+ private BrokerService broker;
+
+ @Before
+ public void init() throws Exception {
+ startBroker();
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "external/client.composite", "external/service.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ stopBroker();
+ }
+
+ protected void startBroker() throws Exception {
+ broker = new BrokerService();
+ broker.setPersistent(false);
+ broker.setUseJmx(false);
+ broker.addConnector("tcp://localhost:61616");
+ broker.start();
+ }
+ protected void stopBroker() throws Exception {
+ if (broker != null) {
+ broker.stop();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
new file mode 100644
index 0000000000..9ec77ca440
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.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.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class MessageProcessorTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "simple/mpclient.composite", "simple/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ assertTrue(TestMessageProcessor.extractPayloadFromJMSMessageCalled);
+ assertTrue(TestMessageProcessor.insertPayloadIntoJMSMessageCalled);
+ assertTrue(TestMessageProcessor.setOperationNameCalled);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java
new file mode 100644
index 0000000000..55e5a84c1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class NonSCAClientTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() throws Exception {
+ startBroker();
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "nonSCAclient/service.composite");
+ OneWayServiceImpl.name = null;
+ }
+
+ @Test
+ public void testXMLText() throws Exception {
+
+ synchronized (OneWayServiceImpl.mutex) {
+
+ sendTextMessage("dynamicQueues/OneWayService", "<ns2:sayHello xmlns:ns2=\"http://jms.binding.sca.tuscany.apache.org/\"><arg0>Petra</arg0></ns2:sayHello>");
+
+ // wait up to 10 seconds but it will likely be a lot less
+ // as the service invocation will wake this up earlier
+ if (OneWayServiceImpl.name == null) {
+ OneWayServiceImpl.mutex.wait(10000);
+ }
+ }
+ assertEquals("Petra", OneWayServiceImpl.name);
+ }
+
+ @Test
+ public void testText() throws Exception {
+
+ synchronized (OneWayServiceImpl.mutex) {
+
+ sendTextMessage("dynamicQueues/TextDest", "Petra");
+
+ // wait up to 10 seconds but it will likely be a lot less
+ // as the service invocation will wake this up earlier
+ OneWayServiceImpl.mutex.wait(10000);
+ }
+ assertEquals("Petra", OneWayServiceImpl.name);
+ }
+
+ @Test
+ public void testObject() throws Exception {
+
+ Set<Integer> arg = new HashSet<Integer>();
+ arg.add(new Integer(3));
+
+ synchronized (OneWayObjectServiceImpl.mutex) {
+
+ sendObjectMessage("dynamicQueues/ObjectDest", arg);
+
+ // wait up to 10 seconds but it will likely be a lot less
+ // as the service invocation will wake this up earlier
+ OneWayObjectServiceImpl.mutex.wait(10000);
+ }
+ assertEquals(arg, OneWayObjectServiceImpl.name);
+ }
+
+ @After
+ public void end() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ stopBroker();
+ }
+
+ private BrokerService broker;
+ protected void startBroker() throws Exception {
+ broker = new BrokerService();
+ broker.setPersistent(false);
+ broker.setUseJmx(false);
+ broker.addConnector("tcp://localhost:61618");
+ broker.start();
+ }
+ protected void stopBroker() throws Exception {
+ if (broker != null) {
+ broker.stop();
+ }
+ }
+
+ protected static void sendTextMessage(String destName, String payload) throws JMSException, NamingException {
+ JMSResourceFactory rf = new JMSResourceFactory(null, null, "tcp://localhost:61618");
+ Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer p = session.createProducer(rf.lookupDestination(destName));
+ rf.getConnection().start();
+ session.run();
+ p.send(session.createTextMessage(payload));
+ rf.closeConnection();
+ }
+
+ protected static void sendObjectMessage(String destName, Object payload) throws JMSException, NamingException {
+ JMSResourceFactory rf = new JMSResourceFactory(null, null, "tcp://localhost:61618");
+ Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer p = session.createProducer(rf.lookupDestination(destName));
+ rf.getConnection().start();
+ session.run();
+ p.send(session.createObjectMessage((Serializable)payload));
+ rf.closeConnection();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
new file mode 100644
index 0000000000..26dda13cf9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.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.jms;
+
+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;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class OneWayTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "oneway/OneWayClient.composite", "oneway/OneWayService.composite");
+ }
+
+ @Test
+ public void testOneWayInvoked() throws Exception {
+ OneWayService oneWayService = scaDomain.getService(OneWayService.class, "OneWayClient");
+ oneWayService.sayHello("Petra");
+ synchronized (OneWayServiceImpl.mutex) {
+ // wait up to 10 seconds but it will likely be a lot less
+ // as the service invocation will wake this up earlier
+ OneWayServiceImpl.mutex.wait(10000);
+ }
+ assertEquals("Petra", OneWayServiceImpl.name);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java
new file mode 100644
index 0000000000..4cc229422e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.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.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import javax.jms.DeliveryMode;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ */
+public class PropertiesTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "properties/properties.composite");
+ }
+
+ @Test
+ public void testProps1() throws Exception {
+ JMSClient client = scaDomain.getService(JMSClient.class, "ClientComponent");
+
+ client.aClientMethod();
+
+ // wait for up to 5 seconds but should wake up as soon as done
+ synchronized(MsgServiceImpl.lock) {
+ if (MsgServiceImpl.msg == null) {
+ MsgServiceImpl.lock.wait(5000);
+ }
+ }
+ assertNotNull(MsgServiceImpl.msg);
+
+ assertEquals("myType", MsgServiceImpl.msg.getJMSType());
+ assertEquals("xyz", MsgServiceImpl.msg.getJMSCorrelationID());
+ assertEquals(DeliveryMode.PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode());
+ // assertEquals(3, MsgServiceImpl.msg.getJMSPriority()); // Doesn't seem to work with ActiveMQ
+ assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1"));
+ }
+
+ @Test
+ public void testOp2() throws Exception {
+ MsgClient client = scaDomain.getService(MsgClient.class, "ClientComponent");
+
+ client.op2();
+
+ // wait for up to 5 seconds but should wake up as soon as done
+ synchronized(MsgServiceImpl.lock) {
+ if (MsgServiceImpl.msg == null) {
+ MsgServiceImpl.lock.wait(5000);
+ }
+ }
+ assertNotNull(MsgServiceImpl.msg);
+
+ assertEquals("op2Type", MsgServiceImpl.msg.getJMSType());
+ assertEquals("op2CID", MsgServiceImpl.msg.getJMSCorrelationID());
+ // assertEquals(DeliveryMode.NON_PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode()); // Doesn't seem to work with ActiveMQ
+ // assertEquals(3, MsgServiceImpl.msg.getJMSPriority()); // Doesn't seem to work with ActiveMQ
+ assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1"));
+ assertEquals("foo", MsgServiceImpl.msg.getStringProperty("op2P2"));
+ assertEquals("nativeOp2", MsgServiceImpl.msg.getStringProperty("scaOperationName"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java
new file mode 100644
index 0000000000..c1882a1e26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.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.jms;
+
+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;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class RPCTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "simple/client.composite", "simple/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java
new file mode 100644
index 0000000000..bed5515d7f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.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.jms;
+
+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;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class URIRPCTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "simple/uriclient.composite", "simple/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/pom.xml b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/pom.xml
new file mode 100644
index 0000000000..64aba086cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/pom.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-large-sdo-ws</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Web Service with Large SDO Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <!-- Declare tuscany-host-tomcat dependency in the default profile so that it can be replaced -->
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <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-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.1.1</version>
+ <executions>
+ <execution>
+ <id>generate-ifx-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/wsdl/IFX170_XSD.xsd</fileName>
+ <noNotification>true</noNotification>
+ </configuration>
+ </schemaFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java
new file mode 100644
index 0000000000..f5a8830c4a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.trninq;
+
+import java.rmi.RemoteException;
+
+import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TrnInqClient implements TrninqInterface {
+
+ //service interface
+ private TrninqInterface transactionInquiryService;
+
+ // setting service interface
+ public void setTransactionInquiryService(TrninqInterface transactionInquiryService) {
+ this.transactionInquiryService = transactionInquiryService;
+ }
+
+ public DepAcctTrnInqRs_Type DepAcctTrnInq(DepAcctTrnInqRq_Type req) throws RemoteException {
+ return transactionInquiryService.DepAcctTrnInq(req);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.java b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.java
new file mode 100644
index 0000000000..14da53cf98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.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.itest.trninq;
+
+import java.rmi.RemoteException;
+import java.util.List;
+
+import org.ifxforum.xsd._1.AdditionalStatus_Type;
+import org.ifxforum.xsd._1.BankAcctTrnRec_Type;
+import org.ifxforum.xsd._1.BillerId_Type;
+import org.ifxforum.xsd._1.BillerPayee_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type;
+import org.ifxforum.xsd._1.DepAcctTrnRec_Type;
+import org.ifxforum.xsd._1._1Factory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TrnInqService implements TrninqInterface {
+
+ public DepAcctTrnInqRs_Type DepAcctTrnInq(DepAcctTrnInqRq_Type req) throws RemoteException {
+
+ DepAcctTrnInqRs_Type response = _1Factory.INSTANCE.createDepAcctTrnInqRs_Type();
+
+ response.setStatus(_1Factory.INSTANCE.createStatus_Type());
+ response.getStatus().setStatusCode(1);
+ response.getStatus().setStatusDesc("the description associated with the code 1");
+ AdditionalStatus_Type addStatus = _1Factory.INSTANCE.createAdditionalStatus_Type();
+ addStatus.setServerStatusCode("STATUS_OK");
+ addStatus.setSeverity("SEVERITY_WARNING");
+ response.getStatus().getAdditionalStatus().add(addStatus);
+
+ response.setDepAcctId(_1Factory.INSTANCE.createDepAcctId_Type());
+ response.getDepAcctId().setBankInfo(_1Factory.INSTANCE.createBankInfo_Type());
+ response.getDepAcctId().getBankInfo().setBranchId("Concord_1");
+ response.getDepAcctId().getBankInfo().setBankId("Dufferin hill");
+ response.getDepAcctId().getBankInfo().setBankIdType("Concord branch");
+ response.getDepAcctId().getBankInfo().setBranchName("A Happy branch");
+ response.getDepAcctId().getBankInfo().setCity("Toronto");
+
+ response.getDepAcctId().getBankInfo().setCountry("Canada");
+ response.getDepAcctId().getBankInfo().setName("Info for A Happy branch");
+ response.getDepAcctId().getBankInfo().setPostalCode("L1LL1L");
+ response.getDepAcctId().getBankInfo().setStateProv("ON");
+
+ List records = response.getDepAcctTrnRec();
+ // Record1
+ DepAcctTrnRec_Type trnRec1 = null;
+ BankAcctTrnRec_Type baTrnRec1 = null;
+ long maxRec = req.getTrnCountLimit().getCount();
+ for (int i = 0; i < maxRec; i++) {
+ trnRec1 = _1Factory.INSTANCE.createDepAcctTrnRec_Type();
+ baTrnRec1 = _1Factory.INSTANCE.createBankAcctTrnRec_Type();
+
+ trnRec1.setBankAcctTrnRec(baTrnRec1);
+ trnRec1.getBankAcctTrnRec().setCSPRefId("CSPRefId1");
+ trnRec1.getBankAcctTrnRec().setPostedDt("1");
+ trnRec1.getBankAcctTrnRec().setOrigDt("1");
+ trnRec1.getBankAcctTrnRec().setBillRefInfo("aaaa");
+
+ trnRec1.getBankAcctTrnRec().setTrnType("1");
+
+ trnRec1.getBankAcctTrnRec().setCurAmt(_1Factory.INSTANCE.createCurrencyAmount());
+ trnRec1.getBankAcctTrnRec().getCurAmt().setAmt(new java.math.BigDecimal(2000.35));
+ trnRec1.getBankAcctTrnRec().getCurAmt().setCurCode("100");
+
+ trnRec1.setStmtRunningBal(_1Factory.INSTANCE.createCurrencyAmount());
+ trnRec1.getStmtRunningBal().setAmt(new java.math.BigDecimal("1345.55"));
+
+ trnRec1.getBankAcctTrnRec().setCustPayeeInfo(_1Factory.INSTANCE.createCustPayeeInfo_Type());
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setBillingAcct("000601832");
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setAcctPayAcctId("12");
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setName("John Doe");
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setNickname("Jody");
+
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setBillerPayee(_1Factory.INSTANCE.createBillerPayee_Type());
+ BillerPayee_Type BillerP = trnRec1.getBankAcctTrnRec().getCustPayeeInfo().getBillerPayee();
+
+ BillerP.setBillerId(_1Factory.INSTANCE.createBillerId_Type());
+ BillerId_Type BId = BillerP.getBillerId();
+
+ BId.setBillerNum("123");
+ BId.setSPName("SomeName");
+
+ trnRec1.setAvailDt("sss");
+ trnRec1.setPmtId("SomeID");
+ trnRec1.setXferId("SomeOtherID");
+
+ records.add(trnRec1);
+ }
+
+ return response;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.java b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.java
new file mode 100644
index 0000000000..3575d94f48
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.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.trninq;
+
+import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface TrninqInterface {
+
+ /**
+ * Auto generated method signatures
+ * @param depAcctTrnInqRq
+ */
+ public DepAcctTrnInqRs_Type DepAcctTrnInq(DepAcctTrnInqRq_Type depAcctTrnInqRq) throws java.rmi.RemoteException;
+
+ //
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ac66b6a425
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://trninqcomposite"
+ xmlns:t="http://trninqcomposite">
+ <deployable composite="t:TestService" />
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/trnInq.composite b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/trnInq.composite
new file mode 100644
index 0000000000..97594216e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/trnInq.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://trninqcomposite"
+ name="TestService">
+
+ <service name="TrnInqService" promote="TransactionInquiryComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.trninq.TrninqInterface" />
+ <binding.ws wsdlElement="http://trninq#wsdl.port(TrnInqSvc/TrnInqSvcPort)" />
+ </service>
+ <component name="TransactionInquiryComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.trninq.TrnInqService" />
+ </component>
+
+ <reference name="TrnInqReference" promote="TransactionInquiryClientComponent/transactionInquiryService">
+ <interface.java interface="org.apache.tuscany.sca.itest.trninq.TrninqInterface" />
+ <binding.ws wsdlElement="http://trninq#wsdl.port(TrnInqSvc/TrnInqSvcPort)" />
+ </reference>
+ <component name="TransactionInquiryClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.trninq.TrnInqClient" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd
new file mode 100644
index 0000000000..b85b80abc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+ <!--
+ http://www.ifxforum.org/standards/standard/license
+
+IFX License Statement
+=====================
+IFX Forum hereby grants to all users of the IFX Business Message Specification
+and Data Dictionary (the "Specification") a perpetual, worldwide, royalty-free,
+nonexclusive, nontransferable license to (a) use the specification in the development
+of software and/or data compilations which facilitate electronic transmission of
+information in accordance with the Specification and otherwise implement the
+Specification in user's products, and (b) market, reproduce, display, and distribute
+(in any medium known now or in the future) the Specification as implemented in user's
+products. The foregoing rights may be sublicensed through multiple tiers of distribution,
+including resellers.
+
+Other than as licensed herein, the IFX Forum shall retain all right, title and interest
+to any patent, copyrights, trade secrets or other proprietary rights ("Intellectual
+Property Rights") in the Specification. Subject to all patent rights preserved by IFX Forum
+members pursuant to Section 5.1 of the "Membership Rules of the Interactive Financial
+Exchange Forum, Inc.", users shall retain all right, title and interest to the Intellectual
+Property Rights in any products of user created using the Specification and any modifications,
+extensions or derivative works of the Specification that user develops or has developed on
+its behalf as permitted under this Agreement (the "Derivatives"), provided, however, that,
+users may not hold Derivatives out as being endorsed, sponsored by or affiliated with the
+IFX Forum.
+ -->
+<xsd:schema xmlns="urn:ifxforum-org:XSD:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:ifxforum-org:XSD:1" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xsd:complexType name="AdditionalStatus_Type">
+ <xsd:sequence>
+ <xsd:element name="ServerStatusCode" type="xsd:string" />
+ <xsd:element name="Severity" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="BankAcctTrnRec_Type">
+ <xsd:sequence>
+ <xsd:element name="TrnType" type="xsd:string" minOccurs="0" />
+ <xsd:element name="PostedDt" type="xsd:string" />
+ <xsd:element name="OrigDt" type="xsd:string" minOccurs="0" />
+ <xsd:element name="CurAmt" type="CurrencyAmount" />
+ <xsd:element name="BillRefInfo" type="xsd:string" minOccurs="0" />
+ <xsd:element name="CustPayeeInfo" type="CustPayeeInfo_Type" minOccurs="0" />
+ <xsd:element name="CSPRefId" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="BankInfo_Type">
+ <xsd:sequence>
+ <xsd:element name="BankIdType" type="xsd:string" minOccurs="0" />
+ <xsd:element name="BankId" type="xsd:string" minOccurs="0" />
+ <xsd:element name="Name" type="xsd:string" minOccurs="0" />
+ <xsd:element name="BranchId" type="xsd:string" minOccurs="0" />
+ <xsd:element name="BranchName" type="xsd:string" minOccurs="0" />
+ <xsd:element name="City" type="xsd:string" minOccurs="0" />
+ <xsd:element name="StateProv" type="xsd:string" minOccurs="0" />
+ <xsd:element name="PostalCode" type="xsd:string" minOccurs="0" />
+ <xsd:element name="Country" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="BillerId_Type">
+ <xsd:sequence>
+ <xsd:element name="SPName" type="xsd:string" />
+ <xsd:element name="BillerNum" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="BillerPayee_Type">
+ <xsd:sequence>
+ <xsd:element name="BillerId" type="BillerId_Type" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="CurrencyAmount">
+ <xsd:sequence>
+ <xsd:element name="Amt" type="xsd:decimal" />
+ <xsd:element name="CurCode" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="CustPayeeInfo_Type">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" minOccurs="0" />
+ <xsd:element name="Nickname" type="xsd:string" minOccurs="0" />
+ <xsd:element name="BillerPayee" type="BillerPayee_Type" />
+ <xsd:element name="BillingAcct" type="xsd:string" minOccurs="0" />
+ <xsd:element name="AcctPayAcctId" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DepAcctTrnInqRq_Type">
+ <xsd:sequence>
+ <xsd:element name="TrnCountLimit" type="TrnCountLimit_Type" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DepAcctTrnInqRs_Type">
+ <xsd:sequence>
+ <xsd:sequence>
+ <xsd:element name="Status" type="Status_Type" />
+ <xsd:element name="DepAcctId" type="DepAcctId_Type" />
+ <xsd:element name="DepAcctTrnRec" type="DepAcctTrnRec_Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DepAcctTrnRec_Type">
+ <xsd:sequence>
+ <xsd:element name="BankAcctTrnRec" type="BankAcctTrnRec_Type" />
+ <xsd:element name="StmtRunningBal" type="CurrencyAmount" minOccurs="0" />
+ <xsd:element name="AvailDt" type="xsd:string" minOccurs="0" />
+ <xsd:element name="XferId" type="xsd:string" minOccurs="0" />
+ <xsd:element name="PmtId" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DepAcctId_Type">
+ <xsd:sequence>
+ <xsd:element name="BankInfo" type="BankInfo_Type" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="Status_Type">
+ <xsd:sequence>
+ <xsd:element name="StatusCode" type="xsd:int" />
+ <xsd:element name="StatusDesc" type="xsd:string" />
+ <xsd:element name="AdditionalStatus" type="AdditionalStatus_Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="TrnCountLimit_Type">
+ <xsd:sequence>
+ <xsd:element name="Count" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="DepAcctTrnInqRq" type="DepAcctTrnInqRq_Type" />
+ <xsd:element name="DepAcctTrnInqRs" type="DepAcctTrnInqRs_Type" />
+</xsd:schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl
new file mode 100644
index 0000000000..842f7a9d4c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl
@@ -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.
+-->
+<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:trninq="urn:ifxforum-org:XSD:1"
+ xmlns:tns="http://trninq" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://trninq">
+ <types>
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://trninq">
+ <xsd:import namespace="urn:ifxforum-org:XSD:1" schemaLocation="IFX170_XSD.xsd" />
+ </xsd:schema>
+ </types>
+ <message name="DepAcctTrnInqRq">
+ <part name="messagePart" element="trninq:DepAcctTrnInqRq" />
+ </message>
+ <message name="DepAcctTrnInqRs">
+ <part name="messagePart" element="trninq:DepAcctTrnInqRs" />
+ </message>
+ <portType name="trninqInterface">
+ <operation name="DepAcctTrnInq">
+ <input message="tns:DepAcctTrnInqRq" />
+ <output message="tns:DepAcctTrnInqRs" />
+ </operation>
+ </portType>
+ <binding name="trninq" type="tns:trninqInterface">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="DepAcctTrnInq">
+ <soap:operation soapAction="trninq:DepAcctTrnInq" style="document" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+ <service name="TrnInqSvc">
+ <port name="TrnInqSvcPort" binding="tns:trninq">
+ <soap:address location="http://localhost:8085/itest-large-sdo-ws/TrnInqService" />
+ </port>
+ </service>
+</definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.java
new file mode 100644
index 0000000000..17eb575d50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.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 trninq;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.trninq.TrninqInterface;
+import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type;
+import org.ifxforum.xsd._1.TrnCountLimit_Type;
+import org.ifxforum.xsd._1._1Factory;
+import org.junit.Assert;
+
+/**
+ * This test is created to cover https://issues.apache.org/jira/browse/TUSCANY-1541
+ *
+ * @version $Rev$ $Date$
+ */
+public class TrnInqServiceTestCase extends TestCase {
+
+ private static SCADomain scaDomain;
+ private TrninqInterface trnInq;
+
+ @Override
+ protected void setUp() throws Exception {
+ if (scaDomain == null) {
+ scaDomain = SCADomain.newInstance("trnInq.composite");
+ }
+ trnInq = scaDomain.getService(TrninqInterface.class, "TransactionInquiryClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testDepAcctTrnInq() throws IOException {
+ DepAcctTrnInqRq_Type depAcctTrnInqRequest = _1Factory.INSTANCE.createDepAcctTrnInqRq_Type();
+ TrnCountLimit_Type trnCountLimit = _1Factory.INSTANCE.createTrnCountLimit_Type();
+ depAcctTrnInqRequest.setTrnCountLimit(trnCountLimit);
+ depAcctTrnInqRequest.getTrnCountLimit().setCount(2);
+
+ try {
+ DepAcctTrnInqRs_Type depAcctTrnInqResponse = trnInq.DepAcctTrnInq(depAcctTrnInqRequest);
+ } catch (Exception e) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ e.printStackTrace(pw);
+ Assert.fail("Should pass with MaxRec 2! \n" + sw);
+ sw.close();
+ pw.close();
+ }
+
+ depAcctTrnInqRequest.getTrnCountLimit().setCount(10);
+ try {
+ DepAcctTrnInqRs_Type depAcctTrnInqResponse = trnInq.DepAcctTrnInq(depAcctTrnInqRequest);
+ } catch (Exception e) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ e.printStackTrace(pw);
+ Assert.fail("Should pass with MaxRec 10! \n" + sw);
+ sw.close();
+ pw.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/pom.xml b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/pom.xml
new file mode 100644
index 0000000000..f30931f309
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-late-reference-resolution</artifactId>
+ <name>Apache Tuscany SCA Late Reference Resolution Integration Test</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-node-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-launcher</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-manager</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-endpoint</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-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-android/itest/late-reference-resolution/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..d7dc4473ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/AddService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9b7e254e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/AddServiceImpl.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 calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/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-android/itest/late-reference-resolution/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..da869e00fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/CalculatorServiceImpl.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 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 setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ public double add(double n1, double n2) {
+ System.out.println("CalculatorService - add " + n1 + " and " + n2);
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/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-android/itest/late-reference-resolution/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/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-android/itest/late-reference-resolution/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/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-android/itest/late-reference-resolution/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/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-android/itest/late-reference-resolution/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..78ab9c6ee0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/SubtractService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1010207154
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/java/calculator/SubtractServiceImpl.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 calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory
new file mode 100644
index 0000000000..c53b55aacf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 binding extension
+binding.sca.BindingScaEndpointResolverFactoryImpl;model=org.apache.tuscany.sca.assembly.SCABinding
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeA/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeA/Calculator.composite
new file mode 100644
index 0000000000..378d6e9706
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeA/Calculator.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="CalculatorA">
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeA/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..db255e0232
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeA/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorA"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeB/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeB/Calculator.composite
new file mode 100644
index 0000000000..3fb16fa619
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeB/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorB">
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ <service name="AddService">
+ <binding.sca uri="http://localhost:8085/AddServiceComponentB"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeB/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeB/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..130157ac04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeB/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorB"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeC/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeC/Calculator.composite
new file mode 100644
index 0000000000..c615b4355a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeC/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorC">
+
+ <component name="SubtractServiceComponentC">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ <service name="SubtractService">
+ <binding.sca uri="http://localhost:8086/SubtractServiceComponentC"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeC/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeC/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..cba0a5c281
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/main/resources/nodeC/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorC"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/binding/sca/BindingScaEndpointResolverFactoryImpl.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/binding/sca/BindingScaEndpointResolverFactoryImpl.java
new file mode 100644
index 0000000000..e4bd3035e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/binding/sca/BindingScaEndpointResolverFactoryImpl.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 binding.sca;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
+
+/**
+ * The factory for creating endpoint Binding providers
+ *
+ * @version $Rev$ $Date$
+ */
+public class BindingScaEndpointResolverFactoryImpl implements EndpointResolverFactory<SCABinding> {
+
+ private ExtensionPointRegistry extensionPoints;
+
+ public BindingScaEndpointResolverFactoryImpl(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+ }
+
+ public EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding) {
+
+ return new BindingScaEndpointResolverImpl(extensionPoints, endpoint, binding);
+ }
+
+ public Class<SCABinding> getModelType() {
+ return SCABinding.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/binding/sca/BindingScaEndpointResolverImpl.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/binding/sca/BindingScaEndpointResolverImpl.java
new file mode 100644
index 0000000000..c6e0689837
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/binding/sca/BindingScaEndpointResolverImpl.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 binding.sca;
+
+
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
+
+import calculator.LateReferenceResolutionTestCase;
+
+/**
+ * The endpoint resolver allows unresolved endpoints to be plumbed into
+ * the runtime start and message send processing as a hook to late resolution
+ * of target services
+ *
+ * @version $Rev$ $Date$
+ */
+public class BindingScaEndpointResolverImpl implements EndpointResolver {
+
+ private final static Logger logger = Logger.getLogger(BindingScaEndpointResolverImpl.class.getName());
+
+ private Endpoint endpoint;
+ private SCABinding binding;
+
+ public BindingScaEndpointResolverImpl(ExtensionPointRegistry extensionPoints,
+ Endpoint endpoint,
+ Binding binding) {
+ this.endpoint = endpoint;
+ this.binding = (SCABinding)binding;
+ }
+
+ public void start(){
+ // do nothing
+ }
+
+ public void resolve() {
+ if (endpoint.isUnresolved()){
+ // I can cheat here because I know this test only has
+ // SCA Bindings in it so all I have to do it find the URL
+ // of the endpoint
+ String targetURL = LateReferenceResolutionTestCase.registry.locateService(endpoint.getTargetName());
+ binding.setURI(targetURL);
+ endpoint.setSourceBinding(binding);
+ }
+ }
+
+ public void stop(){
+ // do nothing
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/calculator/LateReferenceResolutionTestCase.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/calculator/LateReferenceResolutionTestCase.java
new file mode 100644
index 0000000000..ebe834028d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/calculator/LateReferenceResolutionTestCase.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 calculator;
+
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class LateReferenceResolutionTestCase {
+
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+ private static SCANode nodeC;
+
+ private static CalculatorService calculatorService;
+
+ public static TestRegistryImpl registry = new TestRegistryImpl();
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ nodeC = nodeFactory.createSCANode(new File("src/main/resources/nodeC/Calculator.composite").toURL().toString(),
+ new SCAContribution("NodeC",
+ new File("src/main/resources/nodeC").toURL().toString()));
+ nodeB = nodeFactory.createSCANode(new File("src/main/resources/nodeB/Calculator.composite").toURL().toString(),
+ new SCAContribution("NodeB",
+ new File("src/main/resources/nodeB").toURL().toString()));
+ nodeA = nodeFactory.createSCANode(new File("src/main/resources/nodeA/Calculator.composite").toURL().toString(),
+ new SCAContribution("NodeA",
+ new File("src/main/resources/nodeA").toURL().toString()));
+
+ nodeC.start();
+ nodeB.start();
+ nodeA.start();
+
+ SCAClient client = (SCAClient)nodeA;
+ calculatorService =
+ client.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ } catch(Exception ex){
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ nodeC.stop();
+ nodeB.stop();
+ nodeA.stop();
+ }
+
+ @Test
+ public void testCalculator() throws Exception {
+
+ // Calculate
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorService.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorService.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorService.divide(3, 2), 1.5);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/calculator/TestRegistryImpl.java b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/calculator/TestRegistryImpl.java
new file mode 100644
index 0000000000..57afc9ea50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/late-reference-resolution/src/test/java/calculator/TestRegistryImpl.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;
+
+/**
+ * A dummy domain registry component
+ */
+public class TestRegistryImpl {
+
+ public String locateService(String targetServiceName){
+ String targetURL = null;
+
+ // In reality of course a registry would have to be initialized
+ // with the real target service endpoints but in this test
+ // we know what they are going to be ahead of time
+ if (targetServiceName.equals("AddServiceComponentB")){
+ targetURL = "http://localhost:8085/" + targetServiceName;
+ } else if (targetServiceName.equals("SubtractServiceComponentC")){
+ targetURL = "http://localhost:8086/" + targetServiceName;
+ }
+
+ return targetURL;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/oneway/build.xml b/sca-java-1.x/branches/sca-android/itest/oneway/build.xml
new file mode 100644
index 0000000000..e6b8f2e51f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/oneway/build.xml
@@ -0,0 +1,127 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="oneway" default="runServer">
+
+ <property name="m2.repo" value="${user.home}\.m2\repository" />
+
+ <path id="repo.classpath">
+ <pathelement location="target/classes"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-spi\1.4-SNAPSHOT\tuscany-core-spi-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-http\1.4-SNAPSHOT\tuscany-host-http-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-axis2\1.4-SNAPSHOT\tuscany-binding-ws-axis2-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy\1.4-SNAPSHOT\tuscany-policy-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.jar"/>
+ <pathelement location="${m2.repo}\org\mortbay\jetty\jetty-util\6.1.3\jetty-util-6.1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1\geronimo-jms_1.1_spec-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-runtime\1.4-SNAPSHOT\tuscany-implementation-java-runtime-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\wsdl4j\wsdl4j\1.6.2\wsdl4j-1.6.2.jar"/>
+ <pathelement location="${m2.repo}\commons-codec\commons-codec\1.3\commons-codec-1.3.jar"/>
+ <pathelement location="${m2.repo}\xml-apis\xml-apis\1.3.03\xml-apis-1.3.03.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\security\wss4j\1.5.3\wss4j-1.5.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-namespace\1.4-SNAPSHOT\tuscany-contribution-namespace-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\jdom\jdom\1.0\jdom-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xsd\1.4-SNAPSHOT\tuscany-assembly-xsd-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly\1.4-SNAPSHOT\tuscany-assembly-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-trust\1.3\rampart-trust-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-databinding\1.4-SNAPSHOT\tuscany-core-databinding-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-api\1.2.5\axiom-api-1.2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-xml\1.4-SNAPSHOT\tuscany-policy-xml-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-kernel\1.3\axis2-kernel-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-sca-api\1.4-SNAPSHOT\tuscany-sca-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore\4.0-alpha5\httpcore-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\backport-util-concurrent\backport-util-concurrent\2.2\backport-util-concurrent-2.2.jar"/>
+ <pathelement location="${m2.repo}\commons-logging\commons-logging\1.1\commons-logging-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-java\1.4-SNAPSHOT\tuscany-contribution-java-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-activation_1.1_spec\1.0-M1\geronimo-activation_1.1_spec-1.0-M1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding\1.4-SNAPSHOT\tuscany-databinding-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\logkit\logkit\1.0.1\logkit-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-xml\1.4-SNAPSHOT\tuscany-binding-ws-xml-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\commons-fileupload\commons-fileupload\1.1.1\commons-fileupload-1.1.1.jar"/>
+ <pathelement location="${m2.repo}\annogen\annogen\0.1.0\annogen-0.1.0.jar"/>
+ <pathelement location="${m2.repo}\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-adb\1.3\axis2-adb-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-security\1.4-SNAPSHOT\tuscany-policy-security-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xml\1.4-SNAPSHOT\tuscany-assembly-xml-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-mtompolicy\1.3\axis2-mtompolicy-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain\1.4-SNAPSHOT\tuscany-domain-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\commons-httpclient\commons-httpclient\3.0.1\commons-httpclient-3.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java\1.4-SNAPSHOT\tuscany-interface-java-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-java2wsdl\1.3\axis2-java2wsdl-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore-nio\4.0-alpha5\httpcore-nio-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution\1.4-SNAPSHOT\tuscany-contribution-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java\1.4-SNAPSHOT\tuscany-implementation-java-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\xalan\xalan\2.7.0\xalan-2.7.0.jar"/>
+ <pathelement location="${m2.repo}\com\ibm\icu\icu4j\2.6.1\icu4j-2.6.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-core\1.3\rampart-core-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-commonj_1.1_spec\1.0\geronimo-commonj_1.1_spec-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain-api\1.4-SNAPSHOT\tuscany-domain-api-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca\1.4-SNAPSHOT\tuscany-binding-sca-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\xom\xom\1.0\xom-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-jetty\1.4-SNAPSHOT\tuscany-host-jetty-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-policy\1.3\rampart-policy-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore-niossl\4.0-alpha5\httpcore-niossl-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\junit\junit\4.2\junit-4.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-impl\1.2.5\axiom-impl-1.2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-xml\1.4-SNAPSHOT\tuscany-implementation-java-xml-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-xml\1.4-SNAPSHOT\tuscany-binding-sca-xml-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\neethi\neethi\2.0.2\neethi-2.0.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl\1.4-SNAPSHOT\tuscany-interface-wsdl-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws\1.4-SNAPSHOT\tuscany-binding-ws-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\javax\activation\activation\1.1\activation-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant\1.7.0\ant-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding-axiom\1.4-SNAPSHOT\tuscany-databinding-axiom-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\mortbay\jetty\jetty\6.1.3\jetty-6.1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-javamail_1.4_spec\1.0-M1\geronimo-javamail_1.4_spec-1.0-M1.jar"/>
+ <pathelement location="${m2.repo}\avalon-framework\avalon-framework\4.1.3\avalon-framework-4.1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core\1.4-SNAPSHOT\tuscany-core-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl-xml\1.4-SNAPSHOT\tuscany-interface-wsdl-xml-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-impl\1.4-SNAPSHOT\tuscany-contribution-impl-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-node\1.4-SNAPSHOT\tuscany-node-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-definitions\1.4-SNAPSHOT\tuscany-definitions-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\santuario\xmlsec\1.4.0\xmlsec-1.4.0.jar"/>
+ <pathelement location="${m2.repo}\jaxen\jaxen\1.1.1\jaxen-1.1.1.jar"/>
+ <pathelement location="${m2.repo}\commons-io\commons-io\1.2\commons-io-1.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-embedded\1.4-SNAPSHOT\tuscany-host-embedded-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-dom\1.2.5\axiom-dom-1.2.5.jar"/>
+ <pathelement location="${m2.repo}\log4j\log4j\1.2.12\log4j-1.2.12.jar"/>
+ <pathelement location="${m2.repo}\javax\mail\mail\1.4\mail-1.4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-codegen\1.3\axis2-codegen-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\codehaus\woodstox\wstx-asl\3.2.1\wstx-asl-3.2.1.jar"/>
+ <pathelement location="${m2.repo}\stax\stax-api\1.0.1\stax-api-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java-xml\1.4-SNAPSHOT\tuscany-interface-java-xml-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\schema\XmlSchema\1.3.2\XmlSchema-1.3.2.jar"/>
+ <pathelement location="${m2.repo}\xerces\xmlParserAPIs\2.6.2\xmlParserAPIs-2.6.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\woden\woden\1.0-incubating-M7b\woden-1.0-incubating-M7b.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface\1.4-SNAPSHOT\tuscany-interface-1.4-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\easymock\easymock\2.2\easymock-2.2.jar"/>
+ </path>
+
+ <target name="runServer">
+ <java classname="org.apache.tuscany.sca.itest.oneway.impl.OneWayServer"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/oneway/pom.xml b/sca-java-1.x/branches/sca-android/itest/oneway/pom.xml
new file mode 100644
index 0000000000..ba61e1e0c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/oneway/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-oneway</artifactId>
+ <name>Apache Tuscany SCA OneWay Integration Tests</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java
new file mode 100644
index 0000000000..04c6069dfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.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.oneway;
+
+/**
+ * The client for the oneway itest.
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+public interface OneWayClient {
+
+ /**
+ * This method will invoke the doSomething() @OneWay method on the OneWayService
+ * the specified number of times.
+ *
+ * @param count The number of times to invoke doSomething() on the OneWayService
+ */
+ void doSomething(int count);
+
+ /**
+ * This method will invoke a @OneWay method that throws an exception.
+ */
+ void doSomethingWhichThrowsException();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java
new file mode 100644
index 0000000000..b3cec51b1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.oneway;
+
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing @OneWay interactions.
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface OneWayService {
+
+ /**
+ * This OneWay method will increment the callCount by 1.
+ *
+ * @param count Not used
+ */
+ @OneWay
+ void doSomething(int count);
+
+ /**
+ * This one way method will throw a NullPointerException.
+ */
+ @OneWay
+ void doSomethingWhichThrowsException();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java
new file mode 100644
index 0000000000..8013c5c0e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.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.itest.oneway.impl;
+
+import org.apache.tuscany.sca.itest.oneway.OneWayClient;
+import org.apache.tuscany.sca.itest.oneway.OneWayService;
+import org.junit.Assert;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * The client for the oneway itest.
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+public class OneWayClientImpl implements OneWayClient {
+ /**
+ * Injected reference to the OneWayService.
+ */
+ @Reference
+ protected OneWayService oneWayService;
+
+ /**
+ * Tracks the number of calls of the doSomething() method on the OneWayService.
+ */
+ public static int callCount = 0;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void doSomething(int count) {
+ callCount = callCount + count;
+
+ for (int loopCount = 0; loopCount < count; loopCount++) {
+ //System.out.println("Client: doSomething " + loopCount);
+ //System.out.flush();
+ oneWayService.doSomething(loopCount);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void doSomethingWhichThrowsException() {
+ Assert.assertNotNull(oneWayService);
+ oneWayService.doSomethingWhichThrowsException();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java
new file mode 100644
index 0000000000..01f956cb67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.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.itest.oneway.impl;
+
+import org.apache.tuscany.sca.itest.oneway.OneWayService;
+
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * The service for the oneway itest.
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public class OneWayServiceImpl implements OneWayService {
+
+ /**
+ * This is the error message that will be in the Exception thrown by
+ * the doSomethingWhichThrowsException() method.
+ */
+ public static final String EXCEPTION_MESSAGE = "Sample RuntimeException from a @OneWay method";
+
+ /**
+ * Counts the number of invocations to doSomething().
+ */
+ public static final AtomicInteger CALL_COUNT = new AtomicInteger();
+
+ /**
+ * Counts the number of invocations of the doSomethingWhichThrowsException() method.
+ */
+ public static final AtomicInteger CALL_COUNT_FOR_THROWS_EXCEPTION_METHOD = new AtomicInteger();
+
+ /**
+ * {@inheritDoc}
+ */
+ public void doSomething(int count) {
+ CALL_COUNT.incrementAndGet();
+
+ // System.out.println("Service: doSomething " + count + " callCount = " + callCount);
+ // System.out.flush();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void doSomethingWhichThrowsException() {
+ System.out.println("OneWay invoked. About to throw an Exception");
+ CALL_COUNT_FOR_THROWS_EXCEPTION_METHOD.incrementAndGet();
+ throw new NullPointerException(EXCEPTION_MESSAGE);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite
new file mode 100644
index 0000000000..d053a6278c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.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"
+ targetNamespace="http://oneway"
+ name="OneWayITest">
+
+ <component name="OneWayClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayClientImpl"/>
+ <reference name="oneWayService" target="OneWayServiceComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="OneWayServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ <binding.ws uri="http://localhost:8085/OneWayServiceComponent"/>
+ </service>
+ </component>
+
+
+ <!-- OneWay Client and Server Components that use the standard SCA Binding so we can validate -->
+ <!-- that the NonBlockingInterceptor logs an message when an Exception is thrown by the code -->
+ <!-- that is called. See TUSCANY-2225 -->
+ <component name="OneWayClientComponentSCABinding">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayClientImpl"/>
+ <reference name="oneWayService" target="OneWayServiceComponentSCABinding">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ </reference>
+ </component>
+
+ <component name="OneWayServiceComponentSCABinding">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java b/sca-java-1.x/branches/sca-android/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java
new file mode 100644
index 0000000000..c490150ec5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.oneway;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor;
+import org.apache.tuscany.sca.itest.oneway.impl.OneWayClientImpl;
+import org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This test case will test invoking @OneWay operations.
+ *
+ * @version $Date$ $Revision$
+ */
+public class OneWayTestCase {
+ /**
+ * Maximum period of time that we are prepared to wait for all the @OneWay
+ * method calls to complete in milliseconds.
+ */
+ private static final int MAX_SLEEP_TIME = 10000;
+
+ private SCANode node;
+
+ /**
+ * Initialise the SCADomain.
+ *
+ * @throws Exception Failed to initialise the SCADomain
+ */
+ @Before
+ public void setUp() throws Exception {
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANodeFromClassLoader("OneWayContribution/META-INF/sca-deployables/oneWay.composite", null);
+ node.start();
+
+ }
+
+ /**
+ * This method will ensure that the SCADomain is shutdown.
+ *
+ * @throws Exception Failed to shutdown the SCADomain
+ */
+ @After
+ public void tearDown() throws Exception {
+ node.stop();
+ }
+
+ /**
+ * This test will test repeatedly calling a @OneWay operation and ensure that the correct
+ * number of @OneWay operations are run.
+ *
+ * @throws Exception Test failed
+ */
+ @Test
+ public void testOneWay() throws Exception {
+ OneWayClient client =
+ ((SCAClient)node).getService(OneWayClient.class, "OneWayClientComponent");
+
+ int count = 100;
+
+ for (int i = 0; i < 10; i++) {
+ // System.out.println("Test: doSomething " + count);
+ // System.out.flush();
+ client.doSomething(count);
+
+ // TUSCANY-2192 - We need to sleep to allow the @OneWay method calls to complete.
+ // Note: This can take different periods depending on the speed and load
+ // on the computer where the test is being run.
+ // This loop will wait for the required number of @OneWay method calls to
+ // have taken place or MAX_SLEEP_TIME to have passed.
+ long startSleep = System.currentTimeMillis();
+ while (OneWayClientImpl.callCount != OneWayServiceImpl.CALL_COUNT.get()
+ && System.currentTimeMillis() - startSleep < MAX_SLEEP_TIME) {
+ Thread.sleep(100);
+ // System.out.println("" + OneWayClientImpl.callCount + "," + OneWayServiceImpl.callCount);
+ }
+
+ System.out.println("Finished callCount = " + OneWayServiceImpl.CALL_COUNT);
+
+ Assert.assertEquals(OneWayClientImpl.callCount, OneWayServiceImpl.CALL_COUNT.get());
+ }
+ }
+
+ /**
+ * This method will invoke a @OneWay method that throws an exception
+ * when invoked over a SCA Binding which uses the NonBlockingInterceptor and
+ * ensure that the Exception is logged.
+ * See TUSCANY-2225
+ */
+ @Test
+ public void testOneWayUsingNonBlockingInterceptorThrowsAnException() {
+ OneWayClient client =
+ ((SCAClient)node).getService(OneWayClient.class, "OneWayClientComponentSCABinding");
+
+ // We need to modify the JDK Logger for the NonBlockingInterceptor so we
+ // can check that it logs a message for the @OneWay invocation that throws
+ // an Exception
+ Logger nbiLogger = Logger.getLogger(NonBlockingInterceptor.class.getName());
+ DummyJDKHandler handler = new DummyJDKHandler();
+ nbiLogger.addHandler(handler);
+
+ // Add a message on the console to explain the stack dump that is going to be
+ // displayed and state that this is not a problem but expected behaviour
+ System.out.println();
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+ System.out.println("IMPORTANT: The error message that appears on the console");
+ System.out.println("below is an expected error if it is a NullPointerException");
+ System.out.println(" with the message of:");
+ System.out.println(" \"" + OneWayServiceImpl.EXCEPTION_MESSAGE + "\"");
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+ System.out.println();
+ System.out.flush();
+
+ // Invoke the @OneWay method that throws an exception
+ client.doSomethingWhichThrowsException();
+
+ // The logging is done asynchronously so we will need to wait a bit before
+ // the log message appears.
+ long start = System.currentTimeMillis();
+ boolean logged = false;
+ while (System.currentTimeMillis() - start < MAX_SLEEP_TIME && !logged) {
+ // Has the log message been logged?
+ if (handler.exceptionLogged.get()) {
+ logged = true;
+ } else {
+ try {
+ Thread.sleep(25);
+ } catch (InterruptedException ex) {
+ Assert.fail("Unexpected exception " + ex);
+ }
+ }
+ }
+
+ // Add a message explaining that errors beyond this point should be reported
+ System.out.println();
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+ System.out.println("End of expected exceptions. Any errors beyond this point are errors!");
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+ System.out.println();
+ System.out.flush();
+
+ // Remove the handler
+ nbiLogger.removeHandler(handler);
+
+ // Make sure that the exception was logged
+ Assert.assertTrue(handler.exceptionLogged.get());
+ }
+
+ /**
+ * A handler that is added to the JDK Logging system to examine the log messages
+ * generated to ensure that a @OneWay method that throws an Exception will
+ * generate a log message.
+ */
+ private class DummyJDKHandler extends Handler {
+
+ /**
+ * Used to track whether the exception has been logged.
+ */
+ private AtomicBoolean exceptionLogged = new AtomicBoolean(false);
+
+ /**
+ * Constructor.
+ */
+ private DummyJDKHandler() {
+ super.setLevel(Level.ALL);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void close() throws SecurityException {
+ // Nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void flush() {
+ // Nothing to do
+ }
+
+ /**
+ * Examines the LogRecord and checks whether it matches the one we are looking for.
+ * If it matches, it will set exceptionLogged to True.
+ *
+ * @param record The Log Record that is being published
+ */
+ @Override
+ public void publish(LogRecord record) {
+ // The log message we are looking for is Severe
+ if (record.getLevel() == Level.SEVERE) {
+ if (record.getThrown() != null
+ && record.getThrown().toString().indexOf(
+ OneWayServiceImpl.EXCEPTION_MESSAGE) != -1) {
+ // We have found our Exception.
+ exceptionLogged.set(true);
+ }
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/operation-overloading/pom.xml b/sca-java-1.x/branches/sca-android/itest/operation-overloading/pom.xml
new file mode 100644
index 0000000000..2f28908e6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-operation-overloading</artifactId>
+ <name>Apache Tuscany SCA Operation Overloading Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java b/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java
new file mode 100644
index 0000000000..85b5717c00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.test.opoverload;
+
+/**
+ * This is an Interface which has methods declared but not implemented, These methods will be implemented in
+ * OverloadATarget Class and OverloadASource This class has methods with overloaded parameters.
+ */
+
+//@AllowsPassByReference
+public interface OverloadASourceTarget {
+ final String opName = "operationA:";
+
+ /**
+ * Method with no parameters
+ */
+ String operationA();
+
+ /**
+ * Method with one integer parameter
+ */
+ String operationA(int parm1);
+
+ /**
+ * Method with one integer parameter and one string parameter
+ */
+ String operationA(int parm1, String parm2);
+
+ /**
+ * Method with one one string parameter and one integer parameter
+ */
+ String operationA(String parm1, int parm2);
+
+ /**
+ * Method with one string parameter
+ */
+ String operationA(String string);
+
+ /**
+ * Method which throws an illegal argument exception in case of any exceptions.
+ */
+ String[] operationAall();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java b/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java
new file mode 100644
index 0000000000..e5d5083a2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.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.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;
+
+/**
+ * This class Implements the interface OverloadASourceTarget, and gives implementation for all methods which are
+ * declared in the OverloadASourceTarget interface.
+ */
+@Service(OverloadASourceTarget.class)
+public class OverloadASource implements OverloadASourceTarget {
+ public OverloadASourceTarget overloadASourceTarget;
+
+ /**
+ * This is a default constructor
+ */
+ 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);
+ }
+
+ /**
+ * This method which is used by all the overloaded functions to set the source target
+ */
+ @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-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java b/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java
new file mode 100644
index 0000000000..e206a86768
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.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.test.opoverload.impl;
+
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class Implements the interface OverloadASourceTarget, and gives implementation for all methods which are
+ * declared in the OverloadASourceTarget interface.
+ */
+@Service(OverloadASourceTarget.class)
+public class OverloadATarget implements OverloadASourceTarget {
+
+ /**
+ * This is a default Constructor
+ */
+ 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;
+ }
+
+ /**
+ * This method is used to print the message returned by all the overloaded functions
+ */
+ 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-android/itest/operation-overloading/src/main/resources/OperationOverload.composite b/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/main/resources/OperationOverload.composite
new file mode 100644
index 0000000000..cbf5aa2078
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java b/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java
new file mode 100644
index 0000000000..0b3b12c762
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.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.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;
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the values compared are same as the values retrieved from the SCA runtime.
+ */
+ 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);
+ }
+
+ /**
+ * setUp() is a method in JUnit Frame Work which is executed before all others methods in the class extending
+ * unit.framework.TestCase. So this method is used to create a test Embedded SCA Domain, to start the SCA Domain and
+ * to get a reference to the contribution service
+ */
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("OperationOverload.composite");
+ overloadA = domain.getService(OverloadASourceTarget.class, "OverloadASourceComponent");
+ }
+
+ /**
+ * tearDown() is a method in JUnit Frame Work which is executed after all other methods in the class extending
+ * unit.framework.TestCase. So this method is used to close the SCA domain.
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/build-bundles.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/build-bundles.xml
new file mode 100644
index 0000000000..82d536cbfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/build-bundles.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 name="OSGiBundleCreator">
+
+ <target name="create-bundles">
+
+ <mkdir dir="${jar.dir}"/>
+
+ <copy file="target/classes/META-INF/${sca.contribution}" tofile="target/classes/META-INF/sca-contribution.xml"/>
+
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" manifest="${files.dir}/${manifest.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ <!-- include name="${files.list}"/-->
+ </fileset>
+ </jar>
+
+ <delete file="target/classes/META-INF/sca-contribution.xml"/>
+ </target>
+
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/pom.xml
new file mode 100644
index 0000000000..edbb66ab09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/pom.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-contribution-classes</artifactId>
+ <name>Apache Tuscany OSGi Contribution Version 1 classes</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <finalName>itest-osgi-contribution-classes-v2</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-bundles</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CustomerV2.jar" />
+ <property name="manifest.file.name" value="osgi/Customer.mf" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/OSGiBundleImpl.class \
+ supplychain.composite \
+ CustomerV2.componentType \
+ RetailerV2.componentType \
+ WarehouseV2.componentType \
+ ShipperV2.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Customer2V2.jar" />
+ <property name="manifest.file.name" value="osgi/Customer2.mf" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/OSGiBundleImpl.class \
+ supplychain.composite \
+ Customer2V2.componentType \
+ RetailerV2.componentType \
+ WarehouseV2.componentType \
+ ShipperV2.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="RetailerV2.jar" />
+ <property name="manifest.file.name" value="osgi/Retailer.mf" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="RetailerJarV2.jar" />
+ <property name="manifest.file.name" value="osgi/RetailerJar.mf" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="ShipperV2.jar" />
+ <property name="manifest.file.name" value="osgi/Shipper.mf" />
+ <property name="sca.contribution" value="shipper-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/shipper/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="WarehouseV2.jar" />
+ <property name="manifest.file.name" value="osgi/Warehouse.mf" />
+ <property name="sca.contribution" value="warehouse-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/warehouse/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChainV2.jar" />
+ <property name="manifest.file.name" value="osgi/SupplyChain.mf" />
+ <property name="sca.contribution" value="supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/** \
+ supplychain.composite \
+ CustomerV2.componentType \
+ RetailerV2.componentType \
+ WarehouseV2.componentType \
+ ShipperV2.componentType \
+ CustomerV2.jar \
+ RetailerV2.jar \
+ WarehouseV2.jar \
+ ShipperV2.jar \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/OSGiBundleImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/OSGiBundleImpl.java
new file mode 100644
index 0000000000..fba9a109b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/OSGiBundleImpl.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 supplychain;
+
+
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * Common code for all OSGi bundles which don't use declarative services.
+ * Registers services and sets references.
+ */
+public class OSGiBundleImpl implements ServiceListener, BundleActivator {
+
+
+ String name;
+ String serviceName;
+ String[] references;
+ Class<?>[] referenceClasses;
+ Field[] referenceFields;
+
+ Class myClass;
+
+ private BundleContext bundleContext;
+
+ public OSGiBundleImpl(String serviceName, String... references) {
+
+ myClass = this.getClass();
+ this.name = this.getClass().getSimpleName();
+ this.serviceName = serviceName;
+ this.references = references;
+
+ try {
+ referenceClasses = new Class[references.length];
+ referenceFields = new Field[references.length];
+ for (int i = 0; i < references.length; i++) {
+ referenceFields[i] = this.getClass().getDeclaredField(references[i]);
+ referenceFields[i].setAccessible(true);
+ referenceClasses[i] = referenceFields[i].getType();
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started OSGi bundle with activator " + name);
+
+ this.bundleContext = bc;
+
+ bundleContext.registerService(serviceName, this, new Hashtable());
+
+ for (int i = 0; i < references.length; i++) {
+
+ try {
+
+ ServiceReference ref = bundleContext.getServiceReference(referenceClasses[i].getName());
+ if (ref != null) {
+ Object obj = bundleContext.getService(ref);
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ } else {
+ String filter = "(objectclass=" + referenceClasses[i].getName() + ")";
+ this.bundleContext.addServiceListener(this, filter);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void stop(BundleContext bc) {
+ System.out.println("Stop OSGi bundle with activator " + name);
+
+ }
+
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ ServiceReference ref = event.getServiceReference();
+ Object obj = bundleContext.getService(ref);
+ for (int i = 0; i < references.length; i++) {
+ if (referenceClasses[i].isAssignableFrom(obj.getClass())) {
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ }
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/Customer.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..225dce0236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/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.customer;
+
+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-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..2b8c973e2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ "(v2) using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
new file mode 100644
index 0000000000..a1c7fce60a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.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 supplychain.customer;
+
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi declarative services implementation).
+ */
+public class OSGiCustomerComponentImpl implements Customer {
+
+
+ private Retailer retailer;
+
+
+ protected void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ protected void unsetRetailer(Retailer retailer) {
+ this.retailer = null;
+ }
+
+ 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-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerImpl.java
new file mode 100644
index 0000000000..4647a716c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerImpl.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 supplychain.customer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi procedural services implementation).
+ */
+public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer {
+
+ private Retailer retailer;
+
+ public OSGiCustomerImpl() {
+ super("supplychain.customer.Customer", "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-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..cc5d44d279
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (POJO implementation).
+ */
+@Service(Retailer.class)
+@Scope("STATELESS")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public JavaRetailerComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ "(v2) using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
new file mode 100644
index 0000000000..1b7fb15bf1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.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 supplychain.retailer;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi declarative services implementation).
+ */
+public class OSGiRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+
+ protected void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ protected void unsetWarehouse(Warehouse warehouse) {
+ this.warehouse = null;
+ }
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
new file mode 100644
index 0000000000..e97331c06c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerImpl.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.retailer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi procedural services implementation).
+ */
+public class OSGiRetailerImpl extends OSGiBundleImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public OSGiRetailerImpl() {
+
+ super("supplychain.retailer.Retailer", "warehouse");
+ }
+
+ public void submitOrder(String order) {
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/Retailer.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/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.retailer;
+
+/**
+ * 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-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..2d1bb68e5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/JavaShipperComponentImpl.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 supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (POJO implementation).
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ public JavaShipperComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ "(v2) using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
new file mode 100644
index 0000000000..0f88cca213
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.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 supplychain.shipper;
+
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi declarative services implementation).
+ */
+public class OSGiShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+
+ protected void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ protected void unsetCustomer(Customer customer) {
+ this.customer = null;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperImpl.java
new file mode 100644
index 0000000000..f55a068ede
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperImpl.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 supplychain.shipper;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi procedural services implementation).
+ */
+public class OSGiShipperImpl extends OSGiBundleImpl implements Shipper {
+
+ private Customer customer;
+
+ public OSGiShipperImpl() {
+ super("supplychain.shipper.Shipper", "customer");
+ }
+
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/Shipper.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/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.shipper;
+
+/**
+ * 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-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..c39a34cb96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.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 supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (POJO implementation).
+ */
+@Service(Warehouse.class)
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public JavaWarehouseComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ "(v2) using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
new file mode 100644
index 0000000000..600f3f0c74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.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 supplychain.warehouse;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (OSGi declarative services implementation).
+ */
+
+public class OSGiWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+
+ protected void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ protected void unsetShipper(Shipper shipper) {
+ this.shipper = null;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
new file mode 100644
index 0000000000..0ba54b363a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.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.warehouse;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (OSGi procedural services implementation).
+ */
+
+public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public OSGiWarehouseImpl() {
+ super("supplychain.warehouse.Warehouse", "shipper");
+ }
+
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/Warehouse.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/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.warehouse;
+
+/**
+ * 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-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/Customer2V2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/Customer2V2.componentType
new file mode 100644
index 0000000000..7edc392f46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/Customer2V2.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/CustomerV2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/CustomerV2.componentType
new file mode 100644
index 0000000000..7edc392f46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/CustomerV2.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/customer-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/customer-sca-contribution.xml
new file mode 100644
index 0000000000..4779eff514
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/customer-sca-contribution.xml
@@ -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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+
+ <import namespace="RetailerV2" location="RetailerV2" />
+ <import namespace="ShipperV2" location="ShipperV2" />
+ <import namespace="WarehouseV2" location="WarehouseV2" />
+ <export namespace="CustomerV2" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/retailer-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/retailer-sca-contribution.xml
new file mode 100644
index 0000000000..d505834f15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/retailer-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export namespace="RetailerV2" />
+
+
+ <export.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/shipper-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/shipper-sca-contribution.xml
new file mode 100644
index 0000000000..6bcf6cef0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/shipper-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export namespace="ShipperV2" />
+
+ <export.java package="supplychain.shipper"/>
+ <import.java package="supplychain.customer"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..210a68011f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/warehouse-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/warehouse-sca-contribution.xml
new file mode 100644
index 0000000000..e23e1a2ecd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/warehouse-sca-contribution.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export namespace="WarehouseV2" />
+
+
+ <export.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/RetailerV2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/RetailerV2.componentType
new file mode 100644
index 0000000000..9832da880e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/RetailerV2.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.retailer.Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/ShipperV2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/ShipperV2.componentType
new file mode 100644
index 0000000000..5586179421
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/ShipperV2.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.shipper.Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/WarehouseV2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/WarehouseV2.componentType
new file mode 100644
index 0000000000..ccc4f84ee4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/WarehouseV2.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.warehouse.Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer.mf
new file mode 100644
index 0000000000..644b207e70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: supplychain.customer.Customer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer;version="[2.0.0,3.0.0)",
+ supplychain.shipper;version="[2.0.0,3.0.0)",
+ supplychain.warehouse;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.customer;version="2.0.0"
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer2.mf
new file mode 100644
index 0000000000..e649870356
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer2.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: supplychain.customer.Customer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer,
+ supplychain.shipper,
+ supplychain.warehouse
+Export-Package: supplychain.customer;version="2.0.0"
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Retailer.mf
new file mode 100644
index 0000000000..8e8e33ecd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: supplychain.retailer.Retailer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.retailer;version="2.0.0"
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/RetailerJar.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/RetailerJar.mf
new file mode 100644
index 0000000000..2f4b56835b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/RetailerJar.mf
@@ -0,0 +1 @@
+Manifest-Version: 1.0
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Shipper.mf
new file mode 100644
index 0000000000..5f4a8b94ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: supplychain.shipper.Shipper
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.shipper;version="2.0.0"
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/SupplyChain.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/SupplyChain.mf
new file mode 100644
index 0000000000..57d2ac9e4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/SupplyChain.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SupplyChain
+Bundle-SymbolicName: supplychain.SupplyChain
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework
+Export-Package: supplychain.customer;version="2.0.0",
+ supplychain.retailer;version="2.0.0",
+ supplychain.warehouse;version="2.0.0",
+ supplychain.shipper;version="2.0.0"
+Bundle-ClassPath: .,CustomerV2.jar,RetailerV2.jar,WarehouseV2.jar,ShipperV2.jar
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Warehouse.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Warehouse.mf
new file mode 100644
index 0000000000..2e1399bb3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Warehouse.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: supplychain.warehouse.Warehouse
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.warehouse;version="2.0.0"
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/supplychain.composite b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/supplychain.composite
new file mode 100644
index 0000000000..bb8fb2b07c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes-v2/src/main/resources/supplychain.composite
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponentV2">
+ <tuscany:implementation.osgi
+ bundle="Customer"
+ bundleSymbolicName="supplychain.customer.Customer"
+ bundleVersion="2.0.0"
+ />
+
+ <!--implementation.java class="supplychain.customer.JavaCustomerComponentImpl" /-->
+ <reference name="retailer" target="RetailerComponentV2" />
+ </component>
+
+ <component name="RetailerComponentV2">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <!--implementation.osgi
+ bundle="Retailer"
+ bundleLocation="file:target/Retailer.jar"
+ /-->
+ <reference name="warehouse" target="WarehouseComponentV2"/>
+ </component>
+
+ <component name="WarehouseComponentV2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <!--implementation.osgi
+ bundle="Warehouse"
+ bundleLocation="file:target/Warehouse.jar"
+ /-->
+ <reference name="shipper" target="ShipperComponentV2" />
+ </component>
+
+ <component name="ShipperComponentV2">
+ <tuscany:implementation.osgi
+ bundle="Shipper"
+ bundleSymbolicName="supplychain.shipper.Shipper"
+ bundleVersion="2.0.0"
+ />
+ <!--implementation.java class="supplychain.shipper.JavaShipperComponentImpl" /-->
+ <reference name="customer" target="CustomerComponentV2" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/build-bundles.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/build-bundles.xml
new file mode 100644
index 0000000000..82d536cbfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/build-bundles.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 name="OSGiBundleCreator">
+
+ <target name="create-bundles">
+
+ <mkdir dir="${jar.dir}"/>
+
+ <copy file="target/classes/META-INF/${sca.contribution}" tofile="target/classes/META-INF/sca-contribution.xml"/>
+
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" manifest="${files.dir}/${manifest.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ <!-- include name="${files.list}"/-->
+ </fileset>
+ </jar>
+
+ <delete file="target/classes/META-INF/sca-contribution.xml"/>
+ </target>
+
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/pom.xml
new file mode 100644
index 0000000000..0a95927b7f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/pom.xml
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-contribution-classes-v2</artifactId>
+ <name>Apache Tuscany OSGi Contribution Version 2 classes</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>itest-osgi-contribution-classes</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-bundles</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CustomerV1.jar" />
+ <property name="manifest.file.name" value="osgi/Customer.mf" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/OSGiBundleImpl.class \
+ supplychain.composite \
+ CustomerV1.componentType \
+ RetailerV1.componentType \
+ WarehouseV1.componentType \
+ ShipperV1.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Customer2V1.jar" />
+ <property name="manifest.file.name" value="osgi/Customer2.mf" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/OSGiBundleImpl.class \
+ supplychain.composite \
+ Customer2V1.componentType \
+ RetailerV1.componentType \
+ WarehouseV1.componentType \
+ ShipperV1.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="RetailerV1.jar" />
+ <property name="manifest.file.name" value="osgi/Retailer.mf" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="RetailerJarV1.jar" />
+ <property name="manifest.file.name" value="osgi/RetailerJar.mf" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="ShipperV1.jar" />
+ <property name="manifest.file.name" value="osgi/Shipper.mf" />
+ <property name="sca.contribution" value="shipper-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/shipper/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="WarehouseV1.jar" />
+ <property name="manifest.file.name" value="osgi/Warehouse.mf" />
+ <property name="sca.contribution" value="warehouse-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/warehouse/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChainV1.jar" />
+ <property name="manifest.file.name" value="osgi/SupplyChain.mf" />
+ <property name="sca.contribution" value="supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/** \
+ supplychain.composite \
+ CustomerV1.componentType \
+ RetailerV1.componentType \
+ WarehouseV1.componentType \
+ ShipperV1.componentType \
+ CustomerV1.jar \
+ RetailerV1.jar \
+ WarehouseV1.jar \
+ ShipperV1.jar \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/OSGiBundleImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/OSGiBundleImpl.java
new file mode 100644
index 0000000000..fba9a109b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/OSGiBundleImpl.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 supplychain;
+
+
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * Common code for all OSGi bundles which don't use declarative services.
+ * Registers services and sets references.
+ */
+public class OSGiBundleImpl implements ServiceListener, BundleActivator {
+
+
+ String name;
+ String serviceName;
+ String[] references;
+ Class<?>[] referenceClasses;
+ Field[] referenceFields;
+
+ Class myClass;
+
+ private BundleContext bundleContext;
+
+ public OSGiBundleImpl(String serviceName, String... references) {
+
+ myClass = this.getClass();
+ this.name = this.getClass().getSimpleName();
+ this.serviceName = serviceName;
+ this.references = references;
+
+ try {
+ referenceClasses = new Class[references.length];
+ referenceFields = new Field[references.length];
+ for (int i = 0; i < references.length; i++) {
+ referenceFields[i] = this.getClass().getDeclaredField(references[i]);
+ referenceFields[i].setAccessible(true);
+ referenceClasses[i] = referenceFields[i].getType();
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started OSGi bundle with activator " + name);
+
+ this.bundleContext = bc;
+
+ bundleContext.registerService(serviceName, this, new Hashtable());
+
+ for (int i = 0; i < references.length; i++) {
+
+ try {
+
+ ServiceReference ref = bundleContext.getServiceReference(referenceClasses[i].getName());
+ if (ref != null) {
+ Object obj = bundleContext.getService(ref);
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ } else {
+ String filter = "(objectclass=" + referenceClasses[i].getName() + ")";
+ this.bundleContext.addServiceListener(this, filter);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void stop(BundleContext bc) {
+ System.out.println("Stop OSGi bundle with activator " + name);
+
+ }
+
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ ServiceReference ref = event.getServiceReference();
+ Object obj = bundleContext.getService(ref);
+ for (int i = 0; i < references.length; i++) {
+ if (referenceClasses[i].isAssignableFrom(obj.getClass())) {
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ }
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/Customer.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..225dce0236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/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.customer;
+
+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-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..d0b0a13e6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
new file mode 100644
index 0000000000..a1c7fce60a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.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 supplychain.customer;
+
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi declarative services implementation).
+ */
+public class OSGiCustomerComponentImpl implements Customer {
+
+
+ private Retailer retailer;
+
+
+ protected void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ protected void unsetRetailer(Retailer retailer) {
+ this.retailer = null;
+ }
+
+ 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-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerImpl.java
new file mode 100644
index 0000000000..4647a716c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerImpl.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 supplychain.customer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi procedural services implementation).
+ */
+public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer {
+
+ private Retailer retailer;
+
+ public OSGiCustomerImpl() {
+ super("supplychain.customer.Customer", "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-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..d2bf71ed28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (POJO implementation).
+ */
+@Service(Retailer.class)
+@Scope("STATELESS")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public JavaRetailerComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
new file mode 100644
index 0000000000..1b7fb15bf1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.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 supplychain.retailer;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi declarative services implementation).
+ */
+public class OSGiRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+
+ protected void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ protected void unsetWarehouse(Warehouse warehouse) {
+ this.warehouse = null;
+ }
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
new file mode 100644
index 0000000000..e97331c06c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerImpl.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.retailer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi procedural services implementation).
+ */
+public class OSGiRetailerImpl extends OSGiBundleImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public OSGiRetailerImpl() {
+
+ super("supplychain.retailer.Retailer", "warehouse");
+ }
+
+ public void submitOrder(String order) {
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/Retailer.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/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.retailer;
+
+/**
+ * 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-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..2556a0cfa0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.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 supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (POJO implementation).
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ public JavaShipperComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
new file mode 100644
index 0000000000..0f88cca213
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.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 supplychain.shipper;
+
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi declarative services implementation).
+ */
+public class OSGiShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+
+ protected void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ protected void unsetCustomer(Customer customer) {
+ this.customer = null;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperImpl.java
new file mode 100644
index 0000000000..f55a068ede
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperImpl.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 supplychain.shipper;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi procedural services implementation).
+ */
+public class OSGiShipperImpl extends OSGiBundleImpl implements Shipper {
+
+ private Customer customer;
+
+ public OSGiShipperImpl() {
+ super("supplychain.shipper.Shipper", "customer");
+ }
+
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/Shipper.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/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.shipper;
+
+/**
+ * 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-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..e180c37e3f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.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 supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (POJO implementation).
+ */
+@Service(Warehouse.class)
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public JavaWarehouseComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
new file mode 100644
index 0000000000..600f3f0c74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.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 supplychain.warehouse;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (OSGi declarative services implementation).
+ */
+
+public class OSGiWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+
+ protected void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ protected void unsetShipper(Shipper shipper) {
+ this.shipper = null;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
new file mode 100644
index 0000000000..0ba54b363a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.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.warehouse;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (OSGi procedural services implementation).
+ */
+
+public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public OSGiWarehouseImpl() {
+ super("supplychain.warehouse.Warehouse", "shipper");
+ }
+
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/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.warehouse;
+
+/**
+ * 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-android/itest/osgi-contribution/contribution-classes/src/main/resources/Customer2V1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/Customer2V1.componentType
new file mode 100644
index 0000000000..7edc392f46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/Customer2V1.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/CustomerV1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/CustomerV1.componentType
new file mode 100644
index 0000000000..7edc392f46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/CustomerV1.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml
new file mode 100644
index 0000000000..828dc6f472
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+ <import namespace="RetailerV1" location="RetailerV1" />
+ <import namespace="ShipperV1" location="ShipperV1" />
+ <import namespace="WarehouseV1" location="WarehouseV1" />
+ <export namespace="CustomerV1" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml
new file mode 100644
index 0000000000..9293b1ff52
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/retailer-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+ <export namespace="RetailerV1" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml
new file mode 100644
index 0000000000..03077aa4d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/shipper-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.shipper"/>
+ <import.java package="supplychain.customer"/>
+ <export namespace="ShipperV1" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..210a68011f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml
new file mode 100644
index 0000000000..c96deb4e1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/warehouse-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://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+ <export namespace="WarehouseV1" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/RetailerV1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/RetailerV1.componentType
new file mode 100644
index 0000000000..9832da880e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/RetailerV1.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.retailer.Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/ShipperV1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/ShipperV1.componentType
new file mode 100644
index 0000000000..5586179421
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/ShipperV1.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.shipper.Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/WarehouseV1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/WarehouseV1.componentType
new file mode 100644
index 0000000000..ccc4f84ee4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/WarehouseV1.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.warehouse.Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer.mf
new file mode 100644
index 0000000000..404995a90f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer;version="[1.0.0,2.0.0)",
+ supplychain.warehouse;version="[1.0.0,2.0.0)",
+ supplychain.shipper;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.customer;version="1.0.0"
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer2.mf
new file mode 100644
index 0000000000..0441e8c6f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer2.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer,
+ supplychain.shipper,
+ supplychain.warehouse
+Export-Package: supplychain.customer;version="1.0.0"
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Retailer.mf
new file mode 100644
index 0000000000..ac0ca72030
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.retailer;version="1.0.0"
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/RetailerJar.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/RetailerJar.mf
new file mode 100644
index 0000000000..2f4b56835b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/RetailerJar.mf
@@ -0,0 +1 @@
+Manifest-Version: 1.0
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Shipper.mf
new file mode 100644
index 0000000000..61f62fa16e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.shipper;version="1.0.0"
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/SupplyChain.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/SupplyChain.mf
new file mode 100644
index 0000000000..dc4aa2c30e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/SupplyChain.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SupplyChain
+Bundle-SymbolicName: supplychain.SupplyChain
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework
+Export-Package: supplychain.customer;version="1.0.0",
+ supplychain.retailer;version="1.0.0",
+ supplychain.warehouse;version="1.0.0",
+ supplychain.shipper;version="1.0.0"
+Bundle-ClassPath: .,CustomerV1.jar,RetailerV1.jar,WarehouseV1.jar,ShipperV1.jar
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Warehouse.mf b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Warehouse.mf
new file mode 100644
index 0000000000..d149165366
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Warehouse.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.warehouse;version="1.0.0"
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/supplychain.composite b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/supplychain.composite
new file mode 100644
index 0000000000..4a18aed5f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-classes/src/main/resources/supplychain.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <!--tuscany:implementation.osgi
+ bundle="Customer"
+ bundleLocation="file:target/Customer.jar"
+ scope="COMPOSITE"
+ /-->
+
+ <implementation.java class="supplychain.customer.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <!--implementation.osgi
+ bundle="Retailer"
+ bundleLocation="file:target/Retailer.jar"
+ /-->
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <!--implementation.osgi
+ bundle="Warehouse"
+ bundleLocation="file:target/Warehouse.jar"
+ /-->
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <!--tuscany:implementation.osgi
+ bundle="Shipper"
+ bundleLocation="file:target/Shipper.jar"
+ /-->
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/pom.xml
new file mode 100644
index 0000000000..6853aba2d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-contribution-test</artifactId>
+ <name>Apache Tuscany OSGi Contribution tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr</artifactId>
+ <version>1.0.2</version>
+ </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-android/itest/osgi-contribution/contribution-test/src/main/java/org/apache/tuscany/sca/contribution/osgi/OSGiTestUtil.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/main/java/org/apache/tuscany/sca/contribution/osgi/OSGiTestUtil.java
new file mode 100644
index 0000000000..108481fcbd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/main/java/org/apache/tuscany/sca/contribution/osgi/OSGiTestUtil.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.contribution.osgi;
+
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * OSGi Test Utils
+ */
+public class OSGiTestUtil {
+
+ public static BundleContext setUpOSGiTestRuntime() throws Exception {
+
+ setUpFelixTestRuntime();
+ return OSGiRuntime.getRuntime().getBundleContext();
+ }
+
+
+ public static void setUpFelixTestRuntime() throws Exception {
+
+ String felixConfigFileName = "file:target/test-classes/osgi/felix/felix.config.properties";
+
+ System.setProperty("felix.config.properties", felixConfigFileName);
+
+ try {
+
+ ClassLoader cl = OSGiTestUtil.class.getClassLoader();
+
+ Class felixMainClass = cl.loadClass("org.apache.felix.main.Main");
+ if (felixMainClass != null) {
+ String felixDir = felixMainClass.getProtectionDomain().getCodeSource().getLocation().getPath();
+ int index = 0;
+ if ((index = felixDir.indexOf("/org.apache.felix.main")) >= 0) {
+ felixDir = felixDir.substring(0, index);
+ System.setProperty("FELIX_DIR", felixDir);
+ }
+ }
+
+ } catch (Exception e) {
+ // Ignore
+ }
+
+
+ }
+
+ public static void shutdownOSGiRuntime() {
+ try {
+ OSGiRuntime.stop();
+
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/MixedContributionTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/MixedContributionTestCase.java
new file mode 100644
index 0000000000..28fe368663
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/MixedContributionTestCase.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.osgi.test;
+
+
+/*
+ *
+ * Supplychain using OSGi and non-OSGi contributions
+ *
+ *
+ */
+
+public class MixedContributionTestCase extends SCAResolverTestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+
+
+ customerJarName = "Customer2";
+ retailerJarName = "RetailerJar";
+
+ setUpOSGi();
+ setUpSCA();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/NestedBundleTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/NestedBundleTestCase.java
new file mode 100644
index 0000000000..be3b7365e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/NestedBundleTestCase.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.osgi.test;
+
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.osgi.OSGiTestUtil;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+/*
+ *
+ * Supplychain using OSGi contributions, with nested jar files and bundles used
+ * by <implementation.java/> and <implementation.osgi/>
+ *
+ * SupplyChain v1 is a bundle containing jar files which are used by <implementation.java/>
+ * SupplyChain v2 is a bundle containing bundles which are used by <implementation.osgi/>
+ */
+
+public class NestedBundleTestCase extends TestCase {
+
+
+ protected EmbeddedSCADomain domain;
+
+ private SupplyChain supplyChainV1;
+ private SupplyChain supplyChainV2;
+
+ @Override
+ protected void setUp() throws Exception {
+
+ setUpOSGi();
+ setUpSCA();
+ }
+
+ protected void setUpOSGi() throws Exception {
+ OSGiTestUtil.setUpFelixTestRuntime();
+ }
+
+ protected void setUpSCA() throws Exception {
+ //Create a test embedded SCA domain
+ ClassLoader cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+ supplyChainV1 = new SupplyChain("../contribution-classes/target/classes",
+ contributionService, "V1");
+ supplyChainV1.setUpSCA();
+
+ supplyChainV2 = new SupplyChain("../contribution-classes-v2/target/classes",
+ contributionService, "V2");
+ supplyChainV2.setUpSCA();
+ }
+
+
+
+ @Override
+ public void tearDown() throws Exception {
+
+
+ supplyChainV1.tearDownSCA();
+ supplyChainV2.tearDownSCA();
+
+ domain.stop();
+
+ domain.close();
+
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public void test() throws Exception {
+
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = supplyChainV1.supplychainContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class customerClass = customerClassRef.getJavaClass();
+
+ Object customer =
+ domain.getService(customerClass, "CustomerComponent");
+
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+
+ ClassReference customerClassRefV2 = new ClassReference("supplychain.customer.Customer");
+ customerClassRefV2 = supplyChainV2.supplychainContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRefV2);
+ Class customerClassV2 = customerClassRefV2.getJavaClass();
+
+ Object customerV2 =
+ domain.getService(customerClassV2, "CustomerComponentV2");
+
+ Method mV2 = customerClassV2.getMethod("purchaseGoods");
+ mV2.invoke(customerV2);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+
+ System.out.println("Test complete");
+
+ }
+
+ private class SupplyChain {
+
+ private String folderName;
+ private ContributionService contributionService;
+ private String version;
+
+ private Contribution supplychainContribution;
+
+
+ public SupplyChain(String folderName, ContributionService contributionService, String version) {
+ this.folderName = folderName;
+ this.contributionService = contributionService;
+ this.version = version;
+ }
+
+ protected void setUpSCA() throws Exception {
+ File supplychainLocation = new File(folderName + "/SupplyChain" + version + ".jar");
+ URL supplychainContribURL = supplychainLocation.toURL();
+
+
+ String supplychainURI = "SupplyChain" + version;
+
+ supplychainContribution = contributionService.contribute(
+ supplychainURI, supplychainContribURL, true);
+
+ for (Composite deployable : supplychainContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : supplychainContribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void tearDownSCA() throws Exception {
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("SupplyChain" + version);
+
+ // Stop Components from my composite
+ for (Composite deployable : supplychainContribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/OSGiResolverTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/OSGiResolverTestCase.java
new file mode 100644
index 0000000000..03372349f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/OSGiResolverTestCase.java
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.contribution.osgi.test;
+
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Hashtable;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.osgi.OSGiTestUtil;
+import org.apache.tuscany.sca.contribution.osgi.impl.OSGiModelResolverImpl;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/*
+ *
+ * Supplychain using OSGi contributions, using an OSGi ModelResolver
+ *
+ * Notes:
+ * All OSGi bundle references should be resolvable using pure OSGi bundle mechanisms. No
+ * dummy bundles will be created to resolve combinations of OSGi and non-OSGi contributions
+ *
+ * All dependent OSGi contribution bundles should be installed before the referring contribution.
+ * Hence dependencies should be a tree and cannot contain cycles.
+ *
+ * For Jar files contained within OSGi bundles, Bundle-Classpath should be
+ * set so that standard OSGi class resolution is sufficient to resolve classes containing in
+ * nested jars or bundles.
+ */
+
+public class OSGiResolverTestCase extends TestCase {
+
+
+ protected EmbeddedSCADomain domain;
+ protected BundleContext bundleContext;
+
+ private SupplyChain supplyChainV1;
+ private SupplyChain supplyChainV2;
+
+ @Override
+ protected void setUp() throws Exception {
+
+ setUpOSGi();
+ setUpSCA();
+ }
+
+ protected void setUpOSGi() throws Exception {
+ bundleContext = OSGiTestUtil.setUpOSGiTestRuntime();
+ }
+
+ protected void setUpSCA() throws Exception {
+ //Create a test embedded SCA domain
+ ClassLoader cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+ supplyChainV1 = new SupplyChain("../contribution-classes/target/classes",
+ contributionService, "V1");
+ supplyChainV1.setUpSCA();
+
+ supplyChainV2 = new SupplyChain("../contribution-classes-v2/target/classes",
+ contributionService, "V2");
+ supplyChainV2.setUpSCA();
+ }
+
+
+
+ @Override
+ public void tearDown() throws Exception {
+
+
+ supplyChainV1.tearDownSCA();
+ supplyChainV2.tearDownSCA();
+
+ domain.stop();
+
+ domain.close();
+
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public void test() throws Exception {
+
+ Class customerClass = supplyChainV1.customerBundle.loadClass("supplychain.customer.Customer");
+
+ Object customer =
+ domain.getService(customerClass, "CustomerComponent");
+
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+
+ Class customerClassV2 = supplyChainV2.customerBundle.loadClass("supplychain.customer.Customer");
+
+ Object customerV2 =
+ domain.getService(customerClassV2, "CustomerComponentV2");
+
+ Method mV2 = customerClassV2.getMethod("purchaseGoods");
+ mV2.invoke(customerV2);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+
+ System.out.println("Test complete");
+
+ }
+
+ private class SupplyChain {
+
+ private String folderName;
+ private ContributionService contributionService;
+ private String version;
+
+ private Bundle customerBundle;
+
+
+ private Contribution customerContribution;
+ private Contribution retailerContribution;
+ private Contribution warehouseContribution;
+ private Contribution shipperContribution;
+
+
+ public SupplyChain(String folderName, ContributionService contributionService, String version) {
+ this.folderName = folderName;
+ this.contributionService = contributionService;
+ this.version = version;
+ }
+
+ protected void setUpSCA() throws Exception {
+ File customerLocation = new File(folderName + "/Customer" + version + ".jar");
+ URL customerContribURL = customerLocation.toURL();
+ File retailerLocation = new File(folderName + "/Retailer" + version + ".jar");
+ URL retailerContribURL = retailerLocation.toURL();
+ File warehouseLocation = new File(folderName + "/Warehouse" + version + ".jar");
+ URL warehouseContribURL = warehouseLocation.toURL();
+ File shipperLocation = new File(folderName + "/Shipper" + version + ".jar");
+ URL shipperContribURL = shipperLocation.toURL();
+
+ customerBundle = bundleContext.installBundle(customerContribURL.toString());
+ Bundle retailerBundle = bundleContext.installBundle(retailerContribURL.toString());
+ Bundle warehouseBundle = bundleContext.installBundle(warehouseContribURL.toString());
+ Bundle shipperBundle = bundleContext.installBundle(shipperContribURL.toString());
+
+ Hashtable<String,Bundle> bundles = new Hashtable<String,Bundle>();
+ bundles.put("Customer" + version + ".jar", customerBundle);
+ bundles.put("Retailer" + version + ".jar", retailerBundle);
+ bundles.put("Warehouse" + version + ".jar", warehouseBundle);
+ bundles.put("Shipper" + version + ".jar", shipperBundle);
+
+ ModelResolver customerResolver = new OSGiModelResolverImpl(bundles);
+
+ bundles = new Hashtable<String,Bundle>();
+ bundles.put("Retailer" + version + ".jar", retailerBundle);
+ ModelResolver retailerResolver = new OSGiModelResolverImpl(bundles);
+
+ bundles = new Hashtable<String,Bundle>();
+ bundles.put("Warehouse" + version + ".jar", warehouseBundle);
+ ModelResolver warehouseResolver = new OSGiModelResolverImpl(bundles);
+
+ bundles = new Hashtable<String,Bundle>();
+ bundles.put("Shipper" + version + ".jar", shipperBundle);
+ ModelResolver shipperResolver = new OSGiModelResolverImpl(bundles);
+
+
+ shipperContribution = contributionService.contribute(
+ "Shipper" + version,
+ shipperContribURL, shipperResolver, false);
+ warehouseContribution = contributionService.contribute(
+ "Warehouse" + version,
+ warehouseContribURL, warehouseResolver, false);
+ retailerContribution = contributionService.contribute(
+ "Retailer" + version,
+ retailerContribURL, retailerResolver, false);
+
+ customerContribution = contributionService.contribute(
+ "Customer" + version,
+ customerContribURL, customerResolver, false);
+
+ for (Composite deployable : customerContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+
+ for (Composite deployable : retailerContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : warehouseContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : shipperContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : customerContribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void tearDownSCA() throws Exception {
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("Customer" + version);
+ contributionService.remove("Retailer" + version);
+ contributionService.remove("Warehouse" + version);
+ contributionService.remove("Shipper" + version);
+
+
+ // Stop Components from my composite
+ for (Composite deployable : customerContribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/SCAResolverTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/SCAResolverTestCase.java
new file mode 100644
index 0000000000..a2b3a7bc92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/SCAResolverTestCase.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.osgi.test;
+
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.osgi.OSGiTestUtil;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/*
+ *
+ * Supplychain using OSGi contributions, using default SCA resolver
+ *
+ * This test uses two sets of four contributions where each set contains a bundle corresponding
+ * to the four components of supplychain (customer, retailer, warehouse and shipper).
+ * Tests classes from the bundle used in <implementation.java/>, and the bundles themselves
+ * used as the bundle in <implementation.osgi/>.
+ *
+ * Notes:
+ * All OSGi bundle references should be resolvable using pure OSGi bundle mechanisms. No
+ * dummy bundles will be created to resolve combinations of OSGi and non-OSGi contributions
+ *
+ * Notes:
+ * All OSGi bundle references should be resolvable using pure OSGi bundle mechanisms. No
+ * dummy bundles will be created to resolve combinations of OSGi and non-OSGi contributions
+ *
+ * All dependent OSGi contribution bundles should be installed before the referring contribution.
+ * Hence dependencies should be a tree and cannot contain cycles.
+ *
+ * For Jar files contained within OSGi bundles, Bundle-Classpath should be
+ * set so that standard OSGi class resolution is sufficient to resolve classes containing in
+ * nested jars or bundles.
+ */
+
+public class SCAResolverTestCase extends TestCase {
+
+
+ protected EmbeddedSCADomain domain;
+
+ private SupplyChain supplyChainV1;
+ private SupplyChain supplyChainV2;
+
+
+ protected String customerJarName = "Customer";
+ protected String retailerJarName = "Retailer";
+ protected String warehouseJarName = "Warehouse";
+ protected String shipperJarName = "Shipper";
+
+
+
+ @Override
+ protected void setUp() throws Exception {
+
+ setUpOSGi();
+ setUpSCA();
+ }
+
+ protected void setUpOSGi() throws Exception {
+ OSGiTestUtil.setUpFelixTestRuntime();
+ }
+
+ protected void setUpSCA() throws Exception {
+ //Create a test embedded SCA domain
+ ClassLoader cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+ supplyChainV1 = new SupplyChain("../contribution-classes/target/classes",
+ contributionService, "V1");
+ supplyChainV1.setUpSCA();
+
+ supplyChainV2 = new SupplyChain("../contribution-classes-v2/target/classes",
+ contributionService, "V2");
+ supplyChainV2.setUpSCA();
+ }
+
+
+
+ @Override
+ public void tearDown() throws Exception {
+
+
+ supplyChainV1.tearDownSCA();
+ supplyChainV2.tearDownSCA();
+
+ domain.stop();
+
+ domain.close();
+
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public void test() throws Exception {
+
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = supplyChainV1.customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class customerClass = customerClassRef.getJavaClass();
+
+ Object customer =
+ domain.getService(customerClass, "CustomerComponent");
+
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+
+ ClassReference customerClassRefV2 = new ClassReference("supplychain.customer.Customer");
+ customerClassRefV2 = supplyChainV2.customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRefV2);
+ Class customerClassV2 = customerClassRefV2.getJavaClass();
+
+ Object customerV2 =
+ domain.getService(customerClassV2, "CustomerComponentV2");
+
+ Method mV2 = customerClassV2.getMethod("purchaseGoods");
+ mV2.invoke(customerV2);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+
+ System.out.println("Test complete");
+
+ }
+
+ private class SupplyChain {
+
+ private String folderName;
+ private ContributionService contributionService;
+ private String version;
+
+ private Contribution customerContribution;
+ private Contribution retailerContribution;
+ private Contribution warehouseContribution;
+ private Contribution shipperContribution;
+
+
+ public SupplyChain(String folderName, ContributionService contributionService, String version) {
+ this.folderName = folderName;
+ this.contributionService = contributionService;
+ this.version = version;
+ }
+
+ protected void setUpSCA() throws Exception {
+ File customerLocation = new File(folderName + "/" + customerJarName + version + ".jar");
+ URL customerContribURL = customerLocation.toURL();
+ File retailerLocation = new File(folderName + "/" + retailerJarName + version + ".jar");
+ URL retailerContribURL = retailerLocation.toURL();
+ File warehouseLocation = new File(folderName + "/" + warehouseJarName + version + ".jar");
+ URL warehouseContribURL = warehouseLocation.toURL();
+ File shipperLocation = new File(folderName + "/" + shipperJarName + version + ".jar");
+ URL shipperContribURL = shipperLocation.toURL();
+
+ shipperContribution = contributionService.contribute("Shipper"
+ + version, shipperContribURL, true);
+ warehouseContribution = contributionService.contribute("Warehouse"
+ + version, warehouseContribURL, true);
+ retailerContribution = contributionService.contribute("Retailer"
+ + version, retailerContribURL, true);
+ customerContribution = contributionService.contribute("Customer"
+ + version, customerContribURL, true);
+
+
+ for (Composite deployable : customerContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+
+ for (Composite deployable : retailerContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : warehouseContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : shipperContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : customerContribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void tearDownSCA() throws Exception {
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("Customer" + version);
+ contributionService.remove("Retailer" + version);
+ contributionService.remove("Warehouse" + version);
+ contributionService.remove("Shipper" + version);
+
+
+ // Stop Components from my composite
+ for (Composite deployable : customerContribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/resources/osgi/felix/felix.config.properties b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/resources/osgi/felix/felix.config.properties
new file mode 100644
index 0000000000..ea8d272a0c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/contribution-test/src/test/resources/osgi/felix/felix.config.properties
@@ -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.
+#
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \
+ org.osgi.service.packageadmin; version=1.2.0, \
+ org.osgi.service.startlevel; version=1.0.0, \
+ org.osgi.service.url; version=1.0.0 \
+ org.osgi.util.tracker; version=1.3.2
+
+
+felix.auto.start.1= \
+ "file://${FELIX_DIR}/org.apache.felix.scr/1.0.2/org.apache.felix.scr-1.0.2.jar" \
+ "file://${FELIX_DIR}/org.apache.felix.configadmin/1.0.1/org.apache.felix.configadmin-1.0.1.jar"
+
+# "file://${FELIX_DIR}/org.apache.felix.bundlerepository/1.0.3/org.apache.felix.bundlerepository-1.0.3.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.shell/1.0.1/org.apache.felix.shell-1.0.1.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.shell.tui/1.0.1/org.apache.felix.shell.tui-1.0.1.jar" \
+
+felix.startlevel.framework=1
+felix.startlevel.bundle=1
+
+#
+# Bundle config properties.
+#
+org.osgi.service.http.port=8080
+obr.shell.telnet=on
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-contribution/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/pom.xml
new file mode 100644
index 0000000000..22a677925e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-contribution/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-osgi</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany OSGi Contribution Tests</name>
+
+ <modules>
+ <module>contribution-classes</module>
+ <module>contribution-classes-v2</module>
+ <module>contribution-test</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/build-bundles.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/build-bundles.xml
new file mode 100644
index 0000000000..53bf014546
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/build-bundles.xml
@@ -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.
+-->
+<project name="OSGiBundleCreator">
+
+ <target name="create-bundles">
+
+ <mkdir dir="${jar.dir}"/>
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" manifest="${files.dir}/${manifest.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ <!-- include name="${files.list}"/-->
+ </fileset>
+ </jar>
+ </target>
+
+ <!-- Add a file to a jar file, into a different path in the jar file -->
+ <target name="update-bundle">
+
+ <copy overwrite="true" todir="${files.dir}/${target.dir}" >
+ <fileset dir="${files.dir}/${source.dir}" includes="${files.list}" />
+ </copy>
+ <jar update="true" jarfile="${jar.dir}/${jar.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}" />
+ </jar>
+ <delete>
+ <fileset dir="${files.dir}/${target.dir}" includes="${files.list}" />
+ </delete>
+ </target>
+
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/pom.xml
new file mode 100644
index 0000000000..d9249b6b9f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/pom.xml
@@ -0,0 +1,1220 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-implementation</artifactId>
+ <name>Apache Tuscany SCA OSGi-SCA Integration Tests</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.0.1</version>
+ <!-- Exclude the javax.servlet to avoid conflict -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>javax.servlet</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-lib</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>itest-osgi-implementation</finalName>
+ <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-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.1.1</version>
+ <executions>
+ <execution>
+ <id>generate-helloworld-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/sdo/ds/helloworld.wsdl</schemaFile>
+ <javaPackage>helloworld.sdo</javaPackage>
+ <prefix>Helloworld</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-bundles</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerImpl.class \
+ supplychain/retailer/OSGiRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class \
+ supplychain/shipper/OSGiShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class \
+ supplychain/warehouse/OSGiWarehouseServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/ds/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/wiring/ds/Customer.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/ds/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/wiring/ds/Retailer1.xml \
+ osgi/wiring/ds/Retailer2.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/ds/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/wiring/ds/Shipper1.xml \
+ osgi/wiring/ds/Shipper2.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/ds/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/wiring/ds/Warehouse1.xml \
+ osgi/wiring/ds/Warehouse2.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerImpl.class \
+ supplychain/customer/OSGiStatelessCustomerImpl.class \
+ supplychain/customer/OSGiCustomerFactoryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerImpl.class \
+ supplychain/retailer/OSGiRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class \
+ supplychain/shipper/OSGiShipperServiceImpl.class \
+ supplychain/shipper/OSGiStatelessShipperServiceImpl.class \
+ supplychain/shipper/OSGiShipperFactoryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/ds/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/factory/ds/Customer.xml \
+ supplychain/customer/OSGiStatelessCustomerComponentImpl.class \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/ds/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/factory/ds/Retailer1.xml \
+ osgi/factory/ds/Retailer2.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/ds/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/factory/ds/Shipper1.xml \
+ osgi/factory/ds/Shipper2.xml \
+ supplychain/shipper/OSGiStatelessShipperComponentImpl.class \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/ds/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/factory/ds/Warehouse.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerImpl.class \
+ supplychain/retailer/OSGiRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class \
+ supplychain/shipper/OSGiShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class \
+ supplychain/warehouse/OSGiWarehouseServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/ds/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/services/ds/Customer.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/ds/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/services/ds/Retailer1.xml \
+ osgi/services/ds/Retailer2.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/ds/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/services/ds/Shipper1.xml \
+ osgi/services/ds/Shipper2.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/ds/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/services/ds/Warehouse1.xml \
+ osgi/services/ds/Warehouse2.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerWithQueryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/retailer/RetailerQuery.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerWithQueryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class \
+ supplychain/shipper/OSGiShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/ds/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/interfaces/ds/Customer.xml \
+ supplychain/customer/OSGiCustomerWithQueryComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/ds/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/retailer/RetailerQuery.class \
+ osgi/interfaces/ds/Retailer.xml \
+ supplychain/retailer/OSGiRetailerWithQueryComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/ds/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/interfaces/ds/Shipper.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Customer1.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiVersionedCustomerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Retailer1.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiVersionedRetailerImpl.class \
+ supplychain/retailer/OSGiVersionedRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Shipper1.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiVersionedShipperImpl.class \
+ supplychain/shipper/OSGiVersionedShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Warehouse1.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class \
+ supplychain/warehouse/OSGiWarehouseServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Customer2.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiVersionedCustomerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Retailer2.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiVersionedRetailerImpl.class \
+ supplychain/retailer/OSGiVersionedRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Shipper2.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiVersionedShipperImpl.class \
+ supplychain/shipper/OSGiVersionedShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Warehouse2.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class \
+ supplychain/warehouse/OSGiWarehouseServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Customer1.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/version/ds/CustomerV1.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Customer2.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/version/ds/CustomerV2.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Retailer1.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/version/ds/Retailer1V1.xml \
+ osgi/version/ds/Retailer2V1.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Retailer2.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/version/ds/Retailer1V2.xml \
+ osgi/version/ds/Retailer2V2.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Shipper1.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/version/ds/Shipper1V1.xml \
+ osgi/version/ds/Shipper2V1.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Shipper2.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/version/ds/Shipper1V2.xml \
+ osgi/version/ds/Shipper2V2.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Warehouse1.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/version/ds/Warehouse1V1.xml \
+ osgi/version/ds/Warehouse2V1.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Warehouse2.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/version/ds/Warehouse1V2.xml \
+ osgi/version/ds/Warehouse2V2.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/ws" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="HelloWorld.jar" />
+ <property name="manifest.file.name"
+ value="osgi/ws/HelloWorld.mf" />
+ <property name="files.list"
+ value="helloworld/HelloWorld.class \
+ helloworld/OSGiHelloWorldImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/passbyref" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Greetings.jar" />
+ <property name="manifest.file.name"
+ value="osgi/passbyref/Greetings.mf" />
+ <property name="files.list"
+ value="helloworld/Greetings.class \
+ helloworld/OSGiGreetingsImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/callback" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="CallbackClient.jar" />
+ <property name="manifest.file.name"
+ value="osgi/callback/CallbackClient.mf" />
+ <property name="files.list"
+ value="callback/client/CallbackClient.class \
+ callback/client/CallbackCallback.class \
+ callback/client/OSGiCallbackClientImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/callback" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="CallbackService.jar" />
+ <property name="manifest.file.name"
+ value="osgi/callback/CallbackService.mf" />
+ <property name="files.list"
+ value="callback/service/CallbackService.class \
+ callback/service/OSGiCallbackServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/conversation" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="ConversationalClient.jar" />
+ <property name="manifest.file.name"
+ value="osgi/conversation/ConversationalClient.mf" />
+ <property name="files.list"
+ value="conversation/client/ConversationalClientStatefulImpl.class \
+ conversation/client/ConversationalClientStatelessImpl.class \
+ conversation/client/ConversationalCallback.class \
+ conversation/client/ConversationalClient.class \
+ conversation/client/ConversationalClientServiceFactory.class \
+ conversation/client/ConversationalClientActivator.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/conversation" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="ConversationalReferenceClient.jar" />
+ <property name="manifest.file.name"
+ value="osgi/conversation/ConversationalReferenceClient.mf" />
+ <property name="files.list"
+ value="conversation/referenceclient/ConversationalReferenceClient.class \
+ conversation/referenceclient/ConversationalReferenceClientImpl.class \
+ conversation/referenceclient/ConversationalReferenceClientActivator.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/conversation" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="ConversationalService.jar" />
+ <property name="manifest.file.name"
+ value="osgi/conversation/ConversationalService.mf" />
+ <property name="files.list"
+ value="conversation/service/ConversationalService.class \
+ conversation/service/ConversationalServiceStatefulImpl.class \
+ conversation/service/ConversationalServiceStatelessImpl.class
+ conversation/service/ConversationalServiceFactory.class \
+ conversation/service/ConversationalServiceActivator.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/conversation" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="ConversationalService.jar" />
+ <property name="manifest.file.name"
+ value="osgi/conversation/ConversationalService.mf" />
+ <property name="files.list"
+ value="conversation/ConversationalService.class \
+ conversation/ConversationalServiceStatefulImpl.class \
+ conversation/ConversationalServiceStatelessImpl.class
+ conversation/ConversationalServiceFactory.class \
+ conversation/OSGiConversationTestActivator.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/properties" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="StockQuote.jar" />
+ <property name="manifest.file.name"
+ value="osgi/properties/StockQuote.mf" />
+ <property name="files.list"
+ value="stockquote/StockQuote.class \
+ stockquote/OSGiStockQuoteImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/properties/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="StockQuote.jar" />
+ <property name="manifest.file.name"
+ value="osgi/properties/ds/StockQuote.mf" />
+ <property name="files.list"
+ value="stockquote/StockQuote.class \
+ osgi/properties/ds/StockQuote.xml \
+ stockquote/OSGiStockQuoteComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/properties" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="StockQuoteFactory.jar" />
+ <property name="manifest.file.name"
+ value="osgi/properties/StockQuoteFactory.mf" />
+ <property name="files.list"
+ value="stockquote/StockQuote.class \
+ stockquote/OSGiStockQuoteImpl.class \
+ stockquote/OSGiStockQuoteFactoryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/properties/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="StockQuoteFactory.jar" />
+ <property name="manifest.file.name"
+ value="osgi/properties/ds/StockQuoteFactory.mf" />
+ <property name="files.list"
+ value="stockquote/StockQuote.class \
+ osgi/properties/ds/StockQuoteFactory.xml \
+ stockquote/OSGiStockQuoteComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/sdo/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="HelloWorldService.jar" />
+ <property name="manifest.file.name"
+ value="osgi/sdo/ds/HelloWorldService.mf" />
+ <property name="files.list"
+ value="helloworld/sdo/HelloWorldService.class \
+ osgi/sdo/ds/HelloWorldService.xml \
+ helloworld/sdo/impl/* \
+ helloworld/sdo/Name.class \
+ helloworld/sdo/getGreetings* \
+ helloworld/sdo/HelloworldFactory.class \
+ helloworld/sdo/HelloWorldServiceComponent.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/sdo/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="HelloWorldClient.jar" />
+ <property name="manifest.file.name"
+ value="osgi/sdo/ds/HelloWorldClient.mf" />
+ <property name="files.list"
+ value="helloworld/sdo/client/HelloWorldClient.class \
+ osgi/sdo/ds/HelloWorldClient.xml \
+ sdo/ds/helloworldsdo.composite \
+ helloworld/sdo/client/HelloWorldClientComponent.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="update-bundle">
+ <property name="jar.dir"
+ value="target/classes/sdo/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="HelloWorldClient.jar" />
+ <property name="source.dir"
+ value="sdo/ds" />
+ <property name="target.dir"
+ value="." />
+ <property name="files.list"
+ value="HelloWorldClient.componentType \
+ HelloWorldService.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/CallbackCallback.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/CallbackCallback.java
new file mode 100644
index 0000000000..cfecd989fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/CallbackCallback.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 callback.client;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/*
+ * Callback interface
+ */
+public interface CallbackCallback {
+
+ public void callbackMessage(String aString);
+
+ public void callbackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/CallbackClient.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/CallbackClient.java
new file mode 100644
index 0000000000..43bc26f2f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/CallbackClient.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 callback.client;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ * Callback test client interface
+ */
+public interface CallbackClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/JavaCallbackClientImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/JavaCallbackClientImpl.java
new file mode 100644
index 0000000000..f78878ef47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/JavaCallbackClientImpl.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package callback.client;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import callback.service.CallbackService;
+
+@Service(CallbackClient.class)
+/**
+ * Callback test client implementation
+ */
+public class JavaCallbackClientImpl implements CallbackClient, CallbackCallback {
+
+ @Reference
+ protected CallbackService callbackService;
+
+ 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() {
+ callbackService.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("CallbackITest - test1a", "Who's There", this.getReturnMessage());
+
+ }
+
+ private void test1b() {
+ callbackService.noCallback("No Reply Desired");
+ Assert.assertEquals("CallbackITest - test1b", 1, 1);
+
+ return;
+ }
+
+ private void test1c() {
+ callbackService.multiCallback("Call me back 3 times");
+ int count = 0;
+
+ //
+ // If we can't 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("CallbackITest - 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-android/itest/osgi-implementation/src/main/java/callback/client/OSGiCallbackClientImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/OSGiCallbackClientImpl.java
new file mode 100644
index 0000000000..1c65ca573b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/client/OSGiCallbackClientImpl.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package callback.client;
+
+import java.util.Hashtable;
+
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import callback.service.CallbackService;
+
+/**
+ * OSGi Callback test client implementation
+ */
+public class OSGiCallbackClientImpl implements
+ CallbackClient, CallbackCallback, BundleActivator {
+
+ protected CallbackService callbackService;
+
+ private static String returnMessage = null;
+ private static int callbackCount = 0;
+ private static Object monitor = new Object();
+
+ private BundleContext bundleContext;
+
+ 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() {
+ callbackService.knockKnock("Knock Knock");
+ int count = 0;
+
+ //
+ // If we can't 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();
+ }
+ }
+ }
+
+ if (!"Who's There".equals(this.getReturnMessage())) {
+ throw new RuntimeException("CallbackITest - test1a");
+ }
+
+ }
+
+ private void test1b() {
+ callbackService.noCallback("No Reply Desired");
+
+ return;
+ }
+
+ private void test1c() {
+ callbackService.multiCallback("Call me back 3 times");
+ int count = 0;
+
+ //
+ // If we can't 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();
+ }
+ }
+ }
+
+ if (this.getCallbackCount() != 3)
+ throw new RuntimeException("CallbackITest - test1c");
+ 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();
+ }
+ }
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiCallbackClientImpl bundle ");
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.service.name", "CallbackClient/CallbackClient");
+
+ serviceProps.put("component.name", "CallbackClient");
+ bundleContext.registerService("callback.client.CallbackClient", this, serviceProps);
+
+ Hashtable<String, Object> callbackProps = new Hashtable<String, Object>();
+ callbackProps.put("component.service.name", "CallbackClient/callbackService");
+ callbackProps.put("component.name", "CallbackClient");
+
+ bundleContext.registerService("callback.client.CallbackCallback", this, callbackProps);
+
+ ServiceReference ref= bundleContext.getServiceReference("callback.service.CallbackService");
+
+ if (ref != null)
+ callbackService = (callback.service.CallbackService)bundleContext.getService(ref);
+
+
+
+
+ }
+
+ public void stop(BundleContext bc) {
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/CallbackService.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/CallbackService.java
new file mode 100644
index 0000000000..5383e1e268
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/CallbackService.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 callback.service;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+import callback.client.CallbackCallback;
+
+@Remotable
+@Callback(CallbackCallback.class)
+/*
+ * Callback service interface
+ */
+public interface CallbackService {
+
+ public void knockKnock(String aString);
+
+ public void noCallback(String aString);
+
+ public void multiCallback(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/JavaCallbackServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/JavaCallbackServiceImpl.java
new file mode 100644
index 0000000000..b2af2fa68d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/JavaCallbackServiceImpl.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 callback.service;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+import callback.client.CallbackCallback;
+
+@Service(CallbackService.class)
+/*
+ * Callback service implementation
+ */
+public class JavaCallbackServiceImpl implements CallbackService {
+
+ private CallbackCallback callback;
+
+ @Callback
+ protected void setCallback(CallbackCallback callback) {
+ this.callback = callback;
+ }
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ callback.callbackMessage("Who's There");
+ System.out.println("CallbackServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallback(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ callback.callbackIncrement("Who's There 1");
+ System.out.println("CallbackServiceImpl response sent");
+ callback.callbackIncrement("Who's There 2");
+ System.out.println("CallbackServiceImpl response sent");
+ callback.callbackIncrement("Who's There 3");
+ System.out.println("CallbackServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallback(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ // System.out.println("CallbackServiceImpl No response desired");
+ return;
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/OSGiCallbackServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/OSGiCallbackServiceImpl.java
new file mode 100644
index 0000000000..c05a3f52a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/callback/service/OSGiCallbackServiceImpl.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 callback.service;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+
+import callback.client.CallbackCallback;
+
+/*
+ * OSGi Callback service implementation
+ */
+public class OSGiCallbackServiceImpl implements CallbackService, BundleActivator {
+
+ @Callback
+ protected CallbackCallback callback;
+
+
+ private BundleContext bundleContext;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ callback.callbackMessage("Who's There");
+ System.out.println("CallbackServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallback(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ callback.callbackIncrement("Who's There 1");
+ System.out.println("CallbackServiceImpl response sent");
+ callback.callbackIncrement("Who's There 2");
+ System.out.println("CallbackServiceImpl response sent");
+ callback.callbackIncrement("Who's There 3");
+ System.out.println("CallbackServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallback(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ // System.out.println("CallbackServiceImpl No response desired");
+ return;
+
+ }
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiCallbackServiceImpl bundle ");
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.service.name", "CallbackService/CallbackService");
+ bundleContext.registerService("callback.service.CallbackService", this, serviceProps);
+
+
+ ServiceReference ref= bundleContext.getServiceReference("callback.client.CallbackCallback");
+
+ if (ref != null)
+ callback = (CallbackCallback)bundleContext.getService(ref);
+
+ }
+
+ public void stop(BundleContext bc) {
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalCallback.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalCallback.java
new file mode 100644
index 0000000000..c92f078e49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalCallback.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package conversation.client;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing conversational callbacks
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClient.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClient.java
new file mode 100644
index 0000000000..af269052c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClient.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 conversation.client;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+
+ public String getCalls();
+ public String getServiceCalls();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientActivator.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientActivator.java
new file mode 100644
index 0000000000..5eb16be597
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientActivator.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 conversation.client;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+
+import conversation.client.ConversationalCallback;
+import conversation.client.ConversationalClient;
+import conversation.client.ConversationalClientStatefulImpl;
+import conversation.client.ConversationalClientStatelessImpl;
+
+/*
+ * OSGi bundle activator for conversation tests
+ */
+public class ConversationalClientActivator implements BundleActivator, ServiceListener {
+
+
+ private BundleContext bundleContext;
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiConversationClientActivator ");
+
+ this.bundleContext = bc;
+
+ bc.addServiceListener(this);
+
+ Hashtable<String, Object> serviceProps;
+
+ serviceProps = new Hashtable<String, Object>();
+
+ serviceProps.put("component.name", "ConversationalStatelessClientStatelessService");
+ Object statelessClientFactory1 =
+ new ConversationalClientServiceFactory(ConversationalClientStatelessImpl.class, bundleContext, 1);
+ bundleContext.registerService(
+ new String[] {ConversationalClient.class.getName(), ConversationalCallback.class.getName()},
+ statelessClientFactory1,
+ serviceProps);
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalStatelessClientStatefulService");
+ Object statelessClientFactory2 =
+ new ConversationalClientServiceFactory(ConversationalClientStatelessImpl.class, bundleContext, 2);
+ bundleContext.registerService(
+ new String[] {ConversationalClient.class.getName(), ConversationalCallback.class.getName()},
+ statelessClientFactory2,
+ serviceProps);
+
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalStatefulClientStatelessService");
+ Object statefulClientFactory1 =
+ new ConversationalClientServiceFactory(ConversationalClientStatefulImpl.class, bundleContext, 3);
+ bundleContext.registerService(
+ new String[] {ConversationalClient.class.getName(), ConversationalCallback.class.getName()},
+ statefulClientFactory1,
+ serviceProps);
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalStatefulClientStatefulService");
+ Object statefulClientFactory2 =
+ new ConversationalClientServiceFactory(ConversationalClientStatefulImpl.class, bundleContext, 4);
+ bundleContext.registerService(
+ new String[] {ConversationalClient.class.getName(), ConversationalCallback.class.getName()},
+ statefulClientFactory2,
+ serviceProps);
+
+
+ }
+
+
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientServiceFactory.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientServiceFactory.java
new file mode 100644
index 0000000000..8479624546
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientServiceFactory.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 conversation.client;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+import conversation.client.ConversationalClientStatefulImpl;
+import conversation.client.ConversationalClientStatelessImpl;
+import conversation.referenceclient.ConversationalReferenceClient;
+import conversation.service.ConversationalService;
+
+public class ConversationalClientServiceFactory implements ServiceFactory {
+
+ private Class<?> clazz;
+ private BundleContext bundleContext;
+ private int serviceNum;
+
+ public ConversationalClientServiceFactory(Class<?> clazz, BundleContext bundleContext, int serviceNum) {
+ this.clazz = clazz;
+ this.bundleContext = bundleContext;
+ this.serviceNum = serviceNum;
+ }
+
+ public Object getService(Bundle bundle, ServiceRegistration reg) {
+
+
+ try {
+ Object instance = clazz.newInstance();
+
+ ConversationalClientStatelessImpl statelessClient = null;
+ ConversationalClientStatefulImpl statefulClient = null;
+
+ if (serviceNum == 1 || serviceNum == 2) {
+
+ ServiceReference ref = bundleContext.getServiceReference(ConversationalReferenceClient.class.getName());
+ statelessClient = (ConversationalClientStatelessImpl)instance;
+ statelessClient.conversationalReferenceClient =
+ (ConversationalReferenceClient)bundleContext.getService(ref);
+ }
+ if (serviceNum == 1) {
+
+ ServiceReference ref = getServiceReference(ConversationalService.class.getName(),
+ "(component.name=ConversationalServiceStateless)");
+ statelessClient.conversationalService = (ConversationalService)bundleContext.getService(ref);
+
+ }
+
+ if (serviceNum == 2) {
+
+ ServiceReference ref = getServiceReference(ConversationalService.class.getName(),
+ "(component.name=ConversationalServiceStateful)");
+ statelessClient.conversationalService = (ConversationalService)bundleContext.getService(ref);
+
+ }
+
+
+ if (serviceNum == 3 || serviceNum == 4) {
+
+ ServiceReference ref = bundleContext.getServiceReference(ConversationalReferenceClient.class.getName());
+ statefulClient = (ConversationalClientStatefulImpl)instance;
+ statefulClient.conversationalReferenceClient =
+ (ConversationalReferenceClient)bundleContext.getService(ref);
+ }
+ if (serviceNum == 3) {
+
+ ServiceReference ref = getServiceReference(ConversationalService.class.getName(),
+ "(component.name=ConversationalServiceStateless)");
+ statefulClient.conversationalService = (ConversationalService)bundleContext.getService(ref);
+
+ }
+
+ if (serviceNum == 4) {
+
+ ServiceReference ref = getServiceReference(ConversationalService.class.getName(),
+ "(component.name=ConversationalServiceStateful)");
+ statefulClient.conversationalService = (ConversationalService)bundleContext.getService(ref);
+
+ }
+
+ return instance;
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration reg, Object obj) {
+
+ }
+
+ private ServiceReference getServiceReference(String name, String filter) throws Exception {
+
+ ServiceReference refs[] = bundleContext.getServiceReferences(name, filter);
+ ServiceReference ref = refs[0];
+ int ranking = 0;
+ if (ref.getProperty(Constants.SERVICE_RANKING) instanceof Integer)
+ ranking = (Integer)ref.getProperty(Constants.SERVICE_RANKING);
+ for (int i = 1; i < refs.length; i++) {
+ int thisranking = 0;
+ if (refs[i].getProperty(Constants.SERVICE_RANKING) instanceof Integer) {
+ thisranking = (Integer)refs[i].getProperty(Constants.SERVICE_RANKING);
+ }
+ if (thisranking > ranking) {
+ ref = refs[i];
+ ranking = thisranking;
+ }
+ }
+
+ return ref;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatefulImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatefulImpl.java
new file mode 100644
index 0000000000..3aedabc29c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatefulImpl.java
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package conversation.client;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import conversation.referenceclient.ConversationalReferenceClient;
+import conversation.service.ConversationalService;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ protected ConversationalService conversationalService;
+
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+ public String getCalls() {
+ return calls.toString();
+ }
+
+ public String getServiceCalls() {
+ return conversationalService.getCalls().toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatelessImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatelessImpl.java
new file mode 100644
index 0000000000..b12e094bc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatelessImpl.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package conversation.client;
+
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import conversation.referenceclient.ConversationalReferenceClient;
+import conversation.service.ConversationalService;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("STATELESS")
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+ public String getCalls() {
+ return calls.toString();
+ }
+
+ public String getServiceCalls() {
+ return conversationalService.getCalls().toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClient.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClient.java
new file mode 100644
index 0000000000..59e128b993
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClient.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 conversation.referenceclient;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+import conversation.service.ConversationalService;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientActivator.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientActivator.java
new file mode 100644
index 0000000000..ff6f16cba3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientActivator.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 conversation.referenceclient;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+
+/*
+ * OSGi bundle activator for conversation tests
+ */
+public class ConversationalReferenceClientActivator implements BundleActivator, ServiceListener {
+
+
+ private BundleContext bundleContext;
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiConversationReferenceClientActivator ");
+
+ this.bundleContext = bc;
+
+ bc.addServiceListener(this);
+
+ Hashtable<String, Object> serviceProps;
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalReferenceClient");
+ ConversationalReferenceClientImpl refClient = new ConversationalReferenceClientImpl();
+ bundleContext.registerService(ConversationalReferenceClient.class.getName(), refClient, serviceProps);
+
+ }
+
+
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientImpl.java
new file mode 100644
index 0000000000..4524c6bd3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientImpl.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 conversation.referenceclient;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Service;
+
+import conversation.service.ConversationalService;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+@AllowsPassByReference
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalService.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalService.java
new file mode 100644
index 0000000000..bcd24ef0b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalService.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 conversation.service;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+import conversation.client.ConversationalCallback;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+ public String getCalls();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceActivator.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceActivator.java
new file mode 100644
index 0000000000..903f8bf229
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceActivator.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 conversation.service;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+
+
+/*
+ * OSGi bundle activator for conversation tests
+ */
+public class ConversationalServiceActivator implements BundleActivator, ServiceListener {
+
+
+ private BundleContext bundleContext;
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiConversationServiceActivator ");
+
+ this.bundleContext = bc;
+
+ bc.addServiceListener(this);
+
+ Hashtable<String, Object> serviceProps;
+
+ serviceProps = new Hashtable<String, Object>();
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalServiceStateful");
+ Object statefulService =
+ new ConversationalServiceFactory(ConversationalServiceStatefulImpl.class);
+ bundleContext.registerService(ConversationalService.class.getName(), statefulService, serviceProps);
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalServiceStateless");
+ ConversationalServiceStatelessImpl statelessService = new ConversationalServiceStatelessImpl();
+ bundleContext.registerService(ConversationalService.class.getName(), statelessService, serviceProps);
+
+
+ }
+
+
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceFactory.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceFactory.java
new file mode 100644
index 0000000000..fe8bd23f07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceFactory.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 conversation.service;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+
+public class ConversationalServiceFactory implements ServiceFactory {
+
+ private Class<?> clazz;
+
+ public ConversationalServiceFactory(Class<?> clazz) {
+ this.clazz = clazz;
+ }
+
+ public Object getService(Bundle bundle, ServiceRegistration reg) {
+
+ try {
+ return clazz.newInstance();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration reg, Object obj) {
+
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatefulImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatefulImpl.java
new file mode 100644
index 0000000000..ec30d641ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatefulImpl.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 conversation.service;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import conversation.client.ConversationalCallback;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+
+ public String getCalls() {
+ return calls.toString();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatelessImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatelessImpl.java
new file mode 100644
index 0000000000..34baca71d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatelessImpl.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package conversation.service;
+
+import java.util.HashMap;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import conversation.client.ConversationalCallback;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(ConversationalService.class)
+@Scope("STATELESS")
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+
+ public String getCalls() {
+ return calls.toString();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/Greetings.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/Greetings.java
new file mode 100644
index 0000000000..9285c0a8d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/Greetings.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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Greetings {
+
+
+ public String[] getGreetingsFromJava(String[] s);
+
+ public String[] getGreetingsFromOSGi(String[] s);
+
+ public String[] getModifiedGreetingsFromJava(String[] s);
+
+ public String[] getModifiedGreetingsFromOSGi(String[] s);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/HelloWorld.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..16d0eae990
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorld {
+
+ public String getGreetings(String s);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/JavaGreetingsComponent.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/JavaGreetingsComponent.java
new file mode 100644
index 0000000000..3d0e045225
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/JavaGreetingsComponent.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 helloworld;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(Greetings.class)
+@Scope("COMPOSITE")
+public class JavaGreetingsComponent implements Greetings {
+
+ private Greetings greetingsService;
+
+ @Reference
+ public void setGreetingsService(Greetings greetingsService) {
+ this.greetingsService = greetingsService;
+ }
+
+
+ public String[] getGreetingsFromJava(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = "Hello " + s[i] + "(From Java)";
+ }
+
+ return greetingsService.getGreetingsFromJava(s);
+ }
+
+ public String[] getGreetingsFromOSGi(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = s[i] + "(From Java)";
+ }
+
+ return s;
+ }
+
+ @AllowsPassByReference
+ public String[] getModifiedGreetingsFromJava(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = "Hello " + s[i] + "(From Java)";
+ }
+
+ return greetingsService.getModifiedGreetingsFromJava(s);
+ }
+
+ @AllowsPassByReference
+ public String[] getModifiedGreetingsFromOSGi(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = s[i] + "(From Java)";
+ }
+
+ return s;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/JavaHelloWorldComponent.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/JavaHelloWorldComponent.java
new file mode 100644
index 0000000000..c055aee142
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/JavaHelloWorldComponent.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 helloworld;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class JavaHelloWorldComponent implements HelloWorld {
+
+ public helloworld.ws.HelloWorld helloWorldWS;
+
+ @Reference
+ public void setHelloWorldWS(helloworld.ws.HelloWorld helloWorldWS) {
+ this.helloWorldWS = helloWorldWS;
+ }
+
+ public String getGreetings(String s) {
+ return helloWorldWS.getGreetings(s);
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/OSGiGreetingsImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/OSGiGreetingsImpl.java
new file mode 100644
index 0000000000..661eb5a8cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/OSGiGreetingsImpl.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 helloworld;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.BundleActivator;
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+
+public class OSGiGreetingsImpl implements Greetings, ServiceListener, BundleActivator {
+
+ private Greetings greetingsService;
+
+ private BundleContext bundleContext;
+
+ public String[] getGreetingsFromOSGi(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = "Hello " + s[i] + "(From OSGi)";
+ }
+
+ return greetingsService.getGreetingsFromOSGi(s);
+ }
+
+ public String[] getGreetingsFromJava(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = s[i] + "(From OSGi)";
+ }
+
+ return s;
+ }
+
+ @AllowsPassByReference
+ public String[] getModifiedGreetingsFromOSGi(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = "Hello " + s[i] + "(From OSGi)";
+ }
+
+ return greetingsService.getModifiedGreetingsFromOSGi(s);
+ }
+
+ @AllowsPassByReference
+ public String[] getModifiedGreetingsFromJava(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = s[i] + "(From OSGi)";
+ }
+
+ return s;
+ }
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started OsgiGreetingsImpl bundle ");
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.service.name", "OSGiGreetingsComponent/Greetings");
+ bundleContext.registerService("helloworld.Greetings", this, serviceProps);
+
+
+ ServiceReference ref = bundleContext.getServiceReference("helloworld.Greetings");
+ if (ref != null)
+ greetingsService = (helloworld.Greetings)bundleContext.getService(ref);
+ else {
+ try {
+ String filter = "(objectclass=helloworld.Greetings)";
+ this.bundleContext.addServiceListener(this, filter);
+
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+ ServiceReference ref = event.getServiceReference();
+ greetingsService = (helloworld.Greetings) bundleContext.getService(ref);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/OSGiHelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/OSGiHelloWorldImpl.java
new file mode 100644
index 0000000000..0588da9a85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/OSGiHelloWorldImpl.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 helloworld;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.BundleActivator;
+
+
+public class OSGiHelloWorldImpl implements HelloWorld, ServiceListener, BundleActivator {
+
+ public helloworld.ws.HelloWorld helloWorldWS;
+
+ private BundleContext bundleContext;
+
+ public String getGreetings(String s) {
+ return helloWorldWS.getGreetings(s);
+ }
+
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started OsgiHelloWorldImpl bundle ");
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "HelloWorldComponent");
+ bundleContext.registerService("helloworld.HelloWorld", this, serviceProps);
+
+ ServiceReference ref = bundleContext.getServiceReference("helloworld.ws.HelloWorld");
+ if (ref != null)
+ helloWorldWS = (helloworld.ws.HelloWorld)bundleContext.getService(ref);
+ else {
+ try {
+ String filter = "(objectclass=helloworld.ws.HelloWorld)";
+ this.bundleContext.addServiceListener(this, filter);
+
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+ ServiceReference ref = event.getServiceReference();
+ helloWorldWS = (helloworld.ws.HelloWorld) bundleContext.getService(ref);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/HelloWorldService.java
new file mode 100644
index 0000000000..fff67e1978
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/HelloWorldService.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 helloworld.sdo;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(Name name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..98085449e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/HelloWorldServiceComponent.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.sdo;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ public String getGreetings(Name name) {
+ return "Hello " + name.getFirst() + " " + name.getLast();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/client/HelloWorldClient.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/client/HelloWorldClient.java
new file mode 100644
index 0000000000..5089019671
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/client/HelloWorldClient.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 helloworld.sdo.client;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld client
+ */
+@Remotable
+public interface HelloWorldClient {
+
+ public String getGreetings(String firstName, String lastName);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/client/HelloWorldClientComponent.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/client/HelloWorldClientComponent.java
new file mode 100644
index 0000000000..1aabf4d10c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/sdo/client/HelloWorldClientComponent.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld.sdo.client;
+
+import helloworld.sdo.HelloWorldService;
+import helloworld.sdo.HelloworldFactory;
+import helloworld.sdo.Name;
+
+/**
+ * The HelloWorld client implementation
+ */
+public class HelloWorldClientComponent implements HelloWorldClient {
+
+ HelloWorldService helloWorldService;
+
+ public String getGreetings(String firstName, String lastName) {
+ Name name = HelloworldFactory.INSTANCE.createName();
+ name.setFirst(firstName);
+ name.setLast(lastName);
+ return helloWorldService.getGreetings(name);
+ }
+
+ public HelloWorldService getHelloWorldService() {
+ return helloWorldService;
+ }
+
+ public void setHelloWorldService(HelloWorldService helloWorldService) {
+ this.helloWorldService = helloWorldService;
+ }
+
+ public void unsetHelloWorldService(HelloWorldService helloWorldService) {
+ this.helloWorldService = null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorld.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorld.java
new file mode 100644
index 0000000000..039a214856
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/ws/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 helloworld.ws;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorld {
+
+ public String getGreetings(String s);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorldService.java
new file mode 100644
index 0000000000..4a3cd4aed2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorldService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld.ws;
+
+public class HelloWorldService implements HelloWorld {
+
+ public String getGreetings(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteComponentImpl.java
new file mode 100644
index 0000000000..2251bf5be6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteComponentImpl.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 stockquote;
+
+import java.util.Dictionary;
+
+import org.osgi.service.component.ComponentContext;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * Declarative Stock quote with configurable properties.
+ */
+public class OSGiStockQuoteComponentImpl implements StockQuote {
+
+ @Property
+ public double exchangeRate;
+
+ private String currency;
+
+
+ public double configExchangeRate;
+ public String configCurrency;
+
+ @Property
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public double getQuote(String ticker) throws Exception {
+
+ if (exchangeRate == 2.0 && !"USD".equals(currency)) {
+ throw new RuntimeException("Property exchangeRate not set correctly, exchangeRate= " +
+ exchangeRate + " currency=" + currency);
+ }
+ if (exchangeRate == 1.48 && !"EURO".equals(currency)) {
+ throw new RuntimeException("Property exchangeRate not set correctly, exchangeRate= " +
+ exchangeRate + " currency=" + currency);
+ }
+
+ if (configExchangeRate == 2.0 && !"USD".equals(configCurrency)) {
+ throw new RuntimeException("ConfigAdmin Property exchangeRate not set correctly, exchangeRate= " +
+ configExchangeRate + " currency=" + configCurrency);
+ }
+ if (configExchangeRate == 1.48 && !"EURO".equals(configCurrency)) {
+ throw new RuntimeException("Property configExchangeRate not set correctly, exchangeRate= " +
+ configExchangeRate + " currency=" + configCurrency);
+ }
+
+ return 52.81 * exchangeRate;
+
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiStockQuoteComponentImpl bundle ");
+ Dictionary props = context.getProperties();
+ Object prop = props.get("currency");
+ if (prop instanceof String[]&& ((String [])prop).length > 0)
+ configCurrency = ((String [])prop)[0];
+ prop = props.get("exchangeRate");
+ if (prop instanceof Double[]&& ((Double [])prop).length > 0)
+ configExchangeRate = (double)((Double [])prop)[0];
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiStockQuoteComponentImpl bundle ");
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteFactoryImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteFactoryImpl.java
new file mode 100644
index 0000000000..e2d25bf47d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteFactoryImpl.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 stockquote;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ *
+ * OSGi service factory where service has configurable properties
+ * Only property injection is tested. ConfigurationAdmin is not used.
+ *
+ */
+public class OSGiStockQuoteFactoryImpl implements BundleActivator, ServiceFactory {
+
+
+ private BundleContext bundleContext;
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ bundleContext = bc;
+
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ bc.registerService(StockQuote.class.getName(), this, props);
+
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ }
+
+
+ public Object getService(Bundle bundle, ServiceRegistration registration) {
+ return new OSGiStockQuoteImpl(bundleContext);
+ }
+
+
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteImpl.java
new file mode 100644
index 0000000000..f2ae804ad1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteImpl.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 stockquote;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osoa.sca.annotations.Property;
+
+/**
+ *
+ * Stock quote with configurable properties.
+ *
+ */
+public class OSGiStockQuoteImpl implements StockQuote, BundleActivator {
+
+ public String pid;
+
+ @Property
+ public double exchangeRate;
+
+ private String currency;
+
+ private BundleContext bundleContext;
+
+ public OSGiStockQuoteImpl() {
+ this.pid = "stockQuote";
+ }
+
+ protected OSGiStockQuoteImpl(BundleContext bc) {
+ this.bundleContext = bc;
+ }
+
+ @Property
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+
+ private void checkProperties() throws Exception {
+
+ if (exchangeRate == 2.0 && !"USD".equals(currency)) {
+ throw new RuntimeException("Property exchangeRate not set correctly, exchangeRate= " +
+ exchangeRate + " currency=" + currency);
+ }
+
+ if (exchangeRate == 1.48 && !"EURO".equals(currency)) {
+ throw new RuntimeException("Property exchangeRate not set correctly, exchangeRate= " +
+ exchangeRate + " currency=" + currency);
+ }
+
+ ServiceReference configAdminReference = bundleContext.getServiceReference("org.osgi.service.cm.ConfigurationAdmin");
+ if (configAdminReference != null && pid != null ) {
+
+ ConfigurationAdmin cm = (ConfigurationAdmin)bundleContext.getService(configAdminReference);
+
+ Configuration config = cm.getConfiguration("stockQuote", null);
+
+ Dictionary props = config.getProperties();
+
+ if (exchangeRate != (double)(Double)props.get("exchangeRate")) {
+ throw new Exception("Config Property exchangeRate not set correctly, expected "
+ + props.get("exchangeRate") + " got " + exchangeRate);
+ }
+
+ if (!currency.equals(props.get("currency"))) {
+ throw new Exception("Config Property currency not set correctly, expected "
+ + props.get("currency") + " got " + currency);
+ }
+ }
+
+ }
+
+ public double getQuote(String ticker) throws Exception {
+
+ checkProperties();
+
+ return 52.81 * exchangeRate;
+
+ }
+
+ public void start(BundleContext bc) throws Exception {
+
+ bundleContext = bc;
+
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ props.put("service.pid", "stockQuote");
+
+ bc.registerService(StockQuote.class.getName(), this, props);
+
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/StockQuote.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/StockQuote.java
new file mode 100644
index 0000000000..a47f68c579
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/stockquote/StockQuote.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 stockquote;
+
+/**
+ *
+ * Stock Quote interface
+ *
+ */
+public interface StockQuote {
+
+ public double getQuote(String ticker) throws Exception ;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java
new file mode 100644
index 0000000000..25d7bcf2ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package supplychain;
+
+
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiBundleImpl implements ServiceListener, BundleActivator {
+
+
+ String name;
+
+ String[] references;
+ Class<?>[] referenceClasses;
+ Field[] referenceFields;
+ String[] referenceFilters;
+
+ Class myClass;
+ ArrayList<String> serviceNames = new ArrayList<String>();
+ ArrayList<Object> serviceObjs = new ArrayList<Object>();
+ ArrayList<Hashtable<String, Object>> serviceProperties = new ArrayList<Hashtable<String, Object>>();
+
+
+ private BundleContext bundleContext;
+
+ public OSGiBundleImpl() {}
+
+ public OSGiBundleImpl(String[] references, String[] filters) {
+
+ myClass = this.getClass();
+ this.name = this.getClass().getSimpleName();
+ this.references = references == null?new String[0] : references;
+
+
+ try {
+ referenceClasses = new Class[references.length];
+ referenceFields = new Field[references.length];
+ referenceFilters = new String[references.length];
+ for (int i = 0; i < references.length; i++) {
+ referenceFields[i] = this.getClass().getDeclaredField(references[i]);
+ referenceFields[i].setAccessible(true);
+ referenceClasses[i] = referenceFields[i].getType();
+
+ if (filters != null && filters.length > i)
+ referenceFilters[i] = filters[i];
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started bundle " + name);
+
+ this.bundleContext = bc;
+
+ boolean useSingleRegisterService = serviceNames.size() > 1;
+ for (int i = 1; i < serviceNames.size(); i++) {
+ if (serviceObjs.get(i) != serviceObjs.get(0) ||
+ serviceProperties.get(i) != serviceProperties.get(0)) {
+ useSingleRegisterService = false;
+ break;
+ }
+ }
+ if (useSingleRegisterService) {
+ bundleContext.registerService(serviceNames.toArray(new String[serviceNames.size()]),
+ serviceObjs.get(0), serviceProperties.get(0));
+ }
+ else {
+ for (int i = 0; i < serviceNames.size(); i++) {
+ bundleContext.registerService(serviceNames.get(i), serviceObjs.get(i), serviceProperties.get(i));
+ }
+ }
+
+ started(bc);
+
+ for (int i = 0; i < references.length; i++) {
+
+ try {
+ if (referenceFields[i].get(this) != null)
+ continue;
+
+ ServiceReference[] refs = bundleContext.getServiceReferences(referenceClasses[i].getName(), referenceFilters[i]);
+ if (refs != null && refs.length > 0) {
+ Object obj = bundleContext.getService(refs[0]);
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ } else {
+ String filter = "(objectclass=" + referenceClasses[i].getName() + ")";
+ this.bundleContext.addServiceListener(this, filter);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void stop(BundleContext bc) {
+ System.out.println("Stop bundle " + name);
+
+ }
+
+ protected void started(BundleContext bc) {
+
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ ServiceReference ref = event.getServiceReference();
+ Object obj = bundleContext.getService(ref);
+ for (int i = 0; i < references.length; i++) {
+ if (referenceClasses[i].isAssignableFrom(obj.getClass())) {
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ }
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ public void registerService(Object serviceObject, String serviceName, Hashtable<String, Object> props) {
+ serviceObjs.add(serviceObject);
+ serviceNames.add(serviceName);
+ serviceProperties.add(props == null? new Hashtable<String, Object>() : props);
+ }
+}
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..2762bc62be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.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.customer;
+
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * This is the business interface of the Customer service component.
+ */
+public interface Customer {
+
+ public void purchaseBooks();
+
+ public void purchaseGames();
+
+ public void purchaseGoods();
+
+ @OneWay
+ public void notifyShipment(String order);
+
+ public boolean hasOutstandingOrders();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..80346311b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import java.util.ArrayList;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component.
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private Retailer retailer1;
+
+ private Retailer retailer2;
+
+ private Retailer retailer3;
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ @Reference
+ public void setRetailer1(Retailer retailer1) {
+ this.retailer1 = retailer1;
+ }
+
+ @Reference
+ public void setRetailer2(Retailer retailer2) {
+ this.retailer2 = retailer2;
+ }
+
+ @Reference
+ public void setRetailer3(Retailer retailer3) {
+ this.retailer3 = retailer3;
+ }
+
+ public void purchaseBooks() {
+ System.out.println("JavaCustomerComponentImpl.purchaseBooks");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)");
+ retailer1.submitOrder("Order");
+ }
+
+ public void purchaseGames() {
+ System.out.println("JavaCustomerComponentImpl.purchaseGames");
+ outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)");
+
+ retailer2.submitOrder("Order");
+ }
+
+ public void purchaseGoods() {
+ retailer3.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrders.remove(order);
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
new file mode 100644
index 0000000000..a879505610
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+
+import org.osgi.service.component.ComponentContext;
+
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiCustomerComponentImpl implements Customer {
+
+
+ private Retailer retailer1;
+ private Retailer retailer2;
+ private Retailer retailer3;
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ public OSGiCustomerComponentImpl() {
+ System.out.println("Created OSGiCustomerComponentImpl " + this);
+ }
+
+ protected void setRetailer1(Retailer retailer1) {
+ this.retailer1 = retailer1;
+ }
+
+ protected void unsetRetailer1(Retailer retailer1) {
+ // this.retailer1 = null;
+ }
+
+
+ protected void setRetailer2(Retailer retailer2) {
+ this.retailer2 = retailer2;
+ }
+
+ protected void unsetRetailer2(Retailer retailer2) {
+ // this.retailer2 = null;
+ }
+
+ protected void setRetailer3(Retailer retailer3) {
+ this.retailer3 = retailer3;
+ }
+
+ protected void unsetRetailer3(Retailer retailer3) {
+ // this.retailer3 = null;
+ }
+
+
+ public void purchaseBooks() {
+ System.out.println("OSGiCustomerComponentImpl.purchaseBooks, retailer1 is " + retailer1);
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)");
+ retailer1.submitOrder("Order");
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerComponentImpl.purchaseGames, retailer2 is " + retailer2);
+ outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)");
+
+ retailer2.submitOrder("Order");
+ }
+
+ public void purchaseGoods() {
+ System.out.println("OSGiCustomerComponentImpl.purchaseGames, retailer3 is " + retailer3);
+ retailer3.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrders.remove(order);
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiCustomerComponentImpl bundle ");
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiCustomerComponentImpl bundle ");
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java
new file mode 100644
index 0000000000..c8cb522cf4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.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 supplychain.customer;
+
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiCustomerFactoryImpl implements BundleActivator, ServiceFactory {
+
+ private BundleContext bundleContext;
+
+ public OSGiCustomerFactoryImpl() {
+ }
+
+
+ public void start(BundleContext bc) {
+
+ this.bundleContext = bc;
+ bc.registerService(Customer.class.getName(), this, null);
+ }
+
+
+
+
+ public void stop(BundleContext context) throws Exception {
+
+ }
+
+
+ public Object getService(Bundle bundle, ServiceRegistration registration) {
+
+ OSGiCustomerImpl customer = new OSGiCustomerImpl(false);
+ customer.start(bundleContext);
+ return customer;
+
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object obj) {
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java
new file mode 100644
index 0000000000..546971860e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component.
+ */
+@AllowsPassByReference
+public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer {
+
+ private ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ private Retailer retailer1;
+ private Retailer retailer2;
+ private Retailer retailer3;
+
+ public OSGiCustomerImpl() {
+ super( new String[]{"retailer1", "retailer2", "retailer3"},
+ new String[]{"(retailerName=amazon.com)",
+ "(retailerName=play.com)",
+ "(retailerName=ebay.com)"
+ });
+ registerService(this, "supplychain.customer.Customer", null);
+
+ }
+
+ public OSGiCustomerImpl(boolean ignore) { // Used only to test service factories
+ super( new String[]{"retailer1", "retailer2", "retailer3"},
+ new String[]{"(retailerName=amazon.com)",
+ "(retailerName=play.com)",
+ "(retailerName=ebay.com)"
+ });
+
+ }
+
+ public void purchaseBooks() {
+ System.out.println("OSGiCustomerImpl.purchaseBooks, retailer is " + retailer1);
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)");
+
+ retailer1.submitOrder("Order");
+
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerImpl.purchaseGames, retailer is " + retailer2);
+ outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)");
+
+ retailer2.submitOrder("Order");
+
+ }
+
+ public void purchaseGoods() {
+ retailer3.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+
+ outstandingOrders.remove(order);
+
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java
new file mode 100644
index 0000000000..593e55f3f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+
+import org.osgi.service.component.ComponentContext;
+
+
+import supplychain.retailer.Retailer;
+import supplychain.retailer.RetailerQuery;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiCustomerWithQueryComponentImpl implements Customer {
+
+
+ private Retailer retailer;
+ private RetailerQuery retailerQuery;
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ public OSGiCustomerWithQueryComponentImpl() {
+ System.out.println("Created OSGiCustomerWithQueryComponentImpl " + this);
+ }
+
+ protected void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ protected void unsetRetailer(Retailer retailer) {
+ // this.retailer = null;
+ }
+
+
+ protected void setRetailerQuery(RetailerQuery retailerQuery) {
+ this.retailerQuery = retailerQuery;
+ }
+
+ protected void unsetRetailerQuery(RetailerQuery retailerQuery) {
+ // this.retailerQuery = null;
+ }
+
+ public void purchaseBooks() {
+ System.out.println("OSGiCustomerWithQueryComponentImpl.purchaseBooks");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)");
+
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerWithQueryComponentImpl.purchaseGames");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)");
+
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+ }
+
+ public void purchaseGoods() {
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrders.remove(order);
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiCustomerWithQueryComponentImpl bundle ");
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiCustomerWithQueryComponentImpl bundle ");
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java
new file mode 100644
index 0000000000..18483817ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+import supplychain.retailer.RetailerQuery;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiCustomerWithQueryImpl extends OSGiBundleImpl implements Customer {
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ private Retailer retailer;
+ private RetailerQuery retailerQuery;
+
+ public OSGiCustomerWithQueryImpl() {
+ super( new String[]{"retailer", "retailerQuery"},
+ new String[]{"(component.service.name=RetailerComponent/Retailer)",
+ "(component.service.name=RetailerComponent/RetailerQuery)"
+ });
+ registerService(this, "supplychain.customer.Customer", null);
+
+ }
+
+ public void purchaseBooks() {
+ System.out.println("OSGiCustomerWithQueryImpl.purchaseBooks");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)");
+
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerWithQueryImpl.purchaseGames");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)");
+
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+
+ }
+
+ public void purchaseGoods() {
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+
+ outstandingOrders.remove(order);
+
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java
new file mode 100644
index 0000000000..5ba42780f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * This class implements the Customer service component.
+ */
+@Scope("STATELESS")
+public class OSGiStatelessCustomerComponentImpl extends OSGiCustomerComponentImpl {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java
new file mode 100644
index 0000000000..bc569d0ac0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.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 supplychain.customer;
+
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * This class implements the Customer service component.
+ */
+@Scope("STATELESS")
+public class OSGiStatelessCustomerImpl extends OSGiCustomerImpl {
+
+ public OSGiStatelessCustomerImpl(boolean ignore) {
+ super(ignore);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java
new file mode 100644
index 0000000000..599ab51a50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiVersionedCustomerImpl extends OSGiBundleImpl implements Customer {
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ private Retailer retailer1;
+ private Retailer retailer2;
+ private Retailer retailer3;
+ private int version;
+
+ public OSGiVersionedCustomerImpl() {
+ super( new String[]{"retailer1", "retailer2", "retailer3"},
+ new String[]{"(retailerName=amazon.com)",
+ "(retailerName=play.com)",
+ "(retailerName=ebay.com)"
+ });
+
+ }
+
+ protected void started(BundleContext bc) {
+
+ String jarFile = bc.getBundle().getLocation();
+ if (jarFile.endsWith("1.jar")) version = 1;
+ else if (jarFile.endsWith("2.jar")) version = 2;
+ else version = 3;
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("component.name", "CustomerComponent" + version);
+ bc.registerService("supplychain.customer.Customer", this, props1);
+
+ }
+
+ public void purchaseBooks() {
+ System.out.println("OSGiVersionedCustomerImpl.purchaseBooks , retailer is " + retailer1);
+ outstandingOrders.add("Order, submitted (amazon.com v" + version +
+ "), fulfilled, shipped (ParcelForce)");
+
+ retailer1.submitOrder("Order");
+
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerImpl.purchaseGames");
+ outstandingOrders.add("Order, submitted (play.com v" + version +
+ "), fulfilled, shipped (ParcelForce)");
+
+ retailer2.submitOrder("Order");
+
+ }
+
+ public void purchaseGoods() {
+ retailer3.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+
+ outstandingOrders.remove(order);
+
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..df52c6c760
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Customer service component.
+ */
+@Service(Retailer.class)
+@Scope("COMPOSITE")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ private String retailerName;
+
+ public JavaRetailerComponentImpl() {
+ System.out.println("Created RetailerComponentImpl");
+ }
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ System.out.println("retailer setWarehouse " + warehouse);
+
+ this.warehouse = warehouse;
+ }
+
+ @Property
+ public void setRetailerName(String retailerName) {
+ this.retailerName = retailerName;
+ }
+
+
+ public void submitOrder(String order) {
+
+ System.out.println("JavaRetailerComponentImpl.submitOrder " + warehouse);
+ warehouse.fulfillOrder(order + ", submitted (" + retailerName + ")");
+
+ }
+
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
new file mode 100644
index 0000000000..aca5943552
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.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 supplychain.retailer;
+
+import org.osgi.service.component.ComponentContext;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+ private String retailerName;
+
+
+ protected void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ protected void unsetWarehouse(Warehouse warehouse) {
+ // this.warehouse = null;
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("OSGiRetailerComponentImpl.submitOrder , warehouse is " + warehouse);
+ warehouse.fulfillOrder(order + ", submitted (" + retailerName + ")");
+
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiRetailerComponentImpl bundle ");
+
+ Object prop = context.getProperties().get("retailerName");
+ if (prop instanceof String[])
+ retailerName = ((String [])prop)[0];
+
+
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiRetailerComponentImpl bundle ");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
new file mode 100644
index 0000000000..e71c624f49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.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 supplychain.retailer;
+
+
+import java.util.Hashtable;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component.
+ */
+public class OSGiRetailerImpl extends OSGiBundleImpl {
+
+ protected Warehouse warehouse;
+
+ public OSGiRetailerImpl() {
+
+ super(new String[]{"warehouse"},
+ new String[]{"(component.service.name=WarehouseComponent1/Warehouse)"});
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("retailerName", "amazon.com");
+ registerService(new OSGiRetailerServiceImpl(this, "amazon.com"),
+ "supplychain.retailer.Retailer", props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("retailerName", "play.com");
+ registerService(
+ new OSGiRetailerServiceImpl(this, "play.com"),
+ "supplychain.retailer.Retailer", props2);
+
+ Hashtable<String, Object> props3 = new Hashtable<String, Object>();
+ props3.put("retailerName", "ebay.com");
+ registerService(
+ new OSGiRetailerServiceImpl(this, "ebay.com"),
+ "supplychain.retailer.Retailer", props3);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java
new file mode 100644
index 0000000000..a036ecfc76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.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 supplychain.retailer;
+
+
+/**
+ * This class implements the Retailer service.
+ */
+public class OSGiRetailerServiceImpl implements Retailer {
+
+ private OSGiRetailerImpl retailerImpl;
+
+ private String retailerName;
+
+ OSGiRetailerServiceImpl(OSGiRetailerImpl retailerImpl, String retailerName) {
+ this.retailerImpl = retailerImpl;
+ this.retailerName = retailerName;
+
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("Retailer.submitOrder, warehouse is " + retailerImpl.warehouse);
+ retailerImpl.warehouse.fulfillOrder(order + ", submitted ("
+ + retailerName + ")");
+
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java
new file mode 100644
index 0000000000..db877bb366
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.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 supplychain.retailer;
+
+import org.osgi.service.component.ComponentContext;
+
+import supplychain.warehouse.Warehouse;
+import supplychain.warehouse.WarehouseQuery;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiRetailerWithQueryComponentImpl implements Retailer, RetailerQuery {
+
+ private Warehouse warehouse;
+ private WarehouseQuery warehouseQuery;
+ private String retailerName;
+
+
+ protected void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ protected void unsetWarehouse(Warehouse warehouse) {
+ // this.warehouse = null;
+ }
+
+ protected void setWarehouseQuery(WarehouseQuery warehouseQuery) {
+ this.warehouseQuery = warehouseQuery;
+ }
+
+ protected void unsetWarehouseQuery(WarehouseQuery warehouse) {
+ // this.warehouseQuery = null;
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("OSGiRetailerComponentImpl.submitOrder , warehouse is " + warehouse);
+ warehouse.fulfillOrder(order + ", submitted (" + retailerName + ")");
+
+ }
+
+ public boolean isAvailable(String order) {
+ return warehouseQuery.isAvailable(order);
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiRetailerComponentImpl bundle ");
+
+ Object prop = context.getProperties().get("retailerName");
+ if (prop instanceof String[])
+ retailerName = ((String [])prop)[0];
+
+
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiRetailerComponentImpl bundle ");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java
new file mode 100644
index 0000000000..ee1f575e70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.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 supplychain.retailer;
+
+
+import java.util.Hashtable;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+import supplychain.warehouse.WarehouseQuery;
+
+/**
+ * This class implements the Retailer service component with query.
+ */
+public class OSGiRetailerWithQueryImpl extends OSGiBundleImpl implements Retailer, RetailerQuery {
+
+ private Warehouse warehouse;
+ private WarehouseQuery warehouseQuery;
+
+ public OSGiRetailerWithQueryImpl() {
+
+ super(new String[]{"warehouse", "warehouseQuery"}, null);
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("retailerName", "amazon.com");
+ registerService(this,
+ "supplychain.retailer.Retailer", props1);
+
+ registerService(this,
+ "supplychain.retailer.RetailerQuery", props1);
+
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("Retailer.submitOrder, warehouse is " + warehouse);
+ warehouse.fulfillOrder(order + ", submitted ("
+ + "amazon.com" + ")");
+
+ }
+
+ public boolean isAvailable(String order) {
+ return warehouseQuery.isAvailable(order);
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java
new file mode 100644
index 0000000000..09e60ca626
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.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 supplychain.retailer;
+
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component.
+ */
+public class OSGiVersionedRetailerImpl extends OSGiBundleImpl {
+
+ protected Warehouse warehouse;
+
+ private int version;
+
+ public OSGiVersionedRetailerImpl() {
+
+ super(new String[]{"warehouse"}, null);
+
+
+ }
+
+ protected void started(BundleContext bc) {
+ String jarFile = bc.getBundle().getLocation();
+ if (jarFile.endsWith("1.jar")) version = 1;
+ else if (jarFile.endsWith("2.jar")) version = 2;
+ else version = 3;
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("retailerName", "amazon.com");
+ bc.registerService("supplychain.retailer.Retailer",
+ new OSGiVersionedRetailerServiceImpl(this, "amazon.com", version),
+ props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("retailerName", "play.com");
+ bc.registerService(
+ "supplychain.retailer.Retailer",
+ new OSGiVersionedRetailerServiceImpl(this, "play.com", version),
+ props2);
+
+ try {
+ ServiceReference[] refs = bc.getServiceReferences(Warehouse.class.getName(),
+ "(component.service.name=WarehouseComponent" + version + "/Warehouse)");
+ if (refs != null && refs.length > 0) {
+ warehouse = (Warehouse) bc.getService(refs[0]);
+ }
+ } catch (InvalidSyntaxException e) {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java
new file mode 100644
index 0000000000..7dd70889c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.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 supplychain.retailer;
+
+
+/**
+ * This class implements the Retailer service.
+ */
+public class OSGiVersionedRetailerServiceImpl implements Retailer {
+
+ private OSGiVersionedRetailerImpl retailerImpl;
+
+ private String retailerName;
+
+ private int version;
+
+ OSGiVersionedRetailerServiceImpl(OSGiVersionedRetailerImpl retailerImpl, String retailerName, int version) {
+ this.retailerImpl = retailerImpl;
+ this.retailerName = retailerName;
+ this.version = version;
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("Retailer.submitOrder, warehouse is " + retailerImpl.warehouse);
+ retailerImpl.warehouse.fulfillOrder(order + ", submitted ("
+ + retailerName + " v" + version + ")");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/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.retailer;
+
+/**
+ * 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-android/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java
new file mode 100644
index 0000000000..354f40a064
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.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.retailer;
+
+/**
+ * This is the business interface of the RetailerQuery service.
+ */
+public interface RetailerQuery {
+
+ public boolean isAvailable(String order);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..d0cf43a960
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.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 supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component.
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ private String shipperName;
+
+ @Reference
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ @Property
+ public void setShipperName(String shipperName) {
+ this.shipperName = shipperName;
+ }
+
+
+
+ public void processShipment(String order) {
+ System.out.println("JavaShipperComponentImpl.processShipment");
+ customer.notifyShipment(order + ", shipped (" + shipperName + ")");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
new file mode 100644
index 0000000000..ff40a7ae36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.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 supplychain.shipper;
+
+
+import org.osgi.service.component.ComponentContext;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component.
+ */
+public class OSGiShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+ private String shipperName;
+
+ protected void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ protected void unsetCustomer(Customer customer) {
+ // this.customer = null;
+ }
+
+ public void processShipment(String order) {
+ System.out.println("OSGiShipperComponentImpl.processShipment, customer is " + customer);
+ customer.notifyShipment(order + ", shipped (" + shipperName + ")");
+ }
+
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiShipperComponentImpl bundle ");
+
+ Object prop = context.getProperties().get("shipperName");
+ if (prop instanceof String[])
+ shipperName = ((String [])prop)[0];
+
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiShipperComponentImpl bundle ");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java
new file mode 100644
index 0000000000..ef989d6fcf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.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 supplychain.shipper;
+
+
+import java.util.Hashtable;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+
+/**
+ * This class implements the Shipper service component.
+ */
+public class OSGiShipperFactoryImpl implements BundleActivator, ServiceFactory {
+
+ private BundleContext bundleContext;
+
+ public OSGiShipperFactoryImpl() {
+
+ }
+
+
+ public void start(BundleContext bc) {
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("shipperName", "RoyalMail");
+ bc.registerService(Shipper.class.getName(), this, props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("shipperName", "ParcelForce");
+ bc.registerService(Shipper.class.getName(), this, props2);
+ }
+
+
+
+
+ public void stop(BundleContext context) throws Exception {
+
+ }
+
+
+ public Object getService(Bundle bundle, ServiceRegistration reg) {
+ OSGiShipperImpl shipper = new OSGiShipperImpl(false);
+ shipper.start(bundleContext);
+ OSGiStatelessShipperServiceImpl shipperService = new OSGiStatelessShipperServiceImpl(shipper,
+ (String)reg.getReference().getProperty("shipperName"));
+ return shipperService;
+ }
+
+ public void ungetService(Bundle arg0, ServiceRegistration arg1, Object arg2) {
+
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java
new file mode 100644
index 0000000000..effae8c246
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.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 supplychain.shipper;
+
+
+import java.util.Hashtable;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component.
+ */
+public class OSGiShipperImpl extends OSGiBundleImpl {
+
+ protected Customer customer;
+
+
+ public OSGiShipperImpl() {
+
+ super(new String[]{"customer"}, null);
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("shipperName", "RoyalMail");
+ registerService(new OSGiShipperServiceImpl(this, "RoyalMail"),
+ "supplychain.shipper.Shipper", props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("shipperName", "ParcelForce");
+ registerService(
+ new OSGiShipperServiceImpl(this, "ParcelForce"),
+ "supplychain.shipper.Shipper", props2);
+ }
+
+ // Used only by service factories
+ public OSGiShipperImpl(boolean ignore) {
+
+ super(new String[]{"customer"}, null);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java
new file mode 100644
index 0000000000..4effadf208
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.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 supplychain.shipper;
+
+
+/**
+ * This class implements the Shipper service.
+ */
+public class OSGiShipperServiceImpl implements Shipper {
+
+ private OSGiShipperImpl shipperImpl;
+
+ private String shipperName;
+
+ OSGiShipperServiceImpl(OSGiShipperImpl shipperImpl, String shipperName) {
+ this.shipperImpl = shipperImpl;
+ this.shipperName = shipperName;
+ }
+
+ public void processShipment(String order) {
+
+ System.out.println("Shipper.submitOrder, warehouse is " + shipperImpl.customer);
+ shipperImpl.customer.notifyShipment(order + ", shipped (" + shipperName + ")");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java
new file mode 100644
index 0000000000..13bce67bb4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.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 supplychain.shipper;
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * This class implements the Shipper service component.
+ */
+@Scope("STATELESS")
+public class OSGiStatelessShipperComponentImpl extends OSGiShipperComponentImpl {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java
new file mode 100644
index 0000000000..071a131f40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.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 supplychain.shipper;
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * This class implements the Shipper service.
+ */
+@Scope("STATELESS")
+public class OSGiStatelessShipperServiceImpl extends OSGiShipperServiceImpl {
+
+ public OSGiStatelessShipperServiceImpl(OSGiShipperImpl shipperImpl, String shipperName) {
+ super(shipperImpl, shipperName);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java
new file mode 100644
index 0000000000..6ebd1f2894
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.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 supplychain.shipper;
+
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component.
+ */
+public class OSGiVersionedShipperImpl extends OSGiBundleImpl {
+
+ protected Customer customer;
+
+ private int version;
+
+
+ public OSGiVersionedShipperImpl() {
+
+ super(new String[]{"customer"}, null);
+ }
+
+ protected void started(BundleContext bc) {
+
+ String jarFile = bc.getBundle().getLocation();
+ if (jarFile.endsWith("1.jar")) version = 1;
+ else if (jarFile.endsWith("2.jar")) version = 2;
+
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("shipperName", "RoyalMail");
+ props1.put("component.service.name", "ShipperComponent"+version+"/ShipperService1");
+ bc.registerService("supplychain.shipper.Shipper",
+ new OSGiVersionedShipperServiceImpl(this, "RoyalMail", version),
+ props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("shipperName", "ParcelForce");
+ props2.put("component.service.name", "ShipperComponent"+version+"/ShipperService2");
+ bc.registerService("supplychain.shipper.Shipper",
+ new OSGiVersionedShipperServiceImpl(this, "ParcelForce", version),
+ props2);
+
+ try {
+ ServiceReference[] refs = bc.getServiceReferences(Customer.class.getName(),
+ "(component.service.name=CustomerComponent" + version + "/CustomerService)");
+ if (refs != null && refs.length > 0) {
+ customer = (Customer) bc.getService(refs[0]);
+ }
+ } catch (InvalidSyntaxException e) {
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java
new file mode 100644
index 0000000000..b66961b1c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.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 supplychain.shipper;
+
+
+/**
+ * This class implements the Shipper service.
+ */
+public class OSGiVersionedShipperServiceImpl implements Shipper {
+
+ private OSGiVersionedShipperImpl shipperImpl;
+
+ private String shipperName;
+
+ private int version;
+
+ OSGiVersionedShipperServiceImpl(OSGiVersionedShipperImpl shipperImpl, String shipperName, int version) {
+ this.shipperImpl = shipperImpl;
+ this.shipperName = shipperName;
+ this.version = version;
+ }
+
+ public void processShipment(String order) {
+
+ System.out.println("Shipper.processShipment, version " + version + " customer is " + shipperImpl.customer);
+ shipperImpl.customer.notifyShipment(order + ", shipped (" + shipperName + ")");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/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.shipper;
+
+/**
+ * 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-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..9edf3567e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.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 supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+@Service(Warehouse.class)
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("JavaWarehouseComponentImpl.fulfillOrder : shipper is " + shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java
new file mode 100644
index 0000000000..659f16be7f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.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 supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+@Service(interfaces={Warehouse.class, WarehouseQuery.class})
+@Scope("COMPOSITE")
+public class JavaWarehouseWithQueryComponentImpl implements Warehouse, WarehouseQuery {
+
+ private Shipper shipper;
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("JavaWarehouseComponentImpl.fulfillOrder : shipper is " + shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+ public boolean isAvailable(String order) {
+ return true;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
new file mode 100644
index 0000000000..7c9e102fd2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.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 supplychain.warehouse;
+
+
+import org.osgi.service.component.ComponentContext;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+
+public class OSGiWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ protected void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ protected void unsetShipper(Shipper shipper) {
+ // this.shipper = null;
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("OSGiWarehouseComponentImpl.fulfillOrder : shipper is " + shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiWarehouseComponentImpl ");
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiWarehouseComponentImpl ");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
new file mode 100644
index 0000000000..bb04ff42e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.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 supplychain.warehouse;
+
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+
+public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse {
+
+ protected Shipper shipper;
+ private OSGiWarehouseServiceImpl warehouseService1;
+ private OSGiWarehouseServiceImpl warehouseService2;
+
+ public OSGiWarehouseImpl() {
+ super(new String[]{"shipper"}, null);
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("component.name", "WarehouseComponent1");
+ warehouseService1 = new OSGiWarehouseServiceImpl(this, 2);
+ registerService(warehouseService1,
+ "supplychain.warehouse.Warehouse", props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("component.name", "WarehouseComponent2");
+ warehouseService2 = new OSGiWarehouseServiceImpl(this, 1);
+ registerService(warehouseService2,
+ "supplychain.warehouse.Warehouse", props2);
+ }
+
+ protected void started(BundleContext bc) {
+ warehouseService1.started(bc);
+ warehouseService2.started(bc);
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("OSGiWarehouseImpl.fulfillOrder : shipper is " + shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java
new file mode 100644
index 0000000000..3317816557
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.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 supplychain.warehouse;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+import supplychain.shipper.Shipper;
+
+
+/**
+ * This class implements the Warehouse service.
+ */
+public class OSGiWarehouseServiceImpl implements Warehouse {
+
+ private OSGiWarehouseImpl warehouseImpl;
+ private Shipper shipper;
+ private int shipperNum;
+
+
+ OSGiWarehouseServiceImpl(OSGiWarehouseImpl warehouseImpl, int shipperNum) {
+ this.warehouseImpl = warehouseImpl;
+ this.shipperNum = shipperNum;
+ }
+
+
+ protected void started(BundleContext bc) {
+ try {
+ ServiceReference[] refs = bc.getServiceReferences(Shipper.class.getName(),
+ "(component.service.name=ShipperComponent" + shipperNum + "/Shipper)");
+ if (refs != null && refs.length > 0) {
+ shipper = (Shipper) bc.getService(refs[0]);
+ }
+ } catch (InvalidSyntaxException e) {
+ }
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("OSGiWarehouseImpl.fulfillOrder : shipper is " + warehouseImpl.shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/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.warehouse;
+
+/**
+ * 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-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java
new file mode 100644
index 0000000000..6d1ad76796
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.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.warehouse;
+
+/**
+ * This is the business interface of the RetailerQuery service.
+ */
+public interface WarehouseQuery {
+
+ public boolean isAvailable(String order);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/CallbackClient.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/CallbackClient.componentType
new file mode 100644
index 0000000000..71e248590b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/CallbackClient.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CallbackClient">
+ <interface.java interface="callback.client.CallbackClient"/>
+ </service>
+
+
+ <reference name="callbackService" >
+ <interface.java interface="callback.service.CallbackService"
+ callbackInterface="callback.client.CallbackCallback" />
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/CallbackService.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/CallbackService.componentType
new file mode 100644
index 0000000000..7c1125bbb5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/CallbackService.componentType
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CallbackService">
+ <interface.java interface="callback.service.CallbackService"
+ callbackInterface="callback.client.CallbackCallback"/>
+ </service>
+
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test1.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test1.composite
new file mode 100644
index 0000000000..8456b878f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test1.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://callback"
+ name="CallbackTest">
+
+ <component name="CallbackClient">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="callback.CallbackClient">
+
+ <properties referenceCallback="callbackService">
+ <property name="component.name">CallbackClient</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="callbackService" target="CallbackService"/>
+ </component>
+
+ <component name="CallbackService">
+ <implementation.java class="callback.service.JavaCallbackServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test2.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test2.composite
new file mode 100644
index 0000000000..d5a47c6403
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test2.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://callback"
+ name="CallbackTest">
+
+ <component name="CallbackClient">
+ <implementation.java class="callback.client.JavaCallbackClientImpl"/>
+ <reference name="callbackService" target="CallbackService"/>
+ </component>
+
+
+ <component name="CallbackService">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="callback.CallbackService"
+ >
+ <properties serviceCallback="CallbackService">
+ <property name="component.name">CallbackClient</property>
+ </properties>
+
+ </implementation.osgi >
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test3.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test3.composite
new file mode 100644
index 0000000000..e6391d2159
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/callback/callback-test3.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"
+ targetNamespace="http://callback"
+ name="CallbackTest">
+
+ <component name="CallbackClient">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="callback.CallbackClient"
+ />
+ <reference name="callbackService" target="CallbackService"/>
+ </component>
+
+
+ <component name="CallbackService">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="callback.CallbackService"
+ />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalClient.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalClient.componentType
new file mode 100644
index 0000000000..c79ede815b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalClient.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="ConversationalClient">
+ <interface.java interface="conversation.client.ConversationalClient"/>
+ </service>
+
+
+ <reference name="conversationalReferenceClient" >
+ <interface.java interface="conversation.referenceclient.ConversationalReferenceClient" />
+ </reference>
+
+ <reference name="conversationalService" >
+ <interface.java interface="conversation.service.ConversationalService"
+ callbackInterface="conversation.client.ConversationalCallback" />
+ </reference>
+
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalReferenceClient.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalReferenceClient.componentType
new file mode 100644
index 0000000000..04cc73b85c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalReferenceClient.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+
+ <service name="ConversationalReferenceClient">
+ <interface.java interface="conversation.referenceclient.ConversationalReferenceClient"/>
+ </service>
+
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalService.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalService.componentType
new file mode 100644
index 0000000000..9ece700efe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/ConversationalService.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="ConversationalService">
+ <interface.java interface="conversation.service.ConversationalService"
+ callbackInterface="conversation.client.ConversationalCallback" />
+ </service>
+
+
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/conversation-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/conversation-test.composite
new file mode 100644
index 0000000000..52bc43478d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/conversation/conversation-test.composite
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <!-- <implementation.java class="conversation.ConversationalClientStatelessImpl"/> -->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalClient"
+ classes="conversation.client.ConversationalClientStatelessImpl">
+
+ <properties service="ConversationalClient">
+ <property name="component.name">ConversationalStatelessClientStatelessService</property>
+ </properties>
+ <properties reference="conversationalReferenceClient">
+ <property name="component.name">ConversationalReferenceClient</property>
+ </properties>
+ <properties reference="conversationalService">
+ <property name="component.name">ConversationalServiceStateless</property>
+ </properties>
+ <properties serviceCallback="$callback$.conversationalService">
+ <property name="component.name">ConversationalStatelessClientStatelessService</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient/ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateless/ConversationalService"/>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <!--<implementation.java class="conversation.ConversationalClientStatelessImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalClient"
+ classes="conversation.client.ConversationalClientStatelessImpl">
+
+ <properties service="ConversationalClient">
+ <property name="component.name">ConversationalStatelessClientStatefulService</property>
+ </properties>
+ <properties reference="conversationalReferenceClient">
+ <property name="component.name">ConversationalReferenceClient</property>
+ </properties>
+ <properties reference="conversationalService">
+ <property name="component.name">ConversationalServiceStateful</property>
+ </properties>
+ <properties serviceCallback="$callback$.conversationalService">
+ <property name="component.name">ConversationalStatelessClientStatefulService</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient/ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful/ConversationalService"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <!--<implementation.java class="conversation.ConversationalClientStatefulImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalClient"
+ classes="conversation.client.ConversationalClientStatefulImpl">
+
+ <properties service="ConversationalClient">
+ <property name="component.name">ConversationalStatefulClientStatelessService</property>
+ </properties>
+ <properties reference="conversationalReferenceClient">
+ <property name="component.name">ConversationalReferenceClient</property>
+ </properties>
+ <properties reference="conversationalService">
+ <property name="component.name">ConversationalServiceStateless</property>
+ </properties>
+ <properties serviceCallback="$callback$.conversationalService">
+ <property name="component.name">ConversationalStatefulClientStatelessService</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient/ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateless/ConversationalService"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <!--<implementation.java class="conversation.ConversationalClientStatefulImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalClient"
+ classes="conversation.client.ConversationalClientStatefulImpl">
+
+ <properties service="ConversationalClient">
+ <property name="component.name">ConversationalStatefulClientStatefulService</property>
+ </properties>
+ <properties reference="conversationalReferenceClient">
+ <property name="component.name">ConversationalReferenceClient</property>
+ </properties>
+ <properties reference="conversationalService">
+ <property name="component.name">ConversationalServiceStateful</property>
+ </properties>
+ <properties serviceCallback="$callback$.conversationalService">
+ <property name="component.name">ConversationalStatefulClientStatefulService</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient/ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful/ConversationalService"/>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <!--<implementation.java class="conversation.ConversationalReferenceClientImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalReferenceClient"
+ classes="conversation.referenceclient.ConversationalReferenceClientImpl"
+ />
+
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <!--<implementation.java class="conversation.ConversationalServiceStatefulImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalService"
+ classes="conversation.service.ConversationalServiceStatefulImpl">
+
+ <properties service="ConversationalService">
+ <property name="component.name">ConversationalServiceStateful</property>
+ </properties>
+ </implementation.osgi>
+
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <!--<implementation.java class="conversation.ConversationalServiceStatelessImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalService"
+ classes="conversation.service.ConversationalServiceStatelessImpl">
+
+ <properties service="ConversationalService">
+ <property name="component.name">ConversationalServiceStateless</property>
+ </properties>
+ </implementation.osgi>
+
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Customer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Customer.componentType
new file mode 100644
index 0000000000..1fd551be3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Retailer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Retailer.componentType
new file mode 100644
index 0000000000..5599c44bc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Shipper.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Warehouse.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/Warehouse.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Customer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Customer.componentType
new file mode 100644
index 0000000000..1fd551be3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Retailer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Retailer.componentType
new file mode 100644
index 0000000000..5599c44bc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Shipper.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Warehouse.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/Warehouse.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/factory-ds-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/factory-ds-test.composite
new file mode 100644
index 0000000000..0b8d2e5851
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/ds/factory-ds-test.composite
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.customer.Customer"
+ classes="supplychain.customer.OSGiStatelessCustomerComponentImpl" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1"/>
+
+ <reference name="retailer2" target="RetailerComponent2" />
+
+ <reference name="retailer3" target="RetailerComponent3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.shipper.Shipper"
+ classes="supplychain.shipper.OSGiStatelessShipperComponentImpl" >
+
+ <properties service="Shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.shipper.Shipper"
+ classes="supplychain.shipper.OSGiStatelessShipperComponentImpl" >
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/factory-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/factory-test.composite
new file mode 100644
index 0000000000..87370a6df4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/factory/factory-test.composite
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.customer.Customer"
+ classes="supplychain.customer.OSGiStatelessCustomerImpl" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1"/>
+
+ <reference name="retailer2" target="RetailerComponent2" />
+
+ <reference name="retailer3" target="RetailerComponent3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.retailer.Retailer">
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.shipper.Shipper"
+ classes="supplychain.shipper.OSGiStatelessShipperServiceImpl" >
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+ </component>
+
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/helloworld/Greetings.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/helloworld/Greetings.componentType
new file mode 100644
index 0000000000..127349eacf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/helloworld/Greetings.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Greetings">
+ <interface.java interface="helloworld.Greetings"/>
+ </service>
+
+
+ <reference name="greetingsService" >
+ <interface.java interface="helloworld.Greetings" />
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/helloworld/HelloWorld.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/helloworld/HelloWorld.componentType
new file mode 100644
index 0000000000..7e3810c458
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/helloworld/HelloWorld.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="OSGiHelloWorld">
+ <interface.java interface="helloworld.HelloWorld"/>
+ </service>
+
+
+ <reference name="helloWorldWS" >
+ <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" / -->
+ <interface.java interface="helloworld.ws.HelloWorld" />
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Customer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Customer.componentType
new file mode 100644
index 0000000000..fb9a112d18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailerQuery">
+ <interface.java interface="supplychain.retailer.RetailerQuery"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Retailer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Retailer.componentType
new file mode 100644
index 0000000000..ee732b5efc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerQuery">
+ <interface.java interface="supplychain.retailer.RetailerQuery"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <reference name="warehouseQuery">
+ <interface.java interface="supplychain.warehouse.WarehouseQuery"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Shipper.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Warehouse.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Warehouse.componentType
new file mode 100644
index 0000000000..b1723660d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <service name="WarehouseQuery">
+ <interface.java interface="supplychain.warehouse.WarehouseQuery"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Customer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Customer.componentType
new file mode 100644
index 0000000000..fb9a112d18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailerQuery">
+ <interface.java interface="supplychain.retailer.RetailerQuery"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Retailer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Retailer.componentType
new file mode 100644
index 0000000000..ee732b5efc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerQuery">
+ <interface.java interface="supplychain.retailer.RetailerQuery"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <reference name="warehouseQuery">
+ <interface.java interface="supplychain.warehouse.WarehouseQuery"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Shipper.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Warehouse.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Warehouse.componentType
new file mode 100644
index 0000000000..b1723660d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <service name="WarehouseQuery">
+ <interface.java interface="supplychain.warehouse.WarehouseQuery"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/interfaces-ds-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/interfaces-ds-test.composite
new file mode 100644
index 0000000000..5172cbe21e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/ds/interfaces-ds-test.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.interfaces.supplychain.customer.Customer"
+ />
+ <reference name="retailer" target="RetailerComponent/Retailer"/>
+ <reference name="retailerQuery" target="RetailerComponent/RetailerQuery"/>
+
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.interfaces.supplychain.retailer.Retailer"
+ />
+ <reference name="warehouse" target="WarehouseComponent/Warehouse"/>
+ <reference name="warehouseQuery" target="WarehouseComponent/WarehouseQuery"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseWithQueryComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.interfaces.supplychain.shipper.Shipper"
+ />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/interfaces-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/interfaces-test.composite
new file mode 100644
index 0000000000..b7591e732d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/interfaces/interfaces-test.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="interfaces.supplychain.customer.Customer"
+ />
+ <reference name="retailer" target="RetailerComponent/Retailer"/>
+ <reference name="retailerQuery" target="RetailerComponent/RetailerQuery"/>
+
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="interfaces.supplychain.retailer.Retailer"
+ />
+ <reference name="warehouse" target="WarehouseComponent/Warehouse"/>
+ <reference name="warehouseQuery" target="WarehouseComponent/WarehouseQuery"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseWithQueryComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="interfaces.supplychain.shipper.Shipper"
+ />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackClient.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackClient.mf
new file mode 100644
index 0000000000..cf8717fcf5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackClient.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CallbackClient
+Bundle-SymbolicName: callback.CallbackClient
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, callback.service
+Export-Package: callback.client
+Bundle-Activator: callback.client.OSGiCallbackClientImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackService.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackService.mf
new file mode 100644
index 0000000000..785212fa6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackService.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CallbackService
+Bundle-SymbolicName: callback.CallbackService
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, callback.client
+Export-Package: callback.service
+Bundle-Activator: callback.service.OSGiCallbackServiceImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalClient.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalClient.mf
new file mode 100644
index 0000000000..7a06030e32
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalClient.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ConversationTest
+Bundle-SymbolicName: conversation.ConversationalClient
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osoa.sca, org.osoa.sca.annotations,
+ conversation.service, conversation.referenceclient
+Export-Package: conversation.client
+Bundle-Activator: conversation.client.ConversationalClientActivator
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalReferenceClient.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalReferenceClient.mf
new file mode 100644
index 0000000000..5c39b53b0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalReferenceClient.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ConversationTest
+Bundle-SymbolicName: conversation.ConversationalReferenceClient
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osoa.sca, org.osoa.sca.annotations,
+ conversation.service
+Export-Package: conversation.referenceclient
+Bundle-Activator: conversation.referenceclient.ConversationalReferenceClientActivator
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalService.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalService.mf
new file mode 100644
index 0000000000..b8bb809319
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalService.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ConversationTest
+Bundle-SymbolicName: conversation.ConversationalService
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osoa.sca, org.osoa.sca.annotations,
+ conversation.client
+Export-Package: conversation.service
+Bundle-Activator: conversation.service.ConversationalServiceActivator
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Customer.mf
new file mode 100644
index 0000000000..26f32fe617
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Customer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: factory.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer
+Export-Package: supplychain.customer
+Bundle-Activator: supplychain.customer.OSGiCustomerFactoryImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Retailer.mf
new file mode 100644
index 0000000000..1b9e0e847e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: factory.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Shipper.mf
new file mode 100644
index 0000000000..6066a38f29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: factory.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer
+Export-Package: supplychain.shipper
+Bundle-Activator: supplychain.shipper.OSGiShipperFactoryImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.mf
new file mode 100644
index 0000000000..777edd3f7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.factory.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer
+Export-Package: supplychain.customer
+Service-Component: osgi/factory/ds/Customer.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.xml
new file mode 100644
index 0000000000..d8adaa2ba3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="CustomerComponent" >
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service servicefactory="true" >
+ <provide interface="supplychain.customer.Customer" />
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer.mf
new file mode 100644
index 0000000000..e0bd9d8c10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.factory.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Service-Component: osgi/factory/ds/Retailer1.xml, osgi/factory/ds/Retailer2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer1.xml
new file mode 100644
index 0000000000..6005ae785c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer1.xml
@@ -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.
+-->
+<component name="RetailerComponent1" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service servicefactory="true">
+ <provide interface="supplychain.retailer.Retailer" />
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <property name="retailerName">amazon.com</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer2.xml
new file mode 100644
index 0000000000..6f0b79ebc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer2.xml
@@ -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.
+-->
+<component name="RetailerComponent2" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service servicefactory="true">
+ <provide interface="supplychain.retailer.Retailer" />
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper.mf
new file mode 100644
index 0000000000..d4b461460e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.factory.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer
+Export-Package: supplychain.shipper
+Service-Component: osgi/factory/ds/Shipper1.xml, osgi/factory/ds/Shipper2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper1.xml
new file mode 100644
index 0000000000..bb15e6e3aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper1.xml
@@ -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.
+-->
+<component name="ShipperComponent1" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service servicefactory="true">
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper2.xml
new file mode 100644
index 0000000000..7591201b8c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper2.xml
@@ -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.
+-->
+<component name="ShipperComponent2">
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service servicefactory="true">
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.mf
new file mode 100644
index 0000000000..0e844fab99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.factory.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Service-Component: osgi/factory/ds/Warehouse.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.xml
new file mode 100644
index 0000000000..fc86a76784
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.xml
@@ -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.
+-->
+<component name="WarehouseComponent" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Customer.mf
new file mode 100644
index 0000000000..a8a87c5c8c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Customer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: interfaces.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer
+Export-Package: supplychain.customer
+Bundle-Activator: supplychain.customer.OSGiCustomerWithQueryImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Retailer.mf
new file mode 100644
index 0000000000..05bbf4db88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: interfaces.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Bundle-Activator: supplychain.retailer.OSGiRetailerWithQueryImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Shipper.mf
new file mode 100644
index 0000000000..a12d1a21ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: interfaces.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer
+Export-Package: supplychain.shipper
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.mf
new file mode 100644
index 0000000000..2214db11a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.interfaces.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer
+Export-Package: supplychain.customer
+Service-Component: osgi/interfaces/ds/Customer.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.xml
new file mode 100644
index 0000000000..8d44067992
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.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.
+-->
+<component name="CustomerComponent" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerWithQueryComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer"
+ unbind="unsetRetailer"
+ target="(component.service.name=RetailerComponent/Retailer)"
+ policy="dynamic"
+ />
+
+ <reference
+ name="retailerQuery"
+ interface="supplychain.retailer.RetailerQuery"
+ bind="setRetailerQuery"
+ unbind="unsetRetailerQuery"
+ target="(component.service.name=RetailerComponent/RetailerQuery)"
+ policy="dynamic"
+ />
+
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.mf
new file mode 100644
index 0000000000..60c0fb3fd3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.interfaces.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Service-Component: osgi/interfaces/ds/Retailer.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.xml
new file mode 100644
index 0000000000..ca1392d2b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.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.
+-->
+<component name="RetailerComponent" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerWithQueryComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ <provide interface="supplychain.retailer.RetailerQuery"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <reference
+ name="supplychain.warehouse.WarehouseQuery"
+ interface="supplychain.warehouse.WarehouseQuery"
+ bind="setWarehouseQuery"
+ unbind="unsetWarehouseQuery"
+ />
+ <property name="retailerName">amazon.com</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.mf
new file mode 100644
index 0000000000..7c9f67c36d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.interfaces.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer
+Export-Package: supplychain.shipper
+Service-Component: osgi/interfaces/ds/Shipper.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.xml
new file mode 100644
index 0000000000..760c761666
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.xml
@@ -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.
+-->
+<component name="ShipperComponent" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/passbyref/Greetings.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/passbyref/Greetings.mf
new file mode 100644
index 0000000000..7d56770311
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/passbyref/Greetings.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Greetings
+Bundle-SymbolicName: passbyref.helloworld.Greetings
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework
+Export-Package: helloworld
+Bundle-Activator: helloworld.OSGiGreetingsImpl
+
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ManagedStockQuoteFactory.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ManagedStockQuoteFactory.mf
new file mode 100644
index 0000000000..321bdc713f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ManagedStockQuoteFactory.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: stockquote.ManagedStockQuoteFactory
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.cm
+Export-Package: stockquote
+Bundle-Activator: stockquote.OSGiManagedStockQuoteFactoryImpl
+
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuote.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuote.mf
new file mode 100644
index 0000000000..66f98011cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuote.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: stockquote.StockQuote
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.cm
+Export-Package: stockquote
+Bundle-Activator: stockquote.OSGiStockQuoteImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuoteFactory.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuoteFactory.mf
new file mode 100644
index 0000000000..6874a66db9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuoteFactory.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: stockquote.StockQuoteFactory
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.cm
+Export-Package: stockquote
+Bundle-Activator: stockquote.OSGiStockQuoteFactoryImpl
+
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.mf
new file mode 100644
index 0000000000..47d290eb1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.mf
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: ds.stockquote.StockQuote
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.component, org.osgi.service.cm
+Export-Package: stockquote
+Service-Component: osgi/properties/ds/StockQuote.xml
+
+
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.xml
new file mode 100644
index 0000000000..c7f13a50a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.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.
+-->
+<component name="StockQuoteComponent" immediate="true">
+ <implementation class="stockquote.OSGiStockQuoteComponentImpl" />
+ <service>
+ <provide interface="stockquote.StockQuote"/>
+ </service>
+ <property name="currency">GBP</property>
+ <property name="exchangeRate" type="Double">1.0</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.mf
new file mode 100644
index 0000000000..f4c102c4f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.mf
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: ds.stockquote.StockQuoteFactory
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.component, org.osgi.service.cm
+Export-Package: stockquote
+Service-Component: osgi/properties/ds/StockQuoteFactory.xml
+
+
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.xml
new file mode 100644
index 0000000000..cbebf7eec2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.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.
+-->
+<component name="StockQuoteComponent" >
+ <implementation class="stockquote.OSGiStockQuoteComponentImpl" />
+ <service servicefactory="true" >
+ <provide interface="stockquote.StockQuote" />
+ </service>
+ <property name="currency">GBP</property>
+ <property name="exchangeRate" type="Double">1.0</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldClient.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldClient.mf
new file mode 100644
index 0000000000..6a3c845cca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldClient.mf
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: HelloWorldClient
+Bundle-SymbolicName: ds.helloworld.sdo.HelloWorldClient
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.component,
+ org.osoa.sca, org.osoa.sca.annotations,
+ commonj.sdo, commonj.sdo.helper,
+ org.apache.tuscany.sdo.helper, org.apache.tuscany.sdo.impl, org.apache.tuscany.sdo.model, org.apache.tuscany.sdo.model.impl,
+ org.eclipse.emf.ecore, org.eclipse.emf.ecore.util, org.eclipse.emf.ecore.impl,
+ helloworld.sdo
+Export-Package: helloworld.sdo.client
+Service-Component: osgi/sdo/ds/HelloWorldClient.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldClient.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldClient.xml
new file mode 100644
index 0000000000..cb6345432f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldClient.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="HelloWorldClientComponent" immediate="true">
+ <implementation class="helloworld.sdo.client.HelloWorldClientComponent" />
+ <service>
+ <provide interface="helloworld.sdo.client.HelloWorldClient"/>
+ </service>
+ <reference
+ name="helloWorldService"
+ interface="helloworld.sdo.HelloWorldService"
+ bind="setHelloWorldService"
+ unbind="unsetHelloWorldService"
+ target="(component.service.name=JavaHelloWorldServiceComponent/HelloWorldService)"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldService.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldService.mf
new file mode 100644
index 0000000000..89871fa8f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldService.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: HelloWorldService
+Bundle-SymbolicName: ds.helloworld.sdo.HelloWorldService
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.component,
+ org.osoa.sca, org.osoa.sca.annotations,
+ commonj.sdo, commonj.sdo.helper,
+ org.apache.tuscany.sdo.helper, org.apache.tuscany.sdo.impl, org.apache.tuscany.sdo.model, org.apache.tuscany.sdo.model.impl,
+ org.eclipse.emf.ecore, org.eclipse.emf.ecore.util, org.eclipse.emf.ecore.impl
+Export-Package: helloworld.sdo
+Service-Component: osgi/sdo/ds/HelloWorldService.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldService.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldService.xml
new file mode 100644
index 0000000000..d968d1ffc5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/sdo/ds/HelloWorldService.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.
+-->
+<component name="HelloWorldServiceComponent" immediate="true">
+ <implementation class="helloworld.sdo.HelloWorldServiceComponent" />
+ <service>
+ <provide interface="helloworld.sdo.HelloWorldService"/>
+ </service>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Customer.mf
new file mode 100644
index 0000000000..fc762df8d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Customer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: services.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer
+Export-Package: supplychain.customer
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Retailer.mf
new file mode 100644
index 0000000000..02e42bc010
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: services.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Shipper.mf
new file mode 100644
index 0000000000..390367b99b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: services.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer
+Export-Package: supplychain.shipper
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Warehouse.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Warehouse.mf
new file mode 100644
index 0000000000..4715cbd976
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/Warehouse.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: services.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.mf
new file mode 100644
index 0000000000..932fb8a483
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.services.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer
+Export-Package: supplychain.customer
+Service-Component: osgi/services/ds/Customer.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.xml
new file mode 100644
index 0000000000..b10d0416dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="CustomerComponent" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer.mf
new file mode 100644
index 0000000000..c799f31606
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.services.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Service-Component: osgi/services/ds/Retailer1.xml, osgi/services/ds/Retailer2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer1.xml
new file mode 100644
index 0000000000..db68d7e333
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer1.xml
@@ -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.
+-->
+<component name="RetailerComponent1" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <property name="retailerName">amazon.com</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer2.xml
new file mode 100644
index 0000000000..1aea3cf669
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer2.xml
@@ -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.
+-->
+<component name="RetailerComponent2" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper.mf
new file mode 100644
index 0000000000..106bd1b6aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.services.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer
+Export-Package: supplychain.shipper
+Service-Component: osgi/services/ds/Shipper1.xml, osgi/services/ds/Shipper2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper1.xml
new file mode 100644
index 0000000000..1e3c915a59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper1.xml
@@ -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.
+-->
+<component name="ShipperComponent1" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper2.xml
new file mode 100644
index 0000000000..d7d0b41f5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper2.xml
@@ -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.
+-->
+<component name="ShipperComponent2" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse.mf
new file mode 100644
index 0000000000..81c51e6804
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.services.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Service-Component: osgi/services/ds/Warehouse1.xml, osgi/services/ds/Warehouse2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse1.xml
new file mode 100644
index 0000000000..ca50b554df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse1.xml
@@ -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.
+-->
+<component name="WarehouseComponent1" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse2.xml
new file mode 100644
index 0000000000..14658127f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse2.xml
@@ -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.
+-->
+<component name="WarehouseComponent2" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Customer1.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Customer1.mf
new file mode 100644
index 0000000000..335bc419c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Customer1.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: version.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.customer;version="1.0.0"
+Bundle-Activator: supplychain.customer.OSGiVersionedCustomerImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Customer2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Customer2.mf
new file mode 100644
index 0000000000..a68b9d6dbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Customer2.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: version.supplychain.customer.Customer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.customer;version="2.0.0"
+Bundle-Activator: supplychain.customer.OSGiVersionedCustomerImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Retailer1.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Retailer1.mf
new file mode 100644
index 0000000000..02f79c15f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Retailer1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: version.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer;version="1.0.0"
+Bundle-Activator: supplychain.retailer.OSGiVersionedRetailerImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Retailer2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Retailer2.mf
new file mode 100644
index 0000000000..8428b08d96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Retailer2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: version.supplychain.retailer.Retailer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer;version="2.0.0"
+Bundle-Activator: supplychain.retailer.OSGiVersionedRetailerImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Shipper1.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Shipper1.mf
new file mode 100644
index 0000000000..c81bf00d00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Shipper1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: version.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.shipper;version="1.0.0"
+Bundle-Activator: supplychain.shipper.OSGiVersionedShipperImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Shipper2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Shipper2.mf
new file mode 100644
index 0000000000..61c161617c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Shipper2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: version.supplychain.shipper.Shipper
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.shipper;version="2.0.0"
+Bundle-Activator: supplychain.shipper.OSGiVersionedShipperImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse1.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse1.mf
new file mode 100644
index 0000000000..fd6a26a65f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: version.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.warehouse;version="1.0.0"
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse2.mf
new file mode 100644
index 0000000000..0168bc2435
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: version.supplychain.warehouse.Warehouse
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper;version="2.0.0"
+Export-Package: supplychain.warehouse;version="2.0.0"
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer1.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer1.mf
new file mode 100644
index 0000000000..6674cdd7f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.version.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.customer;version="1.0.0"
+Service-Component: osgi/version/ds/CustomerV1.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer2.mf
new file mode 100644
index 0000000000..72df35ef41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.version.supplychain.customer.Customer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.customer;version="2.0.0"
+Service-Component: osgi/version/ds/CustomerV2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV1.xml
new file mode 100644
index 0000000000..724c8132df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV1.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="CustomerComponent1" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV2.xml
new file mode 100644
index 0000000000..1e5035d949
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV2.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="CustomerComponent2" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1.mf
new file mode 100644
index 0000000000..85bfd86422
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.version.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer;version="1.0.0"
+Service-Component: osgi/version/ds/Retailer1V1.xml, osgi/version/ds/Retailer2V1.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V1.xml
new file mode 100644
index 0000000000..6e51b3d6f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V1.xml
@@ -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.
+-->
+<component name="RetailerComponent1.Retailer1" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent1/Warehouse)"
+ />
+ <property name="retailerName">amazon.com</property>
+ <property name="version">1</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V2.xml
new file mode 100644
index 0000000000..9a87758ec2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V2.xml
@@ -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.
+-->
+<component name="RetailerComponent2.Retailer1" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent2/Warehouse)"
+ />
+ <property name="retailerName">amazon.com</property>
+ <property name="version">2</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2.mf
new file mode 100644
index 0000000000..e134bd1061
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.version.supplychain.retailer.Retailer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer;version="2.0.0"
+Service-Component: osgi/version/ds/Retailer1V2.xml, osgi/version/ds/Retailer2V2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V1.xml
new file mode 100644
index 0000000000..c19895bab1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V1.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="RetailerComponent1.Retailer2" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent1/Warehouse)"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V2.xml
new file mode 100644
index 0000000000..707609d2c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V2.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="RetailerComponent2.Retailer2" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent2/Warehouse)"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1.mf
new file mode 100644
index 0000000000..e084e5831a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.version.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.shipper;version="1.0.0"
+Service-Component: osgi/version/ds/Shipper1V1.xml, osgi/version/ds/Shipper2V1.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V1.xml
new file mode 100644
index 0000000000..d96f6481fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V1.xml
@@ -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.
+-->
+<component name="ShipperComponent1.ShipperService1" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ target="(component.name=CustomerComponent1)"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V2.xml
new file mode 100644
index 0000000000..10ef690c9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V2.xml
@@ -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.
+-->
+<component name="ShipperComponent2.ShipperService1" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ target="(component.name=CustomerComponent2)"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2.mf
new file mode 100644
index 0000000000..003f9dca5a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.version.supplychain.shipper.Shipper
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.shipper;version="2.0.0"
+Service-Component: osgi/version/ds/Shipper1V2.xml, osgi/version/ds/Shipper2V2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V1.xml
new file mode 100644
index 0000000000..fefdea106d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V1.xml
@@ -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.
+-->
+<component name="ShipperComponent1.ShipperService2" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ target="(component.name=CustomerComponent1)"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V2.xml
new file mode 100644
index 0000000000..f6b847ed59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V2.xml
@@ -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.
+-->
+<component name="ShipperComponent2.ShipperService2" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ target="(component.name=CustomerComponent2)"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1.mf
new file mode 100644
index 0000000000..5cff2f573e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.version.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.warehouse;version="1.0.0"
+Service-Component: osgi/version/ds/Warehouse1V1.xml, osgi/version/ds/Warehouse2V2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V1.xml
new file mode 100644
index 0000000000..ca50b554df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V1.xml
@@ -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.
+-->
+<component name="WarehouseComponent1" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V2.xml
new file mode 100644
index 0000000000..14658127f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V2.xml
@@ -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.
+-->
+<component name="WarehouseComponent2" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2.mf
new file mode 100644
index 0000000000..0fec68a725
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.version.supplychain.warehouse.Warehouse
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.warehouse;version="2.0.0"
+Service-Component: osgi/version/ds/Warehouse1V1.xml, osgi/version/ds/Warehouse2V2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V1.xml
new file mode 100644
index 0000000000..ca50b554df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V1.xml
@@ -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.
+-->
+<component name="WarehouseComponent1" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V2.xml
new file mode 100644
index 0000000000..14658127f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V2.xml
@@ -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.
+-->
+<component name="WarehouseComponent2" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Customer.mf
new file mode 100644
index 0000000000..678014d48d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Customer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: wiring.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer
+Export-Package: supplychain.customer
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Retailer.mf
new file mode 100644
index 0000000000..f0090fb52b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: wiring.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Shipper.mf
new file mode 100644
index 0000000000..0b50923a05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: wiring.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer
+Export-Package: supplychain.shipper
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Warehouse.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Warehouse.mf
new file mode 100644
index 0000000000..1000a5f974
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/Warehouse.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: wiring.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.mf
new file mode 100644
index 0000000000..4e392a9ff1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.wiring.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer
+Export-Package: supplychain.customer
+Service-Component: osgi/wiring/ds/Customer.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.xml
new file mode 100644
index 0000000000..b10d0416dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="CustomerComponent" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer.mf
new file mode 100644
index 0000000000..788ec4f19a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.wiring.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Service-Component: osgi/wiring/ds/Retailer1.xml, osgi/wiring/ds/Retailer2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer1.xml
new file mode 100644
index 0000000000..1ba16d0693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer1.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="RetailerComponent1" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent1/Warehouse)"
+ />
+ <property name="retailerName">amazon.com</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer2.xml
new file mode 100644
index 0000000000..a55ebd02a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer2.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="RetailerComponent2" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent1/Warehouse)"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper.mf
new file mode 100644
index 0000000000..e7459360e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.wiring.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer
+Export-Package: supplychain.shipper
+Service-Component: osgi/wiring/ds/Shipper1.xml, osgi/wiring/ds/Shipper2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper1.xml
new file mode 100644
index 0000000000..d518ecab62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper1.xml
@@ -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.
+-->
+<component name="ShipperComponent1" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ target="(component.service.name=CustomerComponent/Customer)"
+ policy="dynamic"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper2.xml
new file mode 100644
index 0000000000..d7d0b41f5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper2.xml
@@ -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.
+-->
+<component name="ShipperComponent2" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse.mf
new file mode 100644
index 0000000000..880304187b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.wiring.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Service-Component: osgi/wiring/ds/Warehouse1.xml, osgi/wiring/ds/Warehouse2.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse1.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse1.xml
new file mode 100644
index 0000000000..d72db04425
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse1.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="WarehouseComponent1" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ target="(shipperName=ParcelForce)"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse2.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse2.xml
new file mode 100644
index 0000000000..f9c1218f82
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse2.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<component name="WarehouseComponent2" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ target="(shipperName=RoyalMail)"
+ />
+</component>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/ws/HelloWorld.mf b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/ws/HelloWorld.mf
new file mode 100644
index 0000000000..d8e4c1cb7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/osgi/ws/HelloWorld.mf
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: HelloWorld
+Bundle-SymbolicName: helloworld.HelloWorld
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component ,
+ helloworld.ws
+Export-Package: helloworld
+Bundle-Activator: helloworld.OSGiHelloWorldImpl
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/passbyref/Greetings.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/passbyref/Greetings.componentType
new file mode 100644
index 0000000000..a6de268bf6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/passbyref/Greetings.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Greetings">
+ <interface.java interface="helloworld.Greetings"/>
+ </service>
+
+
+ <reference name="greetingsService" >
+ <interface.java interface="helloworld.Greetings" />
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/passbyref/passbyref-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/passbyref/passbyref-test.composite
new file mode 100644
index 0000000000..660e277693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/passbyref/passbyref-test.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="HelloWorld">
+
+ <component name="JavaGreetingsComponent">
+ <implementation.java class="helloworld.JavaGreetingsComponent"/>
+
+ <reference name="greetingsService" target="OSGiGreetingsComponent" />
+ </component>
+
+ <component name="OSGiGreetingsComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="passbyref.helloworld.Greetings"
+ classes="helloworld.OSGiGreetingsImpl"
+ />
+ <reference name="greetingsService" target="JavaGreetingsComponent" />
+ </component>
+
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/StockQuote.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/StockQuote.componentType
new file mode 100644
index 0000000000..5e0965d047
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/StockQuote.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/StockQuoteFactory.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/StockQuoteFactory.componentType
new file mode 100644
index 0000000000..5e0965d047
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/StockQuoteFactory.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/StockQuote.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/StockQuote.componentType
new file mode 100644
index 0000000000..5e0965d047
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/StockQuote.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/StockQuoteFactory.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/StockQuoteFactory.componentType
new file mode 100644
index 0000000000..5e0965d047
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/StockQuoteFactory.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/properties-ds-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/properties-ds-test.composite
new file mode 100644
index 0000000000..02ae93aec2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/properties-ds-test.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:xsd="http://www.w3.org/2001/XMLSchema"
+ name="StockQuoteComposite">
+
+ <component name="StockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.stockquote.StockQuote"
+ classes="stockquote.OSGiStockQuoteComponentImpl">
+
+ <properties service="StockQuoteService">
+ <property name="service.pid">stockQuote</property>
+ </properties>
+ </implementation.osgi>
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/properties2-ds-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/properties2-ds-test.composite
new file mode 100644
index 0000000000..c94504f07d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/ds/properties2-ds-test.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"
+ name="StockQuoteComposite">
+
+ <component name="USDStockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.stockquote.StockQuoteFactory"
+ classes="stockquote.OSGiStockQuoteComponentImpl">
+
+ <properties service="StockQuoteService">
+ <property name="service.pid">stockQuote</property>
+ </properties>
+ </implementation.osgi>
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+ <component name="EUROStockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.stockquote.StockQuoteFactory"
+ classes="stockquote.OSGiStockQuoteComponentImpl">
+
+ <properties service="StockQuoteService">
+ <property name="service.pid">stockQuote</property>
+ </properties>
+ </implementation.osgi>
+
+ <property name="currency" type="xsd:string" >EURO</property>
+ <property name="exchangeRate" type="xsd:double" >1.48</property>
+
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/properties-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/properties-test.composite
new file mode 100644
index 0000000000..fea03404fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/properties-test.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:xsd="http://www.w3.org/2001/XMLSchema"
+ name="StockQuoteComposite">
+
+ <component name="StockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="stockquote.StockQuote"
+ classes="stockquote.OSGiStockQuoteImpl">
+
+ <properties service="StockQuoteService">
+ <property name="service.pid">stockQuote</property>
+ </properties>
+ </implementation.osgi>
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/properties2-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/properties2-test.composite
new file mode 100644
index 0000000000..3c425fcbc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/properties/properties2-test.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:xsd="http://www.w3.org/2001/XMLSchema"
+ name="StockQuoteComposite">
+
+ <component name="USDStockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="stockquote.StockQuoteFactory"
+ classes="stockquote.OSGiStockQuoteImpl">
+
+ </implementation.osgi>
+
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+ <component name="EUROStockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="stockquote.StockQuoteFactory"
+ classes="stockquote.OSGiStockQuoteImpl">
+
+ </implementation.osgi>
+
+
+ <property name="currency" type="xsd:string" >EURO</property>
+ <property name="exchangeRate" type="xsd:double" >1.48</property>
+
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/HelloWorldClient.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/HelloWorldClient.componentType
new file mode 100644
index 0000000000..f6c04de980
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/HelloWorldClient.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="HelloWorldClient">
+ <interface.java interface="helloworld.sdo.client.HelloWorldClient"/>
+ </service>
+
+ <reference name="helloWorldService" >
+ <interface.java interface="helloworld.sdo.HelloWorldService" />
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/HelloWorldService.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/HelloWorldService.componentType
new file mode 100644
index 0000000000..87918132e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/HelloWorldService.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.sdo.HelloWorldService"/>
+ </service>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..9b00787162
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/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://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <deployable composite="helloworld:helloworldsdo"/>
+
+ <import.java package="helloworld.sdo"/>
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/helloworld.wsdl
new file mode 100644
index 0000000000..2ecc0bea43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/helloworld.wsdl
@@ -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.
+-->
+<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="tns:Name" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="Name">
+ <sequence>
+ <element name="first" type="xsd:string" />
+ <element name="last" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ </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:8085/HelloWorldService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/helloworldsdo.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/helloworldsdo.composite
new file mode 100644
index 0000000000..af79dc4bdf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/sdo/ds/helloworldsdo.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" targetNamespace="http://helloworld"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" xmlns:hw="http://helloworld"
+ name="helloworldsdo">
+
+ <component name="JavaHelloWorldServiceComponent">
+ <implementation.java class="helloworld.sdo.HelloWorldServiceComponent" />
+ </component>
+
+ <component name="JavaHelloWorldClientComponent">
+ <implementation.java class="helloworld.sdo.client.HelloWorldClientComponent" />
+ <reference name="helloWorldService" target="OSGiHelloWorldServiceComponent" />
+ </component>
+
+ <component name="OSGiHelloWorldServiceComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.helloworld.sdo.HelloWorldService"
+ />
+ </component>
+
+ <component name="OSGiHelloWorldClientComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.helloworld.sdo.HelloWorldClient"
+ />
+
+ <reference name="helloWorldService" target="JavaHelloWorldServiceComponent" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Customer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Customer.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Retailer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Retailer.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Shipper.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Shipper.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Warehouse.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/Warehouse.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Customer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Customer.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Retailer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Retailer.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Shipper.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Shipper.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Warehouse.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/Warehouse.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/services-ds-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/services-ds-test.composite
new file mode 100644
index 0000000000..c144a1bc18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/ds/services-ds-test.composite
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.services.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent/RetailerService3" />
+ </component>
+
+ <component name="RetailerComponent">
+ <!-- implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" -->
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.services.supplychain.retailer.Retailer" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ </component>
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent/ShipperService2" />
+ </component>
+
+
+ <component name="ShipperComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.services.supplychain.shipper.Shipper" >
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="customer" target="CustomerComponent" />
+
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/services-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/services-test.composite
new file mode 100644
index 0000000000..64f3b30f88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/services/services-test.composite
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="services.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent/RetailerService3" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="services.supplychain.retailer.Retailer" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ </component>
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent/ShipperService2" />
+ </component>
+
+
+ <component name="ShipperComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="services.supplychain.shipper.Shipper" >
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="customer" target="CustomerComponent" />
+
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/stockquote/StockQuote.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/stockquote/StockQuote.componentType
new file mode 100644
index 0000000000..0b0aa0912b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/stockquote/StockQuote.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Customer1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Customer1.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Customer1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Customer2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Customer2.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Customer2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Retailer1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Retailer1.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Retailer1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Retailer2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Retailer2.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Retailer2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Shipper1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Shipper1.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Shipper1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Shipper2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Shipper2.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Shipper2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Warehouse1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Warehouse1.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Warehouse1.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Warehouse2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Warehouse2.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/Warehouse2.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Customer1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Customer1.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Customer1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Customer2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Customer2.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Customer2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Retailer1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Retailer1.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Retailer1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Retailer2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Retailer2.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Retailer2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Shipper1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Shipper1.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Shipper1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Shipper2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Shipper2.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Shipper2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Warehouse1.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Warehouse1.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Warehouse1.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Warehouse2.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Warehouse2.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/Warehouse2.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/version-ds-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/version-ds-test.composite
new file mode 100644
index 0000000000..877d0de1c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/ds/version-ds-test.composite
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.customer.Customer"
+ bundleVersion="1.0.0" >
+
+ <properties service="CustomerService">
+ <property name="component.name">CustomerComponent1</property>
+ </properties>
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent1/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent1/RetailerService3" />
+ </component>
+
+
+
+ <component name="CustomerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.customer.Customer"
+ bundleVersion="2.0.0" >
+
+ <properties service="CustomerService">
+ <property name="component.name">CustomerComponent2</property>
+ </properties>
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent2/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent2/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent2/RetailerService3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.retailer.Retailer"
+ bundleVersion="1.0.0" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.service.name">WarehouseComponent1/Warehouse</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.retailer.Retailer"
+ bundleVersion="2.0.0" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.service.name">WarehouseComponent2/Warehouse</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent2"/>
+ </component>
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1/ShipperService2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2/ShipperService2" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.shipper.Shipper"
+ bundleVersion="1.0.0">
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ <property name="component.name">ShipperComponent1.ShipperService1</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ <property name="component.name">ShipperComponent1.ShipperService2</property>
+ </properties>
+ <properties reference="customer">
+ <property name="component.name">CustomerComponent1</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent1" />
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.shipper.Shipper"
+ bundleVersion="2.0.0">
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ <property name="component.name">ShipperComponent2.ShipperService1</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ <property name="component.name">ShipperComponent2.ShipperService2</property>
+ </properties>
+ <properties reference="customer">
+ <property name="component.name">CustomerComponent2</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent2" />
+
+ </component>
+
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/version-test.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/version-test.composite
new file mode 100644
index 0000000000..bbb397ee70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/version/version-test.composite
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.customer.Customer"
+ bundleVersion="1.0.0" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent1/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent1/RetailerService3" />
+ </component>
+
+
+
+ <component name="CustomerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.customer.Customer"
+ bundleVersion="2.0.0" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent2/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent2/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent2/RetailerService3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.retailer.Retailer"
+ bundleVersion="1.0.0" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.retailer.Retailer"
+ bundleVersion="2.0.0" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.service.name">WarehouseComponent2/Warehouse</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent2"/>
+ </component>
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1/ShipperService2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2/ShipperService2" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.shipper.Shipper"
+ bundleVersion="1.0.0" >
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ <properties reference="customer">
+ <property name="component.name">CustomerComponent1</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent1" />
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.shipper.Shipper"
+ bundleVersion="2.0.0">
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ <properties reference="customer">
+ <property name="component.name">CustomerComponent2</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent2" />
+
+ </component>
+
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Customer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Customer.componentType
new file mode 100644
index 0000000000..1fd551be3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Retailer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Retailer.componentType
new file mode 100644
index 0000000000..5599c44bc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Shipper.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Warehouse.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/Warehouse.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Customer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Customer.componentType
new file mode 100644
index 0000000000..1fd551be3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Retailer.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Retailer.componentType
new file mode 100644
index 0000000000..5599c44bc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Shipper.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Warehouse.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/Warehouse.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test1.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test1.composite
new file mode 100644
index 0000000000..617200d8dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test1.composite
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/Retailer" />
+
+ <reference name="retailer2" target="RetailerComponent2/Retailer" />
+
+ <reference name="retailer3" target="RetailerComponent3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent2</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent2"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.shipper.Shipper" >
+
+ <properties service="Shipper">
+ <property name="component.name">ShipperComponent1</property>
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.shipper.Shipper" >
+
+ <properties service="Shipper">
+ <property name="component.name">ShipperComponent2</property>
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test2.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test2.composite
new file mode 100644
index 0000000000..213cde2c1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test2.composite
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/Retailer" />
+
+ <reference name="retailer2" target="RetailerComponent2/Retailer" />
+
+ <reference name="retailer3" target="RetailerComponent3/Retailer" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+ <component name="WarehouseComponent1">
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.warehouse.Warehouse" >
+
+ <properties reference="shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+
+ <component name="WarehouseComponent2">
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.warehouse.Warehouse" >
+
+ <properties reference="shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/wiring-test1.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/wiring-test1.composite
new file mode 100644
index 0000000000..0dca0da75e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/wiring-test1.composite
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.customer.Customer"
+ classes="supplychain.customer.OSGiCustomerImpl" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/Retailer" />
+
+ <reference name="retailer2" target="RetailerComponent2/Retailer" />
+
+ <reference name="retailer3" target="RetailerComponent3/Retailer" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent2"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/wiring-test2.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/wiring-test2.composite
new file mode 100644
index 0000000000..953045fefa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/wiring/wiring-test2.composite
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/Retailer" />
+
+ <reference name="retailer2" target="RetailerComponent2/Retailer" />
+
+ <reference name="retailer3" target="RetailerComponent3/Retailer" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+ <component name="WarehouseComponent1">
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.warehouse.Warehouse" >
+
+ <properties reference="shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+
+ <component name="WarehouseComponent2">
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.warehouse.Warehouse" >
+
+ <properties reference="shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/HelloWorld.componentType b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/HelloWorld.componentType
new file mode 100644
index 0000000000..c621d9aca0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/HelloWorld.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="OSGiHelloWorld">
+ <interface.java interface="helloworld.HelloWorld"/>
+ </service>
+
+
+ <reference name="helloWorldWS" >
+ <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" / -->
+ <interface.java interface="helloworld.ws.HelloWorld" />
+ </reference>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/helloworld.wsdl
new file mode 100644
index 0000000000..6d3f853382
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/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:8085/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/ws-helloworld.composite b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/ws-helloworld.composite
new file mode 100644
index 0000000000..d545c844d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/main/resources/ws/ws-helloworld.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="HelloWorld">
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <!-- interface.java interface="helloworld.ws.HelloWorld" / -->
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="helloworld.ws.HelloWorldService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <!--implementation.java class="helloworld.HelloWorldComponent"/-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="helloworld.HelloWorld"
+ />
+
+ <service name="OSGiHelloWorld"/>
+
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <!-- interface.java interface="helloworld.ws.HelloWorld" / -->
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback1TestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback1TestCase.java
new file mode 100644
index 0000000000..54b9b00bc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback1TestCase.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 callback;
+
+
+public class Callback1TestCase extends CallbackTestCase {
+
+ public Callback1TestCase() {
+ super("callback-test1.composite");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback2TestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback2TestCase.java
new file mode 100644
index 0000000000..b26bfbd98d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback2TestCase.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 callback;
+
+
+public class Callback2TestCase extends CallbackTestCase {
+
+ public Callback2TestCase() {
+ super("callback-test2.composite");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback3TestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback3TestCase.java
new file mode 100644
index 0000000000..667df7aa12
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/Callback3TestCase.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 callback;
+
+
+public class Callback3TestCase extends CallbackTestCase {
+
+ public Callback3TestCase() {
+ super("callback-test3.composite");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/CallbackTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/CallbackTestCase.java
new file mode 100644
index 0000000000..a95437f8c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/callback/CallbackTestCase.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 callback;
+
+
+import callback.client.CallbackClient;
+
+import test.OSGiTestCase;
+
+public abstract class CallbackTestCase extends OSGiTestCase {
+
+ private CallbackClient aCallbackClient;
+
+ protected String compositeName;
+
+
+ public CallbackTestCase(String compositeName) {
+ super(compositeName, "callback");
+ }
+
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ aCallbackClient = scaDomain.getService(CallbackClient.class, "CallbackClient");
+ }
+
+
+ public void test() throws Exception {
+ aCallbackClient.run();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/conversation/ConversationTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/conversation/ConversationTestCase.java
new file mode 100644
index 0000000000..c5d94df93d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/conversation/ConversationTestCase.java
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package conversation;
+
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import conversation.client.ConversationalClient;
+
+import test.OSGiTestCase;
+
+public class ConversationTestCase extends OSGiTestCase {
+
+ private ConversationalClient conversationalStatelessClientStatelessService;
+ private ConversationalClient conversationalStatelessClientStatefulService;
+ private ConversationalClient conversationalStatefulClientStatelessService;
+ private ConversationalClient conversationalStatefulClientStatefulService;
+
+ public ConversationTestCase() {
+ super("conversation-test.composite", "conversation");
+ }
+
+ @Before
+ public void setUp() throws Exception {
+
+ try {
+
+ super.setUp();
+
+ conversationalStatelessClientStatelessService = scaDomain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService/ConversationalClient");
+
+ conversationalStatelessClientStatefulService = scaDomain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService/ConversationalClient");
+
+ conversationalStatefulClientStatelessService = scaDomain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService/ConversationalClient");
+
+ conversationalStatefulClientStatefulService = scaDomain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService/ConversationalClient");
+
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+
+ throw e;
+ }
+
+ }
+
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,init,",
+ conversationalStatelessClientStatefulService.getServiceCalls());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,init,",
+ conversationalStatelessClientStatefulService.getCalls());
+ }
+
+ /////@Test
+ public void _testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateless client stateless service tests
+ // ========================================
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,init,",
+ conversationalStatelessClientStatelessService.getServiceCalls());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,init,",
+ conversationalStatelessClientStatelessService.getCalls());
+ }
+ /////@Test
+ public void _testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,init,",
+ conversationalStatefulClientStatefulService.getServiceCalls());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ //System.out.println("Calls: " + conversationalStatefulClientStatefulService.getCalls());
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,init,",
+ conversationalStatefulClientStatefulService.getCalls());
+ }
+
+ /////@Test
+ public void _testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,init,",
+ conversationalStatefulClientStatelessService.getServiceCalls());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,init,",
+ conversationalStatefulClientStatelessService.getCalls());
+ }
+
+ /////@Test
+ public void _testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/passbyref/PassByRefTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/passbyref/PassByRefTestCase.java
new file mode 100644
index 0000000000..d340923938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/passbyref/PassByRefTestCase.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld.passbyref;
+
+import helloworld.Greetings;
+import test.OSGiTestCase;
+
+
+public class PassByRefTestCase extends OSGiTestCase {
+
+ private Greetings greetingsJava;
+ private Greetings greetingsOSGi;
+ private String[] origNames = {"world"};
+ private String[] names;
+
+ public PassByRefTestCase() {
+ super("passbyref-test.composite", "passbyref");
+ }
+
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ greetingsJava = scaDomain.getService(Greetings.class, "JavaGreetingsComponent");
+ greetingsOSGi = scaDomain.getService(Greetings.class, "OSGiGreetingsComponent");
+
+ names = new String[origNames.length];
+ System.arraycopy(origNames, 0, names, 0, names.length);
+ }
+
+
+ public void test() throws Exception {
+
+ javaOSGiPassByValue();
+ osgiJavaPassByValue();
+ javaOSGiPassByRef();
+ osgiJavaPassByRef();
+
+ }
+
+
+ public void javaOSGiPassByValue() throws Exception {
+
+ String[] greetings = greetingsJava.getGreetingsFromJava(names);
+ for (int i = 0; i < origNames.length; i++) {
+ assertEquals(origNames[i], names[i]);
+ }
+ for (int i = 0; i < origNames.length; i++) {
+
+ System.out.println(greetings[i]);
+
+ assertEquals(greetings[i],
+ "Hello " + origNames[i] + "(From Java)(From OSGi)");
+ }
+
+ }
+
+ public void osgiJavaPassByValue() throws Exception {
+ String[] names = {
+ "world"
+ };
+ String[] greetings = greetingsOSGi.getGreetingsFromOSGi(names);
+
+ for (int i = 0; i < origNames.length; i++) {
+ assertEquals(origNames[i], names[i]);
+ }
+ for (int i = 0; i < origNames.length; i++) {
+
+ System.out.println(greetings[i]);
+
+ assertEquals(greetings[i],
+ "Hello " + origNames[i] + "(From OSGi)(From Java)");
+ }
+
+
+
+ }
+
+ public void javaOSGiPassByRef() throws Exception {
+ String[] names = {
+ "world"
+ };
+ String[] greetings = greetingsJava.getModifiedGreetingsFromJava(names);
+ for (int i = 0; i < origNames.length; i++) {
+ assertEquals("Hello " + origNames[i] + "(From Java)(From OSGi)", names[i]);
+ }
+ for (int i = 0; i < origNames.length; i++) {
+
+ System.out.println(greetings[i]);
+
+ assertEquals(greetings[i],
+ "Hello " + origNames[i] + "(From Java)(From OSGi)");
+ }
+ }
+
+ public void osgiJavaPassByRef() throws Exception {
+ String[] names = {
+ "world"
+ };
+ String[] greetings = greetingsOSGi.getModifiedGreetingsFromOSGi(names);
+ for (int i = 0; i < origNames.length; i++) {
+ assertEquals("Hello " + origNames[i] + "(From OSGi)(From Java)", names[i]);
+ }
+ for (int i = 0; i < origNames.length; i++) {
+
+ System.out.println(greetings[i]);
+
+ assertEquals(greetings[i],
+ "Hello " + origNames[i] + "(From OSGi)(From Java)");
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/sdo/SdoTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/sdo/SdoTestCase.java
new file mode 100644
index 0000000000..c1f11d0b6e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/sdo/SdoTestCase.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 helloworld.sdo;
+
+import helloworld.sdo.client.HelloWorldClient;
+
+import java.io.File;
+import java.net.URL;
+
+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 org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+import util.OSGiTestUtil;
+
+
+public class SdoTestCase extends TestCase {
+
+
+ private EmbeddedSCADomain scaDomain;
+
+
+ protected void setUp() throws Exception {
+
+ OSGiTestUtil.setUpOSGiTestRuntime();
+
+ scaDomain = new EmbeddedSCADomain(this.getClass().getClassLoader(), "http://localhost");
+ scaDomain.start();
+ ContributionService contributionService = scaDomain.getContributionService();
+
+ URL serviceURL = new File("./target/classes/sdo/ds/HelloWorldService.jar").toURI().toURL();
+ URL clientURL = new File("./target/classes/sdo/ds/HelloWorldClient.jar").toURI().toURL();
+
+ Contribution serviceContribution = contributionService.contribute("HelloWorldService", serviceURL, true);
+ Contribution clientContribution = contributionService.contribute("HelloWorldClient", clientURL, true);
+
+ for (Composite deployable : serviceContribution.getDeployables()) {
+ scaDomain.getDomainComposite().getIncludes().add(deployable);
+ scaDomain.buildComposite(deployable);
+ }
+ for (Composite deployable : clientContribution.getDeployables()) {
+ scaDomain.getDomainComposite().getIncludes().add(deployable);
+ scaDomain.buildComposite(deployable);
+ }
+ for (Composite deployable : clientContribution.getDeployables() ) {
+ scaDomain.getCompositeActivator().activate(deployable);
+ scaDomain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+
+ public void testJavaToOSGi() throws Exception {
+
+ HelloWorldClient helloWorldClient = scaDomain.getService(HelloWorldClient.class, "JavaHelloWorldClientComponent");
+ String greetings = helloWorldClient.getGreetings("Apache", "Tuscany");
+ System.out.println(greetings);
+ assertEquals("Hello Apache Tuscany", greetings);
+ }
+
+ public void testOSGiToJava() throws Exception {
+
+ HelloWorldClient helloWorldClient = scaDomain.getService(HelloWorldClient.class, "OSGiHelloWorldClientComponent");
+ String greetings = helloWorldClient.getGreetings("Apache", "Tuscany");
+ System.out.println(greetings);
+ assertEquals("Hello Apache Tuscany", greetings);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/ws/HelloWorldTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/ws/HelloWorldTestCase.java
new file mode 100644
index 0000000000..49afb3d8e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/helloworld/ws/HelloWorldTestCase.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.ws;
+
+import helloworld.HelloWorld;
+
+
+import test.OSGiTestCase;
+import util.OSGiTestUtil;
+
+
+public class HelloWorldTestCase extends OSGiTestCase {
+
+ private HelloWorld helloWorld;
+
+ public HelloWorldTestCase() {
+ super("ws-helloworld.composite", "ws");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ helloWorld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+
+ public void testHelloWorld() throws Exception {
+ String greetings = helloWorld.getGreetings("petra");
+ System.out.println(greetings);
+ assertEquals("Hello petra", greetings);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/SupplyChainTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/SupplyChainTestCase.java
new file mode 100644
index 0000000000..a858c18a90
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/SupplyChainTestCase.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 supplychain;
+
+import supplychain.customer.Customer;
+import test.OSGiTestCase;
+
+/**
+ * Test case for supplychain - it is invoked with different composite files to test
+ * various scenarios.
+ */
+public abstract class SupplyChainTestCase extends OSGiTestCase {
+
+ public Customer customer;
+
+
+ public SupplyChainTestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ customer = scaDomain.getService(Customer.class, "CustomerComponent");
+ }
+
+ public void test() throws Exception {
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer.purchaseBooks();
+ customer.purchaseGames();
+ long timeout = 5000L;
+ while (timeout > 0) {
+ if (customer.hasOutstandingOrders()) {
+ Thread.sleep(100);
+ timeout -= 100;
+ } else
+ break;
+ }
+ assertFalse(customer.hasOutstandingOrders());
+
+ System.out.println("Test complete");
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/VersionedSupplyChainTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/VersionedSupplyChainTestCase.java
new file mode 100644
index 0000000000..a9941aebcd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/VersionedSupplyChainTestCase.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 supplychain;
+
+import supplychain.customer.Customer;
+import test.OSGiTestCase;
+
+/**
+ * OSGi test program - common code for versioned bundles
+ */
+public abstract class VersionedSupplyChainTestCase extends OSGiTestCase {
+
+ private Customer customer1;
+ private Customer customer2;
+
+
+ public VersionedSupplyChainTestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ customer1 = scaDomain.getService(Customer.class, "CustomerComponent1");
+ customer2 = scaDomain.getService(Customer.class, "CustomerComponent2");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ Thread.sleep(2000);
+ }
+
+ public void test() throws Exception {
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer1.purchaseBooks();
+ customer2.purchaseGames();
+ long timeout = 5000L;
+ while (timeout > 0) {
+ if (customer1.hasOutstandingOrders()) {
+ Thread.sleep(100);
+ timeout -= 100;
+ } else if (customer2.hasOutstandingOrders()) {
+ Thread.sleep(100);
+ timeout -= 100;
+ } else
+ break;
+ }
+ assertFalse(customer1.hasOutstandingOrders());
+ assertFalse(customer2.hasOutstandingOrders());
+
+ System.out.println("Test complete");
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java
new file mode 100644
index 0000000000..8e939b1a83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.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 supplychain.factory;
+
+
+/**
+ * OSGi test program - declarative with scopes other than composites which use OSGi service factories
+ */
+public class DSFactoryTestCase extends FactoryTestCase {
+
+ public DSFactoryTestCase() {
+ super("factory-ds-test.composite", "factory/ds");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java
new file mode 100644
index 0000000000..39d90bb75c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.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 supplychain.factory;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with scopes other than composites which use OSGi service factories
+ */
+public class FactoryTestCase extends SupplyChainTestCase {
+ /**
+ * This constant defines the time period (in milliseconds) for which we are prepared to wait for
+ * the @OneWay notifyShipment() callback to run.
+ */
+ private static final long MAX_WAIT_TIME_FOR_CALLBACK = 10000;
+
+ public FactoryTestCase() {
+ super("factory-test.composite", "factory");
+ }
+
+ protected FactoryTestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+
+ @Override
+ public void test() throws Exception {
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer.purchaseBooks();
+ waitForOrderShipmentNotification(); // TUSCANY-2198 notifyShipment() callback is @OneWay
+ assertFalse(customer.hasOutstandingOrders());
+
+ customer.purchaseGames();
+ waitForOrderShipmentNotification(); // TUSCANY-2198 notifyShipment() callback is @OneWay
+ assertFalse(customer.hasOutstandingOrders());
+
+ Thread.sleep(2000);
+ System.out.println("Test complete");
+
+ }
+
+ /**
+ * Since the notifyShipment() callback on the Customer is @OneWay, we need to allow
+ * some time for it to complete as it is runs asynchronously.
+ *
+ * This is for TUSCANY-2198
+ */
+ private void waitForOrderShipmentNotification() throws InterruptedException {
+ long startTime = System.currentTimeMillis();
+ while (customer.hasOutstandingOrders()
+ && System.currentTimeMillis() - startTime < MAX_WAIT_TIME_FOR_CALLBACK) {
+ Thread.sleep(100);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java
new file mode 100644
index 0000000000..5376687b61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.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 supplychain.interfaces;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with components exposing multiple services with multiple interfaces
+ */
+public class DSInterfacesTestCase extends SupplyChainTestCase {
+
+ public DSInterfacesTestCase() {
+ super("interfaces-ds-test.composite", "interfaces/ds");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java
new file mode 100644
index 0000000000..6d8dc1021e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.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 supplychain.interfaces;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with components exposing multiple services with multiple interfaces
+ */
+public class InterfacesTestCase extends SupplyChainTestCase {
+
+ public InterfacesTestCase() {
+ super("interfaces-test.composite", "interfaces");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java
new file mode 100644
index 0000000000..e037ae9675
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.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 supplychain.properties;
+
+
+/**
+ * OSGi test program - declarative with business properties
+ */
+public class DSProperties2TestCase extends Properties2TestCase {
+
+ public DSProperties2TestCase() {
+ super("properties2-ds-test.composite", "properties/ds");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java
new file mode 100644
index 0000000000..eecf67913d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.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 supplychain.properties;
+
+
+/**
+ * OSGi test program - declarative with business properties
+ */
+public class DSPropertiesTestCase extends PropertiesTestCase {
+
+ public DSPropertiesTestCase() {
+ super("properties-ds-test.composite", "properties/ds");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java
new file mode 100644
index 0000000000..203bf5123c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.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 supplychain.properties;
+
+
+import stockquote.StockQuote;
+import test.OSGiTestCase;
+
+/**
+ * OSGi test program - procedural with business properties
+ */
+public class Properties2TestCase extends OSGiTestCase {
+
+
+ private StockQuote stockQuoteServiceUSD;
+ private StockQuote stockQuoteServiceEURO;
+
+ public Properties2TestCase() {
+ super("properties2-test.composite", "properties");
+ }
+
+ protected Properties2TestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ stockQuoteServiceUSD = scaDomain.getService(StockQuote.class, "USDStockQuoteComponent");
+ stockQuoteServiceEURO = scaDomain.getService(StockQuote.class, "EUROStockQuoteComponent");
+ }
+
+ public void test() throws Exception {
+
+ double stockQuote = stockQuoteServiceUSD.getQuote("IBM");
+
+ double expectedValue = 52.81 * 2.0;
+
+ System.out.println("IBM: $" + stockQuote);
+
+ assertTrue(stockQuote > expectedValue - 0.1 && stockQuote < expectedValue + 0.1);
+
+ double stockQuote2 = stockQuoteServiceEURO.getQuote("IBM");
+
+ double expectedValue2 = 52.81 * 1.48;
+
+ System.out.println("IBM: Euro " + stockQuote2);
+
+ assertTrue(stockQuote2 > expectedValue2 - 0.1 && stockQuote2 < expectedValue2 + 0.1);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java
new file mode 100644
index 0000000000..429b1f10ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.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 supplychain.properties;
+
+import stockquote.StockQuote;
+import test.OSGiTestCase;
+
+/**
+ * OSGi test program - procedural with business properties
+ */
+public class PropertiesTestCase extends OSGiTestCase {
+
+
+ private StockQuote stockQuoteService;
+
+ public PropertiesTestCase() {
+ super("properties-test.composite", "properties");
+ }
+
+ protected PropertiesTestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ stockQuoteService = scaDomain.getService(StockQuote.class, "StockQuoteComponent");
+ }
+
+
+ public void test() throws Exception {
+
+ double stockQuote = stockQuoteService.getQuote("IBM");
+
+ double expectedValue = 52.81 * 2.0;
+
+ System.out.println("IBM: " + stockQuote);
+
+ assertTrue(stockQuote > expectedValue - 0.1 && stockQuote < expectedValue + 0.1);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java
new file mode 100644
index 0000000000..dbc980f8c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.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 supplychain.services;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with components exposing multiple services
+ */
+public class DSServicesTestCase extends SupplyChainTestCase {
+
+ public DSServicesTestCase() {
+ super("services-ds-test.composite", "services/ds");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java
new file mode 100644
index 0000000000..e39295a402
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.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 supplychain.services;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with components exposing multiple services
+ */
+public class ServicesTestCase extends SupplyChainTestCase {
+
+ public ServicesTestCase() {
+ super("services-test.composite", "services");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java
new file mode 100644
index 0000000000..c2f6bff4f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.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.version;
+
+import supplychain.VersionedSupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with versioning
+ */
+public class DSVersionTestCase extends VersionedSupplyChainTestCase {
+
+ public DSVersionTestCase() {
+ super("version-ds-test.composite", "version/ds");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java
new file mode 100644
index 0000000000..17ba7a2f14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.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.version;
+
+import supplychain.VersionedSupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with versioning
+ */
+public class VersionTestCase extends VersionedSupplyChainTestCase {
+
+ public VersionTestCase() {
+ super("version-test.composite", "version");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java
new file mode 100644
index 0000000000..8c33720018
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.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.wiring;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with SCA wiring
+ */
+public class DSWiring1TestCase extends SupplyChainTestCase {
+
+ public DSWiring1TestCase() {
+ super("wiring-ds-test1.composite", "wiring/ds");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java
new file mode 100644
index 0000000000..0c6edd6691
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.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.wiring;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with SCA wiring
+ */
+public class DSWiring2TestCase extends SupplyChainTestCase {
+
+ public DSWiring2TestCase() {
+ super("wiring-ds-test2.composite", "wiring/ds");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java
new file mode 100644
index 0000000000..0b48ac90ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.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 supplychain.wiring;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with SCA wiring
+ */
+public class Wiring1TestCase extends SupplyChainTestCase {
+
+ public Wiring1TestCase() {
+ super("wiring-test1.composite", "wiring");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java
new file mode 100644
index 0000000000..c84741f34f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.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 supplychain.wiring;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with SCA wiring
+ */
+public class Wiring2TestCase extends SupplyChainTestCase {
+
+ public Wiring2TestCase() {
+ super("wiring-test2.composite", "wiring");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/test/OSGiTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/test/OSGiTestCase.java
new file mode 100644
index 0000000000..5a9b2a8b1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/test/OSGiTestCase.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 test;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import util.OSGiTestUtil;
+
+/**
+ * Test case setup base code - it is invoked with different composite files to test
+ * various scenarios.
+ */
+public abstract class OSGiTestCase extends TestCase {
+
+ private String compositeName;
+ private String contributionLocation;
+ public SCADomain scaDomain;
+
+ public OSGiTestCase(String compositeName, String contributionLocation) {
+ super();
+ this.compositeName = compositeName;
+ this.contributionLocation = contributionLocation;
+ try {
+ if (contributionLocation != null) {
+ File f = new File("target/classes/" + contributionLocation);
+ this.contributionLocation = f.toURL().toString();
+ }
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected void setUp() throws Exception {
+
+ OSGiTestUtil.setUpOSGiTestRuntime();
+
+ scaDomain = SCADomain.newInstance("http://localhost", contributionLocation, compositeName);
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java
new file mode 100644
index 0000000000..7b95c12038
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.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 util;
+
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+
+
+/**
+ * OSGi Test Utils
+ */
+public class OSGiTestUtil {
+
+ public static void setUpOSGiTestRuntime() throws Exception {
+
+ setUpFelixTestRuntime();
+ }
+
+
+ private static void setUpFelixTestRuntime() throws Exception {
+
+ String felixConfigFileName = "file:target/test-classes/osgi/felix/felix.config.properties";
+
+ System.setProperty("felix.config.properties", felixConfigFileName);
+
+ try {
+
+ ClassLoader cl = OSGiTestUtil.class.getClassLoader();
+
+ Class felixMainClass = cl.loadClass("org.apache.felix.main.Main");
+ if (felixMainClass != null) {
+ String felixDir = felixMainClass.getProtectionDomain().getCodeSource().getLocation().getPath();
+ int index = 0;
+ if ((index = felixDir.indexOf("/org.apache.felix.main")) >= 0) {
+ felixDir = felixDir.substring(0, index);
+ System.setProperty("FELIX_DIR", felixDir);
+ }
+ }
+
+ } catch (Exception e) {
+ // Ignore
+ }
+
+
+ }
+
+ public static void shutdownOSGiRuntime() {
+ try {
+ OSGiRuntime.stop();
+
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/resources/osgi/felix/felix.config.properties b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/resources/osgi/felix/felix.config.properties
new file mode 100644
index 0000000000..8399991503
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-implementation/src/test/resources/osgi/felix/felix.config.properties
@@ -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.
+#
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \
+ org.osgi.service.packageadmin; version=1.2.0, \
+ org.osgi.service.startlevel; version=1.0.0, \
+ org.osgi.service.url; version=1.0.0 \
+ org.osgi.util.tracker; version=1.3.2
+
+
+felix.auto.start.1= \
+ "file://${FELIX_DIR}/org.apache.felix.scr/1.0.2/org.apache.felix.scr-1.0.2.jar" \
+ "file://${FELIX_DIR}/org.apache.felix.configadmin/1.0.1/org.apache.felix.configadmin-1.0.1.jar"
+
+
+# "file://${FELIX_DIR}/org.apache.felix.shell/1.0.1/org.apache.felix.shell-1.0.1.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.shell.tui/1.0.1/org.apache.felix.shell.tui-1.0.1.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.bundlerepository/1.0.3/org.apache.felix.bundlerepository-1.0.3.jar" \
+
+felix.startlevel.framework=1
+felix.startlevel.bundle=1
+
+#
+# Bundle config properties.
+#
+org.osgi.service.http.port=8080
+obr.shell.telnet=on
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/pom.xml
new file mode 100644
index 0000000000..fa1ace68ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-test</artifactId>
+ <name>Apache Tuscany OSGi-Based Tuscany Runtime Tests</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.3.2.R33x_v20080105</version>
+ </dependency>
+
+
+<!-- Uncomment this section and comment out the Equinox dependency above to run tests using Felix.
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.0.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>javax.servlet</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+
+End Felix dependencies -->
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>ops4j-repository</id>
+ <url>http://repository.ops4j.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/EquinoxTestRuntime.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/EquinoxTestRuntime.java
new file mode 100644
index 0000000000..2e3137239e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/EquinoxTestRuntime.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.osgi.runtime.impl;
+
+import java.lang.reflect.Method;
+
+import org.osgi.framework.BundleContext;
+
+public class EquinoxTestRuntime extends OSGiTestRuntime {
+
+
+ private static BundleContext bundleContext;
+
+ private static EquinoxTestRuntime instance;
+
+ private static Class<?> eclipseStarterClass;
+
+ public static OSGiTestRuntime getInstance() throws Exception {
+ if (instance == null) {
+ eclipseStarterClass = EquinoxTestRuntime.class.getClassLoader().loadClass("org.eclipse.core.runtime.adaptor.EclipseStarter");
+ EquinoxTestRuntime runtime = new EquinoxTestRuntime();
+ instance = runtime;
+ }
+ return instance;
+ }
+
+
+ protected BundleContext startRuntime() throws Exception {
+
+ if (bundleContext != null)
+ return bundleContext;
+
+ Method startupMethod = eclipseStarterClass.getMethod("startup", String [].class, Runnable.class);
+
+ System.setProperty("org.osgi.framework.system.packages", getSystemPackages());
+ // Equinox version 3.2 upwards have a startup method which returns BundleContext
+ bundleContext = (BundleContext) startupMethod.invoke(null,
+ new String[] {/*"-clean", */"-console", "-configuration", "target/configuration"},
+ null );
+
+ return bundleContext;
+
+ }
+
+ @Override
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ @Override
+ protected void setBundleContext(BundleContext bundleContext) {
+ super.setBundleContext(bundleContext);
+ EquinoxTestRuntime.bundleContext = bundleContext;
+ }
+
+ @Override
+ public void shutdown() throws Exception {
+
+ if (bundleContext == null)
+ return;
+ bundleContext = null;
+ instance = null;
+ if (eclipseStarterClass != null) {
+ Method shutdownMethod = eclipseStarterClass.getMethod("shutdown");
+ try {
+ shutdownMethod.invoke(eclipseStarterClass);
+ } catch (Exception e) {
+ // Ignore errors.
+ }
+ }
+ super.shutdown();
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/FelixTestRuntime.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/FelixTestRuntime.java
new file mode 100644
index 0000000000..0dafffdb8c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/FelixTestRuntime.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.runtime.impl;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class FelixTestRuntime extends OSGiTestRuntime implements BundleActivator {
+
+ private static BundleContext bundleContext;
+
+ private static FelixTestRuntime instance;
+
+ private static Bundle felix;
+
+
+ public static OSGiTestRuntime getInstance() throws Exception {
+ if (instance == null) {
+
+ FelixTestRuntime runtime = new FelixTestRuntime();
+ instance = runtime;
+ }
+ return instance;
+ }
+
+
+// private void deleteDirectory(File dir) {
+// File[] files = dir.listFiles();
+// for (int i = 0; i < files.length; i++) {
+// if (files[i].isDirectory())
+// deleteDirectory(files[i]);
+// else {
+// files[i].delete();
+// }
+// }
+// dir.delete();
+//
+// }
+
+// private void deleteProfile() {
+// String profileDirName = System.getProperty("felix.cache.profiledir");
+// if (profileDirName == null) profileDirName = ".felix";
+// File profileDir = new File(profileDirName);
+// if (profileDir.isDirectory())
+// deleteDirectory(profileDir);
+// else
+// profileDir.delete();
+// }
+
+ protected BundleContext startRuntime() throws Exception {
+
+ if (bundleContext != null)
+ return bundleContext;
+
+ ClassLoader cl = this.getClass().getClassLoader();
+ Class<?> felixMainClass = cl.loadClass("org.apache.felix.main.Main");
+ Class<?> felixClass = cl.loadClass("org.apache.felix.framework.Felix");
+ Method propsMethod = felixMainClass.getMethod("loadConfigProperties");
+ Properties props = (Properties)propsMethod.invoke(null);
+
+ //deleteProfile();
+ // Create profile directory
+ String profileDirName = System.getProperty("felix.cache.profiledir");
+ if (profileDirName == null) profileDirName = ".felix";
+ File profileDir = new File(profileDirName);
+ profileDir.mkdir();
+
+ props.put("felix.cache.profiledir", profileDir.getAbsolutePath());
+ props.put("felix.embedded.execution", "true");
+ String systemPackages = getSystemPackages() +
+ ", org.apache.felix.main";
+
+
+ props.put("org.osgi.framework.system.packages", systemPackages);
+
+ Constructor felixConstructor = felixClass.getConstructor(Map.class, List.class);
+ List<BundleActivator> activators = new ArrayList<BundleActivator>();
+
+ Class<?> autoActivatorClass = cl.loadClass("org.apache.felix.main.AutoActivator");
+ Constructor autoActivatorConstructor = autoActivatorClass.getConstructor(Map.class);
+ BundleActivator autoActivator = (BundleActivator)autoActivatorConstructor.newInstance(props);
+ activators.add(autoActivator);
+ felix = (Bundle)felixConstructor.newInstance(props, activators);
+ felix.start();
+ bundleContext = felix.getBundleContext();
+
+ return bundleContext;
+
+ }
+
+ public void start(BundleContext context) throws Exception {
+
+ bundleContext = context;
+ synchronized (this) {
+ this.notify();
+ }
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ bundleContext = null;
+ }
+
+
+
+ @Override
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ @Override
+ protected void setBundleContext(BundleContext bundleContext) {
+ super.setBundleContext(bundleContext);
+ FelixTestRuntime.bundleContext = bundleContext;
+ }
+
+
+ @Override
+ public void shutdown() throws Exception {
+
+ if (bundleContext == null)
+ return;
+
+ bundleContext = null;
+ instance = null;
+
+ felix.stop();
+ int retries = 50;
+ synchronized (felix) {
+ while (retries-- > 0 && felix.getState() != Bundle.UNINSTALLED) {
+ felix.wait(100);
+ }
+ }
+
+ super.shutdown();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/OSGiTestRuntime.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/OSGiTestRuntime.java
new file mode 100644
index 0000000000..6356718fe5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/OSGiTestRuntime.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.runtime.impl;
+
+import java.lang.reflect.Method;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public abstract class OSGiTestRuntime {
+
+ public abstract BundleContext getBundleContext();
+
+ protected abstract BundleContext startRuntime() throws Exception;
+
+ private static OSGiTestRuntime instance;
+
+ private BundleContext bundleContext;
+
+
+ /**
+ * System property org.apache.tuscany.implementation.osgi.runtime.OSGiRuntime can be set to the
+ * name of the OSGiRuntime class (eg. EquinoxRuntime). If set, start this runtime and return the
+ * system bundlecontext. If not set, start Felix from the classpath.
+ *
+ * @throws BundleException
+ */
+ public synchronized static OSGiTestRuntime findRuntime() throws Exception {
+ if (instance != null) {
+ return instance;
+ }
+ String runtimeClassName = System.getProperty(OSGiTestRuntime.class.getName());
+
+ if (instance != null)
+ return instance;
+
+ if (runtimeClassName != null) {
+ try {
+ Class<?> runtimeClass = OSGiTestRuntime.class.getClassLoader().loadClass(runtimeClassName);
+ Method method = runtimeClass.getMethod("getInstance");
+ instance = (OSGiTestRuntime) method.invoke(null);
+ return instance;
+
+ } catch (Exception e) {
+ throw new BundleException("Could not start OSGi runtime " + runtimeClassName, e);
+ }
+ }
+
+ try {
+ instance = EquinoxTestRuntime.getInstance();
+ } catch (Throwable e) {
+ instance = FelixTestRuntime.getInstance();
+ }
+
+ return instance;
+
+ }
+
+
+ public synchronized static OSGiTestRuntime getRuntime() throws Exception {
+
+ instance = findRuntime();
+
+ if (instance != null) {
+
+ if (instance.bundleContext == null) {
+ instance.startRuntime();
+ instance.bundleContext = instance.getBundleContext();
+ }
+ return instance;
+ }
+ return instance;
+ }
+
+
+ public void shutdown() throws Exception {
+
+ bundleContext = null;
+ if (this == instance)
+ instance = null;
+ }
+
+ protected void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
+
+ /**
+ * @return the instance
+ */
+ public synchronized static void stop() throws Exception {
+ if (instance != null) {
+ instance.shutdown();
+ instance = null;
+ }
+ }
+
+
+ /**
+ * @return the list of packages to be exported by the system bundle
+ */
+ protected String getSystemPackages() {
+ String systemPackages =
+ "org.osgi.framework; version=1.3.0," +
+ "org.osgi.service.packageadmin; version=1.2.0, " +
+ "org.osgi.service.startlevel; version=1.0.0, " +
+ "org.osgi.service.url; version=1.0.0, " +
+ "org.osgi.util.tracker; version=1.3.2, " +
+ "javax.xml, " +
+ "javax.xml.datatype, " +
+ "javax.xml.namespace, " +
+ "javax.xml.parsers, " +
+ "javax.xml.transform, " +
+ "javax.xml.transform.dom, " +
+ "javax.xml.transform.sax, " +
+ "javax.xml.transform.stream, " +
+ "javax.xml.validation, " +
+ "javax.xml.xpath, " +
+ "javax.sql," +
+ "org.w3c.dom, " +
+ "org.w3c.dom.bootstrap, " +
+ "org.w3c.dom.ls, " +
+ "org.xml.sax, " +
+ "org.xml.sax.ext, " +
+ "org.xml.sax.helpers, " +
+ "javax.security.auth, " +
+ "javax.security.auth.login, " +
+ "javax.security.auth.callback, " +
+ "javax.security.cert, " +
+ "javax.naming, " +
+ "javax.naming.spi, " +
+ "javax.naming.directory, " +
+ "javax.management, " +
+ "javax.imageio, " +
+ "sun.misc, " +
+ "javax.net, " +
+ "javax.net.ssl, " +
+ "javax.crypto, " +
+ "javax.rmi, " +
+ "javax.transaction, " +
+ "javax.transaction.xa";
+
+ return systemPackages;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/OSGiRuntimeLoader.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/OSGiRuntimeLoader.java
new file mode 100644
index 0000000000..c9f77b71cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/OSGiRuntimeLoader.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.test.util;
+
+import org.apache.tuscany.sca.test.osgi.runtime.impl.OSGiTestRuntime;
+
+
+
+/**
+ * OSGi Test Utils : Set up OSGi runtime
+ */
+public class OSGiRuntimeLoader {
+
+ public static OSGiTestRuntime startOSGiTestRuntime() throws Exception {
+
+ setUpFelixTestRuntime();
+
+
+ System.setProperty("felix.cache.profiledir", "target/.felix.test");
+
+ OSGiTestRuntime osgiRuntime = OSGiTestRuntime.getRuntime();
+
+ System.setProperty("felix.cache.profiledir", ".felix");
+
+ return osgiRuntime;
+
+ }
+
+ public static void setUpOSGiTestRuntime() throws Exception {
+
+ setUpFelixTestRuntime();
+
+ }
+
+
+ private static void setUpFelixTestRuntime() throws Exception {
+
+ String felixConfigFileName = "file:target/test-classes/felix/felix.config.properties";
+
+ System.setProperty("felix.config.properties", felixConfigFileName);
+
+ System.setProperty("felix.service.urlhandlers", "false");
+
+
+ try {
+ Class<?> felixMainClass = OSGiRuntimeLoader.class.getClassLoader().loadClass("org.apache.felix.main.Main");
+ String felixDir = felixMainClass.getProtectionDomain().getCodeSource().getLocation().getPath();
+ int index = 0;
+ if ((index = felixDir.indexOf("/org.apache.felix.main")) >= 0) {
+ felixDir = felixDir.substring(0, index);
+ System.setProperty("FELIX_DIR", felixDir);
+ }
+
+ } catch (Throwable e) {
+ // Ignore
+ }
+
+
+ }
+
+ public static void shutdownOSGiRuntime() {
+ try {
+ OSGiTestRuntime.stop();
+
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/TuscanyLoader.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/TuscanyLoader.java
new file mode 100644
index 0000000000..1fba0d6dcd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/TuscanyLoader.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.test.util;
+
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.lang.reflect.Method;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * Load Tuscany into an OSGi runtime
+ *
+ */
+public class TuscanyLoader {
+
+ private static final String tuscanyInstallerDir = "../tuscany-osgi-installer";
+ private static final String tuscanyInstallerJar = "tuscany-sca-osgi-installer.jar";
+
+ // 5-bundle version of Tuscany
+ private static final String scaApiDir = "../sca-api";
+ private static final String tuscanySpiDir = "../tuscany-spi";
+ private static final String tuscanyRuntimeDir = "../tuscany-runtime";
+ private static final String tuscanyExtensionsDir = "../tuscany-extensions";
+ private static final String thirdPartyDir = "../tuscany-3rdparty";
+
+ private static String findBundle(String subDirName, final String jarPrefix) throws Exception {
+
+ File dir = new File(subDirName + "/target");
+ if (dir.exists() && dir.isDirectory()) {
+ File[] files = dir.listFiles(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar") && (jarPrefix == null || name.startsWith(jarPrefix));
+ }
+
+ });
+
+ if (files != null && files.length > 0)
+ return files[0].toURI().toURL().toString();
+ }
+ return null;
+ }
+
+ public static Bundle loadTuscanyIntoOSGi(BundleContext bundleContext) throws Exception {
+
+ String tuscanyInstallerBundleName = new File(tuscanyInstallerDir + "/target/" + tuscanyInstallerJar).toURI().toURL().toString();
+ Bundle tuscanyInstallerBundle = bundleContext.installBundle(tuscanyInstallerBundleName);
+ tuscanyInstallerBundle.start();
+ Bundle[] bundles = bundleContext.getBundles();
+ Bundle tuscanyRuntimeBundle = tuscanyInstallerBundle;
+ for (Bundle bundle : bundles) {
+ if ("org.apache.tuscany.sca.osgi.runtime".equals(bundle.getSymbolicName())) {
+ tuscanyRuntimeBundle = bundle;
+ break;
+ }
+ }
+ setThreadContextClassLoader(tuscanyRuntimeBundle);
+
+ return tuscanyRuntimeBundle;
+ }
+
+ /**
+ * Load four Tuscany bundles (API, Core-SPI, Runtime, Extensions) and combined third party bundle
+ *
+ * @param bundleContext
+ */
+ public static Bundle load5BundleTuscanyIntoOSGi(BundleContext bundleContext) throws Exception {
+
+
+ String thirdPartyBundleName = findBundle(thirdPartyDir, null);
+ Bundle thirdPartyBundle = bundleContext.installBundle(thirdPartyBundleName);
+ thirdPartyBundle.start();
+
+
+ String scaApiBundleName = findBundle(scaApiDir, null);
+ Bundle scaApiBundle = bundleContext.installBundle(scaApiBundleName);
+ scaApiBundle.start();
+
+ String tuscanySpiBundleName = findBundle(tuscanySpiDir, null);
+ Bundle tuscanySpiBundle = bundleContext.installBundle(tuscanySpiBundleName);
+
+ String tuscanyRuntimeBundleName = findBundle(tuscanyRuntimeDir, null);
+ Bundle tuscanyRuntimeBundle = bundleContext.installBundle(tuscanyRuntimeBundleName);
+
+ String tuscanyExtensionsBundleName = findBundle(tuscanyExtensionsDir, null);
+ Bundle tuscanyExtensionsBundle = bundleContext.installBundle(tuscanyExtensionsBundleName);
+
+
+ tuscanySpiBundle.start();
+ tuscanyExtensionsBundle.start();
+
+ setThreadContextClassLoader(tuscanyRuntimeBundle);
+ return tuscanyRuntimeBundle;
+
+ }
+
+
+ // Tuscany runtime is started on a different thread when previously cached bundle is used.
+ // Set this thread's TCCL to the one used by the runtime.
+ public static void setThreadContextClassLoader(Bundle tuscanyRuntimeBundle) throws BundleException {
+ if (tuscanyRuntimeBundle != null) {
+
+ try {
+ Class<?> runtimeClass = tuscanyRuntimeBundle.loadClass("org.apache.tuscany.sca.osgi.runtime.OSGiRuntime");
+ Method getRuntimeMethod = runtimeClass.getMethod("findRuntime");
+ Object runtime = getRuntimeMethod.invoke(runtimeClass);
+ Method getTCCLMethod = runtimeClass.getMethod("getContextClassLoader");
+ ClassLoader runtimeTCCL = (ClassLoader) getTCCLMethod.invoke(runtime);
+ Thread.currentThread().setContextClassLoader(runtimeTCCL);
+
+ } catch (Throwable e) {
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyNonOSGiTestHarness.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyNonOSGiTestHarness.java
new file mode 100644
index 0000000000..8bf7a1fb2f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyNonOSGiTestHarness.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.test.osgi.harness;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashSet;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.test.util.TuscanyLoader;
+
+/*
+ * Test Tuscany running in an OSGi container
+ * This harness runs Tuscany samples outside OSGi with Tuscany running in OSGi
+ */
+public class OSGiTuscanyNonOSGiTestHarness extends OSGiTuscanyTestHarness {
+
+ public void runTest(String... testDirs) throws Exception {
+
+ String mainTestDir = testDirs[0];
+
+ File testDir = new File(mainTestDir + "/target/test-classes");
+ if (!testDir.exists()) {
+ System.err.println("Test directory " + testDir + " does not exist");
+ return;
+ }
+
+ System.out.println("Run tests from : " + mainTestDir);
+
+ long startTime = System.currentTimeMillis();
+
+ String[] dirs = new String[testDirs.length + 2];
+ int i = 0;
+ dirs[i++] = mainTestDir + "/target/test-classes";
+ dirs[i++] = "target/test-classes";
+ for (int j = 0; j < testDirs.length; j++) {
+ dirs[i++] = testDirs[j] + "/target/classes";
+ }
+
+ tuscanyRuntime = TuscanyLoader.loadTuscanyIntoOSGi(getBundleContext());
+ long endTime = System.currentTimeMillis();
+
+ System.out.println("Loaded Tuscany, time taken = " + (endTime - startTime) + " ms");
+
+ URL[] dirURLs = new URL[dirs.length];
+ for (int j = 0; j < dirs.length; j++) {
+ dirURLs[j] = new File(dirs[j]).toURI().toURL();
+ }
+ ClassLoader testClassLoader = new URLClassLoader(dirURLs, Thread.currentThread().getContextClassLoader());
+ Thread.currentThread().setContextClassLoader(testClassLoader);
+
+ Class<?> testClass = testClassLoader.loadClass(this.getClass().getName());
+ Method testMethod = testClass.getMethod("runAllTestsFromDirs", ClassLoader.class, String[].class);
+ Object testObject = testClass.newInstance();
+ testMethod.invoke(testObject, testClassLoader, dirs);
+
+ }
+
+ public void getTestCases(File dir, String prefix, HashSet<String> testCaseSet) {
+ File[] files = dir.listFiles();
+ for (File file : files) {
+ if (file.isDirectory()) {
+ String newPrefix = prefix == null ? file.getName() : prefix + "." + file.getName();
+ getTestCases(file, newPrefix, testCaseSet);
+ } else if (file.getName().endsWith("TestCase.class")) {
+ String name = file.getName();
+ name = name.substring(0, name.length() - 6); // remove .class
+ name = (prefix == null) ? name : prefix + "." + name;
+
+ testCaseSet.add(name);
+ }
+ }
+ }
+
+ public void runAllTestsFromDirs(ClassLoader testClassLoader, String[] testDirs) throws Exception {
+
+ int failures = 0;
+ HashSet<String> testCaseSet = new HashSet<String>();
+ for (String testDir : testDirs) {
+ getTestCases(new File(testDir), null, testCaseSet);
+ }
+ for (String className : testCaseSet) {
+ Class testClass = testClassLoader.loadClass(className);
+ failures += runTestCase(testClass).getFailureCount();
+ }
+
+ Assert.assertEquals(0, failures);
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyTestHarness.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyTestHarness.java
new file mode 100644
index 0000000000..ba9b7007b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyTestHarness.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.test.osgi.harness;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+
+import org.apache.tuscany.sca.test.osgi.runtime.impl.OSGiTestRuntime;
+import org.apache.tuscany.sca.test.util.OSGiRuntimeLoader;
+import org.apache.tuscany.sca.test.util.TuscanyLoader;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/*
+ * Test Tuscany running in an OSGi container
+ * Harness can be used to run Tuscany samples with Tuscany running in OSGi
+ */
+public class OSGiTuscanyTestHarness {
+
+ private OSGiTestRuntime osgiRuntime;
+ protected Bundle tuscanyRuntime;
+ private BundleContext bundleContext;
+ private Bundle testBundle;
+
+ public void setUp() throws Exception {
+
+ osgiRuntime = OSGiRuntimeLoader.startOSGiTestRuntime();
+ bundleContext = osgiRuntime.getBundleContext();
+
+ // Uninstall any previously installed test bundles
+ for (Bundle bundle : bundleContext.getBundles()) {
+ if ("org.apache.tuscany.sca.test.samples".equals(bundle.getSymbolicName())) {
+ bundle.uninstall();
+ }
+ }
+ }
+
+ public void tearDown() throws Exception {
+ if (tuscanyRuntime != null) {
+ tuscanyRuntime.stop();
+ }
+ OSGiRuntimeLoader.shutdownOSGiRuntime();
+ }
+
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ public void runTest(String... testDirs) throws Exception {
+
+ String mainTestDir = testDirs[0];
+
+ File testDir = new File(mainTestDir + "/target/test-classes");
+ if (!testDir.exists()) {
+ System.err.println("Test directory " + testDir + " does not exist");
+ return;
+ }
+
+ System.out.println("Run tests from : " + mainTestDir);
+
+ long startTime = System.currentTimeMillis();
+
+ tuscanyRuntime = TuscanyLoader.loadTuscanyIntoOSGi(bundleContext);
+
+ String[] dirs = new String[testDirs.length + 2];
+ int i = 0;
+ dirs[i++] = mainTestDir + "/target/test-classes";
+ dirs[i++] = "target/test-classes";
+ for (int j = 0; j < testDirs.length; j++) {
+ dirs[i++] = testDirs[j] + "/target/classes";
+ }
+
+ String manifestFile = "target/test-classes/META-INF/MANIFEST.MF";
+
+ testBundle = createAndInstallBundle("file:" + mainTestDir + "/target/classes", // Bundle location: used to get File URLs for DefaultSCADomain
+ manifestFile, // Test bundle manifest file
+ dirs // Directory entries to be added to bundle
+ );
+
+ long endTime = System.currentTimeMillis();
+
+ System.out.println("Loaded Tuscany, time taken = " + (endTime - startTime) + " ms");
+
+ testBundle.start();
+
+ Class<?> testClass = testBundle.loadClass(this.getClass().getName());
+ Method testMethod = testClass.getMethod("runAllTestsFromBundle", Bundle.class);
+ Object testObject = testClass.newInstance();
+ testMethod.invoke(testObject, testBundle);
+
+ testBundle.stop();
+ testBundle.uninstall();
+ }
+
+ // Create and install a bundle with the specified manifest file
+ // The bundle contains all files from the list of directories specified
+ public Bundle createAndInstallBundle(String bundleLocation, String manifestFileName, String[] dirNames)
+ throws Exception {
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ File manifestFile = new File(manifestFileName);
+ Manifest manifest = new Manifest();
+ manifest.read(new FileInputStream(manifestFile));
+ manifest.getMainAttributes().putValue("Bundle-Version",
+ (String)tuscanyRuntime.getHeaders().get("Bundle-Version"));
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ for (int i = 0; i < dirNames.length; i++) {
+ File dir = new File(dirNames[i]);
+ addFilesToJar(dir, dirNames[i], jarOut);
+ }
+
+ jarOut.close();
+ out.close();
+
+ ByteArrayInputStream inStream = new ByteArrayInputStream(out.toByteArray());
+ return bundleContext.installBundle(bundleLocation, inStream);
+
+ }
+
+ // Add all the files from a build directory into a jar file
+ // This method is used to create bundles on the fly
+ private void addFilesToJar(File dir, String rootDirName, JarOutputStream jarOut) throws Exception {
+
+ if (dir.getName().equals(".svn"))
+ return;
+
+ File[] files = dir.listFiles();
+
+ if (files == null)
+ return;
+
+ for (int i = 0; i < files.length; i++) {
+
+ if (files[i].isDirectory()) {
+ addFilesToJar(files[i], rootDirName, jarOut);
+ }
+ if (files[i].getName().endsWith("MANIFEST.MF"))
+ continue;
+
+ String entryName = files[i].getPath().substring(rootDirName.length() + 1);
+ entryName = entryName.replaceAll("\\\\", "/");
+ if (files[i].isDirectory()) {
+ entryName += "/";
+ }
+ ZipEntry ze = new ZipEntry(entryName);
+
+ try {
+ jarOut.putNextEntry(ze);
+ FileInputStream file = new FileInputStream(files[i]);
+ byte[] fileContents = new byte[file.available()];
+ file.read(fileContents);
+ jarOut.write(fileContents);
+ } catch (Exception e) {
+ // Ignore duplicate entry errors
+ }
+ }
+ }
+
+ public void runAllTestsFromBundle(Bundle bundle) throws Exception {
+ int failures = 0;
+ Enumeration entries = bundle.findEntries("/", "*TestCase.class", true);
+ while (entries.hasMoreElements()) {
+ URL entry = (URL)entries.nextElement();
+ String className = entry.getFile();
+ className = className.substring(1, className.length() - 6); // remove leading / and trailing .class
+ className = className.replaceAll("/", ".");
+ Class testClass = bundle.loadClass(className);
+ failures += runTestCase(testClass).getFailureCount();
+ }
+
+ Assert.assertEquals(0, failures);
+
+ }
+
+ public Result runTestCase(Class testClass) throws Exception {
+
+ if (testClass.getName().endsWith("TestCase") && !testClass.getName()
+ .startsWith("org.apache.tuscany.sca.test.osgi.")) {
+ JUnitCore core = new JUnitCore();
+ System.out.println("Running test " + testClass.getName() + " ");
+ Result result = core.run(Request.aClass(testClass));
+ // long duration = result.getRunTime();
+ int runs = result.getRunCount();
+ int failures = 0, errors = 0;
+ int ignores = result.getIgnoreCount();
+
+ for (Failure f : result.getFailures()) {
+ if (f.getException() instanceof AssertionFailedError) {
+ failures++;
+ } else {
+ errors++;
+ }
+ }
+
+ System.out.println("Test Runs: " + runs
+ + ", Failures: "
+ + failures
+ + ", Errors: "
+ + errors
+ + ", Ignores: "
+ + ignores);
+
+ return result;
+
+ }
+ return new Result();
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorImplementationPoliciesTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorImplementationPoliciesTestCase.java
new file mode 100644
index 0000000000..85397195bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorImplementationPoliciesTestCase.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-calculator-implementation-policies
+ */
+public class CalculatorImplementationPoliciesTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "calculator-implementation-policies");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorRmiTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorRmiTestCase.java
new file mode 100644
index 0000000000..9346fb8ed2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorRmiTestCase.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.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-calculator-rmi-reference and samples-calculator-rmi-service
+ */
+public class CalculatorRmiTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "calculator-rmi-reference");
+ testHarness.runTest("../../../samples/" + "calculator-rmi-service");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorScriptTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorScriptTestCase.java
new file mode 100644
index 0000000000..501cded48d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorScriptTestCase.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.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-calculator-script
+ */
+public class CalculatorScriptTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+
+ System.setProperty("python.cachedir", "target/cachedir");
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "calculator-script");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsClientTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsClientTestCase.java
new file mode 100644
index 0000000000..687335b3c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsClientTestCase.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-callback-ws
+ */
+public class CallbackWsClientTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "callback-ws-client",
+ "../../../samples/" + "callback-ws-service");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsServiceTestCase.java
new file mode 100644
index 0000000000..f605e024ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsServiceTestCase.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-callback-ws
+ */
+public class CallbackWsServiceTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "callback-ws-service");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceJmsTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceJmsTestCase.java
new file mode 100644
index 0000000000..4f5640960b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceJmsTestCase.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-helloworld-ws-service-jms
+ */
+public class HelloworldWsServiceJmsTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "helloworld-ws-service-jms");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceSecureTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceSecureTestCase.java
new file mode 100644
index 0000000000..9a491304bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceSecureTestCase.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-helloworld-ws-service-secure
+ */
+public class HelloworldWsServiceSecureTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "helloworld-ws-service-secure");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceTestCase.java
new file mode 100644
index 0000000000..2e0b49e693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceTestCase.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-helloworld-ws-service
+ */
+public class HelloworldWsServiceTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "helloworld-ws-service");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/NonOSGiSamplesTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/NonOSGiSamplesTestCase.java
new file mode 100644
index 0000000000..eac9979f56
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/NonOSGiSamplesTestCase.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyNonOSGiTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples which use old domain code
+ */
+public class NonOSGiSamplesTestCase {
+
+
+ private static String[] SAMPLES = {
+ "binding-notification-consumer",
+ "binding-notification-producer",
+ "calculator",
+ "implementation-composite",
+ "implementation-notification",
+ "loanapplication",
+ "simple-bigbank",
+ "simple-callback",
+ "supplychain",
+ "calculator-implementation-policies",
+ "calculator-rmi-reference",
+ "calculator-rmi-service",
+ "callback-ws-service",
+ "helloworld-ws-service-jms",
+ "helloworld-ws-service-secure",
+ "helloworld-ws-service"
+
+ };
+
+
+ private OSGiTuscanyNonOSGiTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyNonOSGiTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ testHarness = null;
+ }
+ }
+
+
+ @Test
+ public void runTestsOutsideOSGi() throws Exception {
+
+ for (String testDir : SAMPLES) {
+ testHarness.runTest("../../../samples/" + testDir);
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiSupplyChainTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiSupplyChainTestCase.java
new file mode 100644
index 0000000000..62c0eef16d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiSupplyChainTestCase.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-osgi-supplychain
+ */
+public class OSGiSupplyChainTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ BundleContext bundleContext = testHarness.getBundleContext();
+ if (bundleContext != null) {
+ Bundle[] bundles = bundleContext.getBundles();
+ for (Bundle bundle : bundles) {
+ if (bundle.getSymbolicName() != null && bundle.getSymbolicName().contains("supplychain"))
+ bundle.uninstall();
+ }
+ }
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "osgi-supplychain");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiTuscanyRuntimeTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiTuscanyRuntimeTestCase.java
new file mode 100644
index 0000000000..155dd368a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiTuscanyRuntimeTestCase.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.osgi.tuscany;
+
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.test.osgi.runtime.impl.OSGiTestRuntime;
+import org.apache.tuscany.sca.test.util.OSGiRuntimeLoader;
+import org.apache.tuscany.sca.test.util.TuscanyLoader;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/*
+ * Test Tuscany running inside OSGi
+ */
+public class OSGiTuscanyRuntimeTestCase {
+
+ private OSGiTestRuntime osgiRuntime;
+ private Bundle tuscanyRuntime;
+
+
+ @Before
+ public void setUp() throws Exception {
+
+ osgiRuntime = OSGiRuntimeLoader.startOSGiTestRuntime();
+ BundleContext bundleContext = osgiRuntime.getBundleContext();
+
+ // Uninstall any previously installed test bundles
+ for (Bundle bundle : bundleContext.getBundles()) {
+ String bundleName = bundle.getSymbolicName();
+ if (bundleName != null &&
+ (bundleName.equals("org.apache.tuscany.sca.test.samples")||
+ bundleName.startsWith("supplychain"))) {
+ bundle.uninstall();
+ }
+ }
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (tuscanyRuntime != null) {
+ tuscanyRuntime.stop();
+ }
+ OSGiRuntimeLoader.shutdownOSGiRuntime();
+ }
+
+
+
+ @Test
+ public void startTuscanyRuntimeInOSGi() throws Exception {
+
+ tuscanyRuntime = TuscanyLoader.loadTuscanyIntoOSGi(osgiRuntime.getBundleContext());
+ Assert.assertNotNull(tuscanyRuntime);
+ Bundle[] bundles = osgiRuntime.getBundleContext().getBundles();
+ Bundle runtimeBundle = null;
+ for (Bundle bundle : bundles) {
+ if ("org.apache.tuscany.sca.osgi.runtime".equals(bundle.getSymbolicName())) {
+ runtimeBundle = bundle;
+ break;
+ }
+ }
+ Assert.assertNotNull(runtimeBundle);
+ Class<?> clazz = runtimeBundle.loadClass("org.apache.tuscany.sca.osgi.runtime.OSGiRuntime");
+ Assert.assertNotNull(clazz);
+
+ }
+
+ @Test
+ public void testOSGiTuscany_ImplementationJava() throws Exception {
+ testOSGiTuscanyUsingOSGiClient("SupplyChain.jar");
+ }
+
+ @Test
+ public void testOSGiTuscany_BindingWS() throws Exception {
+ testOSGiTuscanyUsingOSGiClient("SupplyChainWS.jar");
+ }
+
+
+ private void testOSGiTuscanyUsingOSGiClient(String contributionJarName) throws Exception {
+
+ tuscanyRuntime = TuscanyLoader.loadTuscanyIntoOSGi(osgiRuntime.getBundleContext());
+
+ String folderName = "../test-bundles/target/";
+ String supplychainJarName = contributionJarName;
+ String supplychainClientJarName = "SupplyChainClient.jar";
+ URL supplyChainURL = new File(folderName + supplychainJarName).toURI().toURL();
+ URL supplyChainClientURL = new File(folderName + supplychainClientJarName).toURI().toURL();
+
+ Bundle supplyChainBundle = osgiRuntime.getBundleContext().installBundle(supplyChainURL.toString());
+ supplyChainBundle.start();
+ Bundle clientBundle = osgiRuntime.getBundleContext().installBundle(supplyChainClientURL.toString());
+ clientBundle.start();
+
+ String clientClassName = "supplychain.client.SupplyChainClient";
+ Class<?> clientClass = clientBundle.loadClass(clientClassName);
+ ServiceReference testServiceRef = clientBundle.getBundleContext().getServiceReference(clientClassName);
+ Object testService = clientBundle.getBundleContext().getService(testServiceRef);
+
+ Method m = clientClass.getMethod("runTest", String.class);
+ m.invoke(testService, contributionJarName);
+
+ System.out.println("OSGi Client test completed successfully.");
+
+ supplyChainBundle.uninstall();
+ clientBundle.uninstall();
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySampleExtensionsTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySampleExtensionsTestCase.java
new file mode 100644
index 0000000000..b45c062761
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySampleExtensionsTestCase.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.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples which use provide Tuscany extensions
+ */
+public class TuscanySampleExtensionsTestCase {
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ testHarness = null;
+ }
+ }
+
+
+ @Test
+ public void testBindingEchoExtension() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "binding-echo-extension");
+ }
+
+ @Test
+ public void testBindingEcho() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "binding-echo", "../../../samples/" + "binding-echo-extension");
+
+ }
+
+ @Test
+ public void testDataBindingEcho() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "databinding-echo", "../../../samples/" + "binding-echo-extension");
+
+ }
+
+ @Test
+ public void testImplementationCrudExtension() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "implementation-crud-extension");
+ }
+
+ @Test
+ public void testImplementationCrud() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "implementation-crud", "../../../samples/" + "implementation-crud-extension");
+
+ }
+
+ @Test
+ public void testImplementationPojoExtension() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "implementation-pojo-extension");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySamplesUsingOldDomainTestCase.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySamplesUsingOldDomainTestCase.java
new file mode 100644
index 0000000000..c2dae9eb97
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySamplesUsingOldDomainTestCase.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.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples which use old domain code
+ */
+public class TuscanySamplesUsingOldDomainTestCase {
+
+
+ private static String[] SAMPLES = {
+
+ "binding-notification-consumer",
+ "binding-notification-producer",
+ "calculator",
+ "implementation-composite",
+ "implementation-notification",
+ "loanapplication",
+ "quote-xquery",
+ "simple-bigbank",
+ "simple-callback",
+ "supplychain"
+
+ };
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ testHarness = null;
+ }
+ }
+
+
+ @Test
+ public void runTestsUsingOldDomainCode() throws Exception {
+
+ for (String testDir : SAMPLES) {
+ testHarness.runTest("../../../samples/" + testDir);
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..8985947286
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: tuscany.sca.samples
+Bundle-SymbolicName: org.apache.tuscany.sca.test.samples
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ junit.framework,
+ org.junit,
+ org.apache.tuscany.sca.host.embedded,
+ org.osoa.sca,
+ org.osoa.sca.annotations,
+ org.apache.tuscany.sca.databinding.annotation
+DynamicImport-Package: *
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/felix/felix.config.properties b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/felix/felix.config.properties
new file mode 100644
index 0000000000..6a38f48c4a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/felix/felix.config.properties
@@ -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.
+#
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \
+ org.osgi.service.packageadmin; version=1.2.0, \
+ org.osgi.service.startlevel; version=1.0.0, \
+ org.osgi.service.url; version=1.0.0 \
+ org.osgi.util.tracker; version=1.3.2
+
+
+felix.auto.start.1= \
+ "file://${FELIX_DIR}/org.apache.felix.scr/1.0.2/org.apache.felix.scr-1.0.2.jar"
+
+# "file://${FELIX_DIR}/org.apache.felix.configadmin/1.0.1/org.apache.felix.configadmin-1.0.1.jar"
+# "file://${FELIX_DIR}/org.apache.felix.shell/1.0.1/org.apache.felix.shell-1.0.1.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.shell.tui/1.0.1/org.apache.felix.shell.tui-1.0.1.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.bundlerepository/1.0.3/org.apache.felix.bundlerepository-1.0.3.jar" \
+
+
+felix.startlevel.framework=1
+felix.startlevel.bundle=1
+
+#
+# Bundle config properties.
+#
+org.osgi.service.http.port=8080
+obr.shell.telnet=on
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/pom.xml
new file mode 100644
index 0000000000..0da4f09d61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany OSGi-based Tuscany Runtime Integration Tests</name>
+
+ <modules>
+ <module>test-bundles</module>
+ <module>tuscany-versioned</module>
+ <module>tuscany-osgi-installer</module>
+ <module>osgi-tuscany-test</module>
+ </modules>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/build-bundles.xml b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/build-bundles.xml
new file mode 100644
index 0000000000..c7ea66863f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/build-bundles.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 name="OSGiBundleCreator">
+
+ <target name="create-bundles">
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" manifest="${files.dir}/${manifest.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ </fileset>
+ </jar>
+ </target>
+
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/pom.xml
new file mode 100644
index 0000000000..b53beea930
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/pom.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-test-bundles</artifactId>
+ <name>Apache Tuscany OSGi-Based Tuscany Runtime Test Bundles</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <finalName>itest-osgi-tuscany-test-bundles</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-bundles</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChain.jar" />
+ <property name="manifest.file.name" value="META-INF/SupplyChain.mf" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/retailer/* \
+ supplychain/warehouse/* \
+ supplychain/shipper/* \
+ supplychain/supplychain.composite \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChainClient.jar" />
+ <property name="manifest.file.name" value="META-INF/SupplyChainClient.mf" />
+ <property name="files.list"
+ value="supplychain/client/*" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChainWS.jar" />
+ <property name="manifest.file.name" value="META-INF/SupplyChain.mf" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/retailer/* \
+ supplychain/warehouse/* \
+ supplychain/shipper/* \
+ supplychain/ws/supplychain.composite \
+ supplychain/ws/Customer.wsdl \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/client/SupplyChainClient.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/client/SupplyChainClient.java
new file mode 100644
index 0000000000..0ac96b35a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/client/SupplyChainClient.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 supplychain.client;
+
+
+import java.io.File;
+import java.net.URL;
+import java.util.Hashtable;
+
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+
+
+import supplychain.customer.Customer;
+
+/**
+ * SupplyChain test client
+ */
+public class SupplyChainClient implements BundleActivator {
+
+ private EmbeddedSCADomain scaDomain;
+ private Customer customer;
+
+
+
+ public void start(BundleContext context) throws Exception {
+
+ context.registerService(SupplyChainClient.class.getName(), this, new Hashtable());
+
+ }
+
+ public void stop(BundleContext context) throws Exception {
+
+ }
+
+ protected void setUp(String contributionJarName) throws Exception {
+
+ scaDomain = new EmbeddedSCADomain(EmbeddedSCADomain.class.getClassLoader(), "http://localhost");
+ scaDomain.start();
+ ContributionService contributionService = scaDomain.getContributionService();
+ String folderName = "../test-bundles/target/";
+ String supplychainJarName = contributionJarName;
+ URL supplyChainURL = new File(folderName + supplychainJarName).toURI().toURL();
+
+ Contribution contribution = contributionService.contribute("SupplyChain", supplyChainURL, false);
+ for (Composite deployable : contribution.getDeployables() ) {
+ scaDomain.getDomainComposite().getIncludes().add(deployable);
+ scaDomain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : contribution.getDeployables() ) {
+ scaDomain.getCompositeActivator().activate(deployable);
+ scaDomain.getCompositeActivator().start(deployable);
+ }
+ customer = scaDomain.getService(Customer.class, "CustomerComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ scaDomain = null;
+ }
+ }
+
+
+ public void runTest(String contributionJarName) throws Exception {
+
+ try {
+ setUp(contributionJarName);
+ customer.purchaseGoods();
+ int retries = 10;
+ int outstandingCount = 1;
+ while (retries-- > 0) {
+
+ outstandingCount = customer.outstandingOrderCount();
+ if (outstandingCount == 0)
+ break;
+ else
+ Thread.sleep(100);
+ }
+ if (outstandingCount != 0)
+ throw new RuntimeException("Orders not processed on time");
+
+ } finally {
+
+ tearDown();
+ }
+
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/Customer.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..a3aa2531fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/Customer.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 supplychain.customer;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the Customer service component.
+ */
+@Remotable
+public interface Customer {
+
+ public void purchaseGoods();
+
+ @OneWay
+ public void notifyShipment(String order);
+
+ public int outstandingOrderCount();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..5f1342c40b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private static int outstandingOrderCount;
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ }
+
+ @Reference
+ public void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ public void purchaseGoods() {
+ outstandingOrderCount++;
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrderCount--;
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public int outstandingOrderCount() {
+ return outstandingOrderCount;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..f5708dec40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (POJO implementation).
+ */
+@Service(Retailer.class)
+@Scope("STATELESS")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public JavaRetailerComponentImpl() {
+ }
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+
+ public Warehouse getWarehouse() {
+ return warehouse;
+ }
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/Retailer.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..17b342f8dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/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.retailer;
+
+/**
+ * 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-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..afaf7aea02
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/JavaShipperComponentImpl.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.shipper;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (POJO implementation).
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ public JavaShipperComponentImpl() {
+ }
+
+ @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-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/Shipper.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..cd204ebc2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/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.shipper;
+
+/**
+ * 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-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..ca720085c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.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 supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (POJO implementation).
+ */
+@Service(Warehouse.class)
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public JavaWarehouseComponentImpl() {
+ }
+
+ @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-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/Warehouse.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..b4807b80d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/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.warehouse;
+
+/**
+ * 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-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChain.mf b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChain.mf
new file mode 100644
index 0000000000..f71d822bbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChain.mf
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SupplyChain
+Bundle-SymbolicName: supplychain.SupplyChain
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osoa.sca,
+ org.osoa.sca.annotations,
+ javax.xml.bind.annotation
+Export-Package: supplychain.customer, supplychain
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChainClient.mf b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChainClient.mf
new file mode 100644
index 0000000000..13a3c9b82a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChainClient.mf
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SupplyChainClient
+Bundle-SymbolicName: supplychain.SupplyChainClient
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer, supplychain,
+ org.apache.tuscany.sca.host.embedded,
+ org.apache.tuscany.sca.host.embedded.impl,
+ org.apache.tuscany.sca.assembly,
+ org.apache.tuscany.sca.contribution,
+ org.apache.tuscany.sca.contribution.service,
+ org.apache.tuscany.sca.core.assembly,
+ org.apache.tuscany.sca.assembly.builder,
+ org.osoa.sca,
+ org.osoa.sca.annotations,
+ javax.xml.bind.annotation
+Export-Package: supplychain.client
+Bundle-Activator: supplychain.client.SupplyChainClient
+
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b524abc2a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/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://supplychain"
+ xmlns:supplychain="http://supplychain">
+
+ <deployable composite="supplychain:supplychain"/>
+
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/supplychain.composite b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/supplychain.composite
new file mode 100644
index 0000000000..5be79b741a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/supplychain.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.customer.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/Customer.wsdl b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/Customer.wsdl
new file mode 100644
index 0000000000..8549ca3409
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/Customer.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://supplychain"
+ xmlns:axis2ns1="http://supplychain"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:ns1="http://supplychain"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <xs:schema attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://supplychain"
+ xmlns:ns="http://supplychain" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="outstandingOrderCount">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="outstandingOrderCountResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="return" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="notifyShipment">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param0" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="notifyShipmentResponse">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="purchaseGoods">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="purchaseGoodsResponse">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="outstandingOrderCountRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:outstandingOrderCount" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="outstandingOrderCountResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:outstandingOrderCountResponse" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="notifyShipmentRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:notifyShipment" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="notifyShipmentResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:notifyShipmentResponse" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="purchaseGoodsRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:purchaseGoods" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="purchaseGoodsResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:purchaseGoodsResponse" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:portType name="Customer" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:operation name="outstandingOrderCount" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:input message="axis2ns1:outstandingOrderCountRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ <wsdl:output
+ message="axis2ns1:outstandingOrderCountResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:operation>
+ <wsdl:operation name="notifyShipment" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:input message="axis2ns1:notifyShipmentRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:operation>
+ <wsdl:operation name="purchaseGoods" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:input message="axis2ns1:purchaseGoodsRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ <wsdl:output message="axis2ns1:purchaseGoodsResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CustomerBinding" type="axis2ns1:Customer" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <wsdl:operation name="outstandingOrderCount" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:operation soapAction="urn:outstandingOrderCount"
+ style="document" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <wsdl:input xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:body namespace="http://supplychain" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:input>
+ <wsdl:output xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:body namespace="http://supplychain" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="notifyShipment" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:operation soapAction="urn:notifyShipment" style="document" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <wsdl:input xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:body namespace="http://supplychain" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:input>
+ </wsdl:operation>
+ <wsdl:operation name="purchaseGoods" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:operation soapAction="urn:purchaseGoods" style="document" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <wsdl:input xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:body namespace="http://supplychain" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="CustomerWebService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:port binding="axis2ns1:CustomerBinding"
+ name="CustomerPort" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:address
+ location="http://localhost:8085/services/Customer" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/supplychain.composite b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/supplychain.composite
new file mode 100644
index 0000000000..88d1e72efc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/supplychain.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.customer.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ <service name="Customer">
+ <interface.wsdl interface="http://supplychain#wsdl.interface(Customer)" />
+ <binding.ws wsdlElement="http://supplychain#wsdl.port(CustomerWebService/CustomerPort)"/>
+ </service>
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer">
+ <interface.wsdl interface="http://supplychain#wsdl.interface(Customer)" />
+ <binding.ws wsdlElement="http://supplychain#wsdl.port(CustomerWebService/CustomerPort)"/>
+ </reference>
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-osgi-installer/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-osgi-installer/pom.xml
new file mode 100644
index 0000000000..ea1c78fa2a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-osgi-installer/pom.xml
@@ -0,0 +1,671 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-installer</artifactId>
+ <name>Apache Tuscany OSGi - Tuscany Installer Bundle</name>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ <tuscany.version>${pom.version}</tuscany.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-monitor-logging</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly</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-assembly-xsd</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ejb-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-atom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-feed</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rss</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apache-activemq</artifactId>
+ <version>4.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-console</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-optional</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-jaas</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jsp_2.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api-2.5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activesoap</groupId>
+ <artifactId>jaxp-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activemq</groupId>
+ <artifactId>jmdns</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jrms</groupId>
+ <artifactId>jrms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xmlpull</groupId>
+ <artifactId>xmlpull</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j-remote</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-notification</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-sca</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-xml</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>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-groovy</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-contribution-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-namespace</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-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-fastinfoset</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-databinding-xmlbeans</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-xstream</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-rmi</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-host-jetty</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-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-implementation-bpel</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+-->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-das</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-ejb</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-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>groovy</groupId>
+ <artifactId>groovy-all-minimal</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-widget-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-launcher</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-policy-logging</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-manager</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-xml</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-wsdl2java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-tools</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.6</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <cpFile>${project.build.directory}/classes/org/apache/tuscany/sca/installer/.classpath</cpFile>
+ <includeScope>runtime</includeScope>
+ </configuration>
+ <executions>
+ <execution>
+ <id>build-classpath</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>tuscany-sca-osgi-installer</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ <manifestEntries>
+
+ <Bundle-Version>2.0</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.installer</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Import-Package>org.osgi.framework</Import-Package>
+ <Export-Package>org.apache.tuscany.sca.installer</Export-Package>
+ <Bundle-Activator>org.apache.tuscany.sca.installer.InstallerBundleActivator</Bundle-Activator>
+kage>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java
new file mode 100644
index 0000000000..0c26477a43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-osgi-installer/src/main/java/org/apache/tuscany/sca/installer/InstallerBundleActivator.java
@@ -0,0 +1,405 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.installer;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Bundle activator which installs Tuscany modules and 3rd party jars into an OSGi runtime.
+ *
+ */
+public class InstallerBundleActivator implements BundleActivator {
+
+ private ArrayList<Bundle> tuscanyBundles = new ArrayList<Bundle>();
+
+ private static final String[] immutableJars = {
+ "bcprov"
+ };
+
+ private static final String[] tuscanyModulesToIgnore = {
+ "node2-launcher-webapp",
+ "implementation-node-runtime", // uses node2
+ "saxon",
+ "runtime",
+ "runtime-webapp",
+ "runtime-tomcat",
+ "runtime-war",
+ "host-webapp",
+ "host-tomcat",
+ "policy-transaction",
+ "implementation-bpel",
+ "binding-ejb",
+ "implementation-ejb",
+ "implementation-ejb-xml",
+
+ };
+
+ private static final String[] rebundleJars = {
+ "org.apache.tuscany.sca.3rdparty.org.apache.tuscany.sdo", // Recreate export statements
+ };
+
+ public void start(BundleContext bundleContext) throws Exception {
+
+ String tuscanyHome = System.getProperty("TUSCANY_HOME");
+ if (tuscanyHome == null) {
+ File homeDir = new File("../tuscany-versioned/target/classes");
+ if (homeDir.exists()) {
+ tuscanyHome = homeDir.getCanonicalPath();
+ }
+ }
+
+ System.out.println("Installing Tuscany from TUSCANY_HOME=" + tuscanyHome);
+ installVersionedTuscanyIntoOSGi(bundleContext, tuscanyHome);
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+
+ for (Bundle bundle : tuscanyBundles) {
+ try {
+ bundle.stop();
+ } catch (Exception e) {
+ // Ignore error
+ }
+ }
+ }
+
+ private void installVersionedTuscanyIntoOSGi(BundleContext bundleContext, String tuscanyHome) {
+
+ try {
+ Bundle[] installedBundles = bundleContext.getBundles();
+ HashSet<String> installedBundleSet = new HashSet<String>();
+ for (Bundle bundle : installedBundles) {
+ if (bundle.getSymbolicName() != null)
+ installedBundleSet.add(bundle.getSymbolicName());
+ }
+
+ // FIXME: SDO bundles dont have the correct dependencies
+ System.setProperty("commonj.sdo.impl.HelperProvider", "org.apache.tuscany.sdo.helper.HelperProviderImpl");
+
+ HashSet<File> tuscanyJars = new HashSet<File>();
+ HashSet<File> thirdPartyJars = new HashSet<File>();
+
+
+ File tuscanyInstallDir = new File(tuscanyHome).getCanonicalFile();
+ findBundles(bundleContext, tuscanyInstallDir, tuscanyJars, thirdPartyJars);
+
+
+ for (File bundleFile : thirdPartyJars) {
+
+ String bundleName = bundleFile.getName();
+ if (bundleName.startsWith("org.apache.felix"))
+ continue;
+
+ boolean installed = false;
+ for (String name : rebundleJars) {
+ if (bundleName.startsWith(name)) {
+ rebundleAndInstall(bundleContext, tuscanyInstallDir, bundleFile);
+ installed = true;
+ }
+ }
+ if (installed)
+ continue;
+
+ bundleContext.installBundle(bundleFile.toURI().toURL().toString());
+
+ }
+
+ Bundle osgiRuntimeBundle = null;
+ for (File bundleFile : tuscanyJars) {
+ Bundle bundle = bundleContext.installBundle(bundleFile.toURI().toURL().toString());
+ if ("org.apache.tuscany.sca.osgi.runtime".equals(bundle.getSymbolicName()))
+ osgiRuntimeBundle = bundle;
+ }
+ if (osgiRuntimeBundle != null)
+ osgiRuntimeBundle.start();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void rebundleAndInstall(BundleContext bundleContext, File tuscanyInstallDir, File bundleFile) throws Exception {
+ String bundleSymbolicName = bundleFile.getName();
+ if (bundleSymbolicName.endsWith(".jar")) bundleSymbolicName = bundleSymbolicName.substring(0, bundleSymbolicName.length()-4);
+
+ String bundleLocation = bundleFile.toURI().toURL().toString();
+ InputStream bundleManifestStream = updateBundleManifest(bundleFile, bundleSymbolicName);
+ HashSet<File> jarSet = new HashSet<File>();
+ jarSet.add(bundleFile);
+
+ File newBundleFile = new File(tuscanyInstallDir, "org.apache.tuscany.sca." + bundleFile.getName());
+ createAndInstallBundle(bundleContext, bundleLocation, newBundleFile, bundleManifestStream, jarSet);
+ bundleManifestStream.close();
+ }
+
+
+ private void findBundles(BundleContext bundleContext,
+ File tuscanyInstallDir,
+ HashSet<File> tuscanyJars,
+ HashSet<File> thirdPartyJars)
+ throws IOException
+ {
+
+ File[] jars = tuscanyInstallDir.listFiles();
+ for (File jar : jars) {
+ String jarName = jar.getName();
+ if (!jarName.endsWith(".jar"))
+ continue;
+
+ if (!jarName.startsWith("org.apache.tuscany.sca")||jarName.startsWith("org.apache.tuscany.sca.3rdparty")) {
+ if (jarName.endsWith(".jar"))
+ {
+ thirdPartyJars.add(jar);
+ }
+ } else {
+ boolean installTuscanyJar = true;
+ for (String name : tuscanyModulesToIgnore) {
+ name = name.replaceAll("-", ".");
+ if (jarName.startsWith("org.apache.tuscany.sca." + name)) {
+ installTuscanyJar = false;
+ break;
+ }
+ }
+ if (installTuscanyJar)
+ tuscanyJars.add(jar);
+ }
+ }
+ }
+
+
+ private InputStream updateBundleManifest(File jarFile, String bundleSymbolicName) throws Exception {
+
+ if (!jarFile.exists())
+ return null;
+ JarInputStream jar = new JarInputStream(new FileInputStream(jarFile));
+ Manifest manifest = jar.getManifest();
+ if (manifest == null) {
+ ZipEntry ze;
+ while ((ze = jar.getNextEntry()) != null) {
+ if (ze.getName().equals("META-INF/MANIFEST.MF"))
+ break;
+ }
+ if (ze != null) {
+ byte[] bytes = new byte[(int)ze.getSize()];
+ jar.read(bytes);
+ manifest = new Manifest(new ByteArrayInputStream(bytes));
+ }
+ }
+ if (manifest == null) {
+ manifest = new Manifest();
+ }
+
+ String bundleName = jarFile.getName();
+ boolean isImmutableJar = false;
+ for (String immutableJar : immutableJars) {
+ if (bundleName.startsWith(immutableJar)) {
+ isImmutableJar = true;
+ break;
+ }
+ }
+ Attributes attributes = manifest.getMainAttributes();
+ if (isImmutableJar)
+ attributes.putValue("Bundle-ClassPath", bundleName);
+
+
+ attributes.remove(new Attributes.Name("Require-Bundle"));
+ attributes.putValue("DynamicImport-Package", "*");
+
+ // Existing export statements in bundles may contain versions, so they should be used as is
+ // SDO exports are not sufficient, and should be changed
+ if (attributes.getValue("Export-Package") == null || bundleName.startsWith("org.apache.tuscany.sca.3rdparty.org.apache.tuscany.sdo.tuscany-sdo-impl")) {
+
+ HashSet<String> packages = getPackagesInJar(bundleName, jar);
+ String version = getJarVersion(bundleName);
+
+ attributes.putValue("Export-Package", packagesToString(packages, version));
+ attributes.putValue("Import-Package", packagesToString(packages, null));
+ }
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ manifest.write(out);
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+ out.close();
+
+ return in;
+
+ }
+
+ public Bundle createAndInstallBundle(BundleContext bundleContext,
+ String bundleLocation,
+ File bundleFile,
+ InputStream manifestStream,
+ final HashSet<File> thirdPartyJars) throws Exception {
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ Manifest manifest = new Manifest();
+ manifest.read(manifestStream);
+
+ StringBuilder bundleClassPath = new StringBuilder(".");
+ for (File jar : thirdPartyJars) {
+ bundleClassPath.append(',');
+ bundleClassPath.append(jar.getName());
+ }
+
+ if (thirdPartyJars.size() > 1)
+ manifest.getMainAttributes().putValue("Bundle-ClassPath", bundleClassPath.toString());
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ String classpath = manifest.getMainAttributes().getValue("Bundle-ClassPath");
+ boolean embed = classpath != null && !classpath.trim().equals(".");
+ for (File jarFile : thirdPartyJars) {
+ if (embed)
+ addFileToJar(jarFile, jarOut);
+ else {
+ copyJar(jarFile, jarOut);
+ }
+ }
+
+ jarOut.close();
+ out.close();
+
+ Bundle bundle;
+ if (System.getenv("TUSCANY_OSGI_DEBUG") != null) {
+ FileOutputStream fileOut = new FileOutputStream(bundleFile);
+ fileOut.write(out.toByteArray());
+ bundle = bundleContext.installBundle(bundleFile.toURL().toString());
+
+ } else {
+ ByteArrayInputStream inStream = new ByteArrayInputStream(out.toByteArray());
+ bundle = bundleContext.installBundle(bundleLocation, inStream);
+ inStream.close();
+ }
+ return bundle;
+
+ }
+
+ private void addFileToJar(File file, JarOutputStream jarOut) throws Exception {
+
+ ZipEntry ze = new ZipEntry(file.getName());
+
+ try {
+ jarOut.putNextEntry(ze);
+ FileInputStream inStream = new FileInputStream(file);
+ byte[] fileContents = new byte[inStream.available()];
+ inStream.read(fileContents);
+ jarOut.write(fileContents);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ private void copyJar(File file, JarOutputStream jarOut) throws Exception {
+
+ try {
+ JarInputStream jarIn = new JarInputStream(new FileInputStream(file));
+ ZipEntry ze;
+ byte[] readBuf = new byte[1000];
+ int bytesRead;
+ while ((ze = jarIn.getNextEntry()) != null) {
+ if (ze.getName().equals("META-INF/MANIFEST.MF"))
+ continue;
+ jarOut.putNextEntry(ze);
+ while ((bytesRead = jarIn.read(readBuf)) > 0) {
+ jarOut.write(readBuf, 0, bytesRead);
+ }
+ }
+ jarIn.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private HashSet<String> getPackagesInJar(String bundleName, JarInputStream jar) throws Exception {
+ HashSet<String> packages = new HashSet<String>();
+ ZipEntry entry;
+ while ((entry = jar.getNextEntry()) != null) {
+ String entryName = entry.getName();
+ if (!entry.isDirectory() && entryName != null && entryName.length() > 0 &&
+ !entryName.startsWith(".") && !entryName.startsWith("META-INF") &&
+ entryName.lastIndexOf("/") > 0) {
+ String pkg = entryName.substring(0, entryName.lastIndexOf("/")).replace('/', '.');
+ packages.add(pkg);
+
+ }
+ }
+ // FIXME: Split package
+ if (bundleName.startsWith("axis2-adb"))
+ packages.remove("org.apache.axis2.util");
+ else if (bundleName.startsWith("axis2-codegen")) {
+ packages.remove("org.apache.axis2.wsdl");
+ packages.remove("org.apache.axis2.wsdl.util");
+ }
+ else if (bundleName.startsWith("bsf-all"))
+ packages.remove("org.mozilla.javascript");
+
+ return packages;
+ }
+
+ private String packagesToString(HashSet<String> packages, String version) {
+
+ StringBuilder pkgBuf = new StringBuilder();
+ for (String pkg : packages) {
+ if (pkgBuf.length() >0) pkgBuf.append(',');
+ pkgBuf.append(pkg);
+ if (version != null) {
+ pkgBuf.append(";version=\"");
+ pkgBuf.append(version);
+ pkgBuf.append('\"');
+ }
+ }
+ return pkgBuf.toString();
+ }
+
+ private String getJarVersion(String bundleName) {
+ Pattern pattern = Pattern.compile("-([0-9.]+)");
+ Matcher matcher = pattern.matcher(bundleName);
+ String version = "1.0.0";
+ if (matcher.find()) {
+ version = matcher.group();
+ if (version.endsWith("."))
+ version = version.substring(1, version.length()-1);
+ else
+ version = version.substring(1);
+ }
+ return version;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-versioned/pom.xml b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-versioned/pom.xml
new file mode 100644
index 0000000000..88c5fae221
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/osgi-tuscany/tuscany-versioned/pom.xml
@@ -0,0 +1,644 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-versioned</artifactId>
+ <name>Apache Tuscany OSGi - Versioned Tuscany Bundles</name>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ <tuscany.version>${pom.version}</tuscany.version>
+
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-monitor-logging</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly</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-assembly-xsd</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ejb-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-atom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-feed</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rss</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-http-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apache-activemq</artifactId>
+ <version>4.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-console</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-optional</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-jaas</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jsp_2.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api-2.5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activesoap</groupId>
+ <artifactId>jaxp-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activemq</groupId>
+ <artifactId>jmdns</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jrms</groupId>
+ <artifactId>jrms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xmlpull</groupId>
+ <artifactId>xmlpull</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j-remote</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-notification</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-sca</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-xml</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>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-groovy</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-contribution-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-namespace</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-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-fastinfoset</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-databinding-xmlbeans</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-xstream</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-rmi</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-host-jetty</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-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-implementation-bpel</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+-->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-das</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-ejb</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-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>groovy</groupId>
+ <artifactId>groovy-all-minimal</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-widget-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-launcher</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-policy-logging</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-manager</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-xml</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-wsdl2java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1-incubating</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-tools</artifactId>
+ <version>1.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.6</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-bundle-plugin</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/pom.xml b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/pom.xml
new file mode 100644
index 0000000000..ca9257b827
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/pom.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-policy-security-basicauth</artifactId>
+ <name>Apache Tuscany SCA Policy Basic Authentication Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </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-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldClientImpl.java b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldClientImpl.java
new file mode 100644
index 0000000000..55b798edbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldClientImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldClientImpl implements HelloWorldService {
+
+ @Reference
+ protected HelloWorldService helloworldWS;
+
+ @Reference
+ protected HelloWorldService helloworldJMS;
+
+ public String getGreetings(String name) {
+ return "Hello " +
+ helloworldWS.getGreetings(name) +
+ helloworldJMS.getGreetings(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..268d90e910
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldService.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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..411dcae605
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/java/helloworld/HelloWorldServiceImpl.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 HelloWorldServiceImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..9099191b27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/definitions.xml
@@ -0,0 +1,47 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://itest/policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://itest/policy" >
+
+
+ <sca:policySet name="BasicAuthenticationPolicySet"
+ provides="authentication"
+ appliesTo="sca:binding.ws">
+
+ <tuscany:basicAuthentication>
+ <tuscany:userName>myname</tuscany:userName>
+ <tuscany:password>mypassword</tuscany:password>
+ </tuscany:basicAuthentication>
+
+ </sca:policySet>
+
+ <!-- some authentication implementation policies - may think about these later
+ <policySet name="allowed_users" appliesTo="sca:implementation.java">
+ <permitAll/>
+ </policySet>
+
+ <policySet name="runAsAdmin" appliesTo="sca:implementation.java">
+ <runAs role="Administrator"/>
+ </policySet>
+ -->
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/helloworld.composite
new file mode 100644
index 0000000000..247b2b56e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/helloworld.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"
+ targetNamespace="http://itest/policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://itest/policy"
+ name="Helloworld">
+
+ <component name="HelloWorldClientComponent">
+ <implementation.java class="helloworld.HelloWorldClientImpl" />
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.sca/>
+ </service>
+ <reference name="helloworldWS" requires="authentication">
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceWSComponent"/>
+ </reference>
+ <reference name="helloworldJMS">
+ <binding.jms uri="jms:HelloWorldService"/>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceWSComponent">
+ <implementation.java class="helloworld.HelloWorldServiceImpl" />
+ <service name="HelloWorldService" requires="authentication">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceWSComponent"/>
+ </service>
+ </component>
+
+ <component name="HelloWorldServiceJMSComponent">
+ <implementation.java class="helloworld.HelloWorldServiceImpl" />
+
+ <!--service name="HelloWorldService" requires="authentication"-->
+ <service name="HelloWorldService" >
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.jms/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/jndi.properties b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/jndi.properties
new file mode 100644
index 0000000000..9abdff215d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/main/resources/jndi.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.RequestQueue = RequestQueue
+queue.ResponseQueue = ResponseQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/test/java/org/apache/tuscany/sca/itest/BasicAuthTestCase.java b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/test/java/org/apache/tuscany/sca/itest/BasicAuthTestCase.java
new file mode 100644
index 0000000000..b6e0444d2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-basicauth/src/test/java/org/apache/tuscany/sca/itest/BasicAuthTestCase.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.itest;
+
+import java.io.ByteArrayInputStream;
+
+import junit.framework.Assert;
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.ws.security.util.Base64;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+public class BasicAuthTestCase {
+ private static SCANode node;
+ private static HelloWorldService service;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ node = factory.createSCANodeFromClassLoader("helloworld.composite",
+ BasicAuthTestCase.class.getClassLoader());
+ node.start();
+
+ service = ((SCAClient)node).getService(HelloWorldService.class, "HelloWorldClientComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ node.stop();
+ }
+
+ @Test
+ //@Ignore
+ public void testViaSCAClient() {
+ String greetings = service.getGreetings("Simon");
+ System.out.println(">>>" + greetings);
+ }
+
+ @Test
+ @Ignore
+ public void testWSViaNonSCAClient() {
+
+ try {
+ String token ="MyToken";
+ String encToken = Base64.encode(token.getBytes());
+
+ String response = callService("http://L3AW203:8085/HelloWorldServiceWSComponent",
+ "<?xml version='1.0' encoding='UTF-8'?>" +
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ "<soapenv:Header>" +
+ "<ns2:Token xmlns:ns2=\"http://helloworld/\">" + encToken + "</ns2:Token>" +
+ "</soapenv:Header>" +
+ "<soapenv:Body>" +
+ "<ns2:getGreetings xmlns:ns2=\"http://helloworld/\">" +
+ "<arg0>Simon</arg0>" +
+ "</ns2:getGreetings>" +
+ "</soapenv:Body>" +
+ "</soapenv:Envelope>" );
+ System.out.println(">>>" + response);
+ } catch(Exception ex) {
+ System.out.println(ex.toString());
+ }
+ }
+
+ @Test
+ public void testJMSViaNonSCAClient() {
+ // TODO
+ }
+
+ public String callService(String url, String requestString) throws Exception {
+ System.out.println("Request = " + requestString);
+ WebConversation wc = new WebConversation();
+ wc.setAuthorization("Me", "MyPasswd");
+ WebRequest request = new PostMethodWebRequest( url,
+ new ByteArrayInputStream(requestString.getBytes("UTF-8")),"text/xml");
+ request.setHeaderField("SOAPAction", "");
+ WebResponse response = wc.getResource(request);
+ System.out.println("Response= " + response.getText());
+ Assert.assertEquals(200, response.getResponseCode());
+ return response.getText();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/pom.xml b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/pom.xml
new file mode 100644
index 0000000000..2bb8001486
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-policy-security-jsr250</artifactId>
+ <name>Apache Tuscany SCA Policy Framework Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security-jsr250</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..3569410e7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/java/helloworld/HelloWorldImpl.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 javax.annotation.security.DenyAll;
+import javax.annotation.security.PermitAll;
+import javax.annotation.security.RunAs;
+import javax.annotation.security.RolesAllowed;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@RunAs("Administrator")
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ @DenyAll()
+ public String getGreetingsDenyAll(String name) {
+ return "Hello " + name;
+ }
+
+ @PermitAll
+ public String getGreetingsPermitAll(String name) {
+ return "Hello " + name;
+ }
+
+ @RolesAllowed("Administrator")
+ public String getGreetingsRolesAllowed(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..3e752144a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/java/helloworld/HelloWorldService.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.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+
+ public String getGreetingsRolesAllowed(String name);
+
+ public String getGreetingsPermitAll(String name);
+
+ public String getGreetingsDenyAll(String name);
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..64b8a95d18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/resources/definitions.xml
@@ -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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://itest/policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://itest/policy" >
+
+ <policySet name="allowed_users" appliesTo="sca:implementation.java">
+ <permitAll/>
+ </policySet>
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/resources/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/resources/helloworld.composite
new file mode 100644
index 0000000000..456ca450f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/main/resources/helloworld.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://itest/policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://itest/policy"
+ name="Helloworld">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" policySets="ip:allowed_users"/>
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/itest/PolicySecurityJSR250TestCase.java b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/itest/PolicySecurityJSR250TestCase.java
new file mode 100644
index 0000000000..da5f6409ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/itest/PolicySecurityJSR250TestCase.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.itest;
+
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class PolicySecurityJSR250TestCase {
+ private static SCADomain domain;
+ private static HelloWorldService service;
+
+ @Test
+ public void testPolicies() {
+ //TODO
+ String greetings = service.getGreetings("Luciano");
+ System.out.println(">>>" + greetings);
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("helloworld.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ service = domain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security/pom.xml b/sca-java-1.x/branches/sca-android/itest/policy-security/pom.xml
new file mode 100644
index 0000000000..e8100e9fa0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-policy-security</artifactId>
+ <name>Apache Tuscany SCA Policy Framework Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security/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-android/itest/policy-security/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..268d90e910
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/java/helloworld/HelloWorldService.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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..c8118a0caf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/resources/definitions.xml
@@ -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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://itest/policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://itest/policy" >
+
+ <policySet name="allowed_users" appliesTo="sca:implementation.java">
+ <permitAll/>
+ </policySet>
+
+ <policySet name="runAsAdmin" appliesTo="sca:implementation.java">
+ <runAs role="Administrator"/>
+ </policySet>
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/resources/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/resources/helloworld.composite
new file mode 100644
index 0000000000..9e0f289f87
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security/src/main/resources/helloworld.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://itest/policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://itest/policy"
+ name="Helloworld">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" policySets="ip:allowed_users"/>
+
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/policy-security/src/test/java/org/apache/tuscany/sca/itest/PolicyIdentityTestCase.java b/sca-java-1.x/branches/sca-android/itest/policy-security/src/test/java/org/apache/tuscany/sca/itest/PolicyIdentityTestCase.java
new file mode 100644
index 0000000000..9dad17741e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy-security/src/test/java/org/apache/tuscany/sca/itest/PolicyIdentityTestCase.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.itest;
+
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class PolicyIdentityTestCase {
+ private static SCADomain domain;
+ private static HelloWorldService service;
+
+ @Test
+ public void testPolicies() {
+ //TODO
+ String greetings = service.getGreetings("Luciano");
+ System.out.println(">>>" + greetings);
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("helloworld.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ service = domain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/pom.xml b/sca-java-1.x/branches/sca-android/itest/policy/pom.xml
new file mode 100644
index 0000000000..68d03d72b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-policy</artifactId>
+ <name>Apache Tuscany SCA Policy Framework Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..3e56bf3fad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/AddService.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;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+@Service
+//@Requires(PolicyQNames.TEST_INTENT_FIVE)
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..7ca8fb04b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..9abc488523
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/CalculatorClient.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 javax.security.auth.login.Configuration;
+
+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 {
+ try {
+ Configuration secConf = Configuration.getConfiguration();
+ } catch ( java.lang.SecurityException e ) {
+ if ( e.getMessage().equals("Unable to locate a login configuration") ) {
+ System.setProperty("java.security.auth.login.config", "target/classes/CalculatorJass.config");
+ } else {
+ throw e;
+ }
+ }
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+ "policy for subtract and divide operations...");
+ 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));
+
+ calculatorService =
+ scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+ "for all operations in the implementation...");
+ 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-android/itest/policy/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..a1880698ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/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-android/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..28ce0ec78a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/CalculatorServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Requires;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Requires(PolicyQNames.TEST_INTENT_ONE)
+public class CalculatorServiceImpl implements CalculatorService, PolicyQNames {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ //@Requires({TEST_INTENT_TWO, TEST_INTENT_THREE})
+ @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;
+ }
+
+ @Requires(TEST_INTENT_TWO)
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ @Requires(PolicyQNames.QUALIFIED_TEST_INTENT_ONE)
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ //@Requires(QUALIFIED_TEST_INTENT_FOUR)
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..f72b05cece
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/DivideService.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.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The divide service interface
+ */
+@Remotable
+@Service
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..1323edf55a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/DivideServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/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-android/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..91b803bc9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/MultiplyServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/PolicyQNames.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/PolicyQNames.java
new file mode 100644
index 0000000000..3e1bc45842
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/PolicyQNames.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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface PolicyQNames {
+ public static final String QUALIFIER = ".";
+
+ public static final String POLICY_ITEST_PREFIX="{http://itest/policy}";
+ public static final String TEST_INTENT_ONE = POLICY_ITEST_PREFIX + "TestIntent_1";
+ public static final String TEST_INTENT_TWO = POLICY_ITEST_PREFIX + "TestIntent_2";
+ public static final String TEST_INTENT_THREE = POLICY_ITEST_PREFIX + "TestIntent_3";
+ public static final String TEST_INTENT_FOUR = POLICY_ITEST_PREFIX + "TestIntent_4";
+ public static final String TEST_INTENT_FIVE = POLICY_ITEST_PREFIX + "TestIntent_5";
+
+ public static final String QUALIFIER_ONE = "Qualifier_1";
+
+ public static final String QUALIFIED_TEST_INTENT_FOUR =
+ TEST_INTENT_FOUR + QUALIFIER + QUALIFIER_ONE;
+
+ public static final String QUALIFIED_TEST_INTENT_ONE =
+ TEST_INTENT_ONE + QUALIFIER + QUALIFIER_ONE;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/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-android/itest/policy/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..58cc4a3547
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/SubtractServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java
new file mode 100644
index 0000000000..4b04a4d0b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.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 calculator.policy;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.junit.Assert;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestImplPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... arg0) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( Object contextObj : context) {
+ if ( contextObj instanceof Operation ) {
+ Operation op = (Operation)contextObj;
+ //System.out.println(" *TestImplPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ if ( op.getName().equals("add") ) {
+ boolean match = applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_2_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_Qualified_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_3_implementation") ;
+ Assert.assertTrue(match);
+ } else if ( op.getName().equals("subtract") ) {
+ boolean match = applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_Qualified_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_implementation");
+ Assert.assertTrue(match);
+ } else if ( op.getName().equals("divide")) {
+ Assert.assertEquals(applicablePolicySet.getName().getLocalPart(),
+ "TestPolicySet_1_implementation");
+ } else if ( op.getName().equals("multiply") ) {
+ boolean match = applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_5_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_implementation");
+ Assert.assertTrue(match);
+ }
+ else {
+ Assert.fail();
+ }
+ //System.out.println(" *TestImplPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ } else if ( contextObj instanceof Message ) {
+ Message msg = (Message)contextObj;
+ System.out.println(" *TestImplPolicyHandler* " + msg.getOperation().getName() + " ** " + applicablePolicySet);
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet arg0) {
+ this.applicablePolicySet = arg0;
+ }
+
+ public void setUp(Object... arg0) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java
new file mode 100644
index 0000000000..3dcadd724e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.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 calculator.policy;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestRefPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... arg0) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( Object contextObj : context) {
+ if ( contextObj instanceof Operation ) {
+ Operation op = (Operation)contextObj;
+ System.out.println(" *TestReflPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ } else if ( contextObj instanceof Message ) {
+ Message msg = (Message)contextObj;
+ System.out.println(" *TestRefPolicyHandler* " + msg.getOperation().getName() + " ** " + applicablePolicySet);
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet arg0) {
+ this.applicablePolicySet = arg0;
+ }
+
+ public void setUp(Object... arg0) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java
new file mode 100644
index 0000000000..3d314a9d14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.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 calculator.policy;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestSvcPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... arg0) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( Object contextObj : context) {
+ if ( contextObj instanceof Operation ) {
+ Operation op = (Operation)contextObj;
+ System.out.println(" *TestSvcPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ } else if ( contextObj instanceof Message ) {
+ Message msg = (Message)contextObj;
+ System.out.println(" *TestSvcPolicyHandler* " + msg.getOperation().getName() + " ** " + applicablePolicySet);
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet arg0) {
+ this.applicablePolicySet = arg0;
+ }
+
+ public void setUp(Object... arg0) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..aed7684099
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/Calculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://itest/policy" xmlns:sample="http://itest/policy" name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://itest/policy">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"></implementation.java>
+ <!-- reference name="addService" target="AddServiceComponent" /-->
+ <reference name="addService">
+ <interface.java interface="calculator.AddService" />
+ <binding.ws uri="http://localhost:8085/AddServiceComponentWS" />
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl" requires="ip:TestIntent_3" />
+ <service name="AddService">
+ <interface.java interface="calculator.AddService" />
+ <binding.ws uri="http://localhost:8085/AddServiceComponentWS" />
+ <binding.sca/>
+ </service>
+ </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>
+
+ <component name="AnotherCalculatorServiceComponent">
+ <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>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..a20489035b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+org.apache.tuscany.sca.itest.TestPolicyProcessor;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#Policy,model=org.apache.tuscany.sca.itest.Policy
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..d9f144b3ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
@@ -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.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;qname=<policy intent addressed>;model=<policy model class>
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_1,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestRefPolicyHandler;intent=http://itest/policy#TestIntent_1,model=org.apache.neethi.Policy,appliesTo=sca:reference
+calculator.policy.TestSvcPolicyHandler;intent=http://itest/policy#TestIntent_1,model=org.apache.neethi.Policy,appliesTo=sca:service
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_1.Qualifier_1,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_2,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestRefPolicyHandler;intent=http://itest/policy#TestIntent_2,model=org.apache.neethi.Policy,appliesTo=sca:reference
+calculator.policy.TestSvcPolicyHandler;intent=http://itest/policy#TestIntent_2,model=org.apache.neethi.Policy,appliesTo=sca:service
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_3,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_5,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..0009d712f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/main/resources/definitions.xml
@@ -0,0 +1,147 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://itest/policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:calc="http://calculator"
+ xmlns:ip="http://itest/policy" >
+
+ <!-- Policy Intents -->
+ <sca:intent name="TestIntent_1" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent One</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_2" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent Two</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_3" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent Three</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_4" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent Four</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_5" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent Five</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_1.Qualifier_1" />
+ <sca:intent name="TestIntent_4.Qualifier_1" />
+
+ <!-- PolicySets -->
+ <sca:policySet name="TestPolicySet_1_implementation" provides="ip:TestIntent_1"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="ip:TestIntent_1" default="Qualifier_1">
+ <qualifier name="Qualifier_1">
+ <wsp:Policy />
+ </qualifier>
+ </intentMap>
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_1_Qualified_implementation" provides="ip:TestIntent_1.Qualifier_1"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_1_reference" provides="ip:TestIntent_1" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_1_service" provides="ip:TestIntent_1" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:intent name="TestIntent_4.Qualifier_1" />
+
+ <sca:policySet name="TestPolicySet_2_implementation" provides="ip:TestIntent_2"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_2_reference" provides="ip:TestIntent_2" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_2_service" provides="ip:TestIntent_2" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+
+ <sca:policySet name="TestPolicySet_3_implementation" provides="ip:TestIntent_3"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_3_reference" provides="ip:TestIntent_3" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_3_service" provides="ip:TestIntent_3" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_4_implementation" provides="ip:TestIntent_4"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_4_service" provides="ip:TestIntent_4" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_4_reference" provides="ip:TestIntent_4" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_5_implementation" provides="" appliesTo="sca:implementation.java"
+ tuscany:alwaysAppliesTo="sca:component[@name='MultiplyServiceComponent']"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_5_service" provides="ip:TestIntent_5" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_5_reference" provides="ip:TestIntent_5" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_4_qualified_1_implementation" provides="ip:TestIntent_4"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="ip:TestIntent_4" default="Qualifier_1">
+ <qualifier name="Qualifier_1">
+ <wsp:Policy />
+ </qualifier>
+ </intentMap>
+ </sca:policySet>
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java b/sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java
new file mode 100644
index 0000000000..885e8314ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.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.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.CalculatorService;
+
+public class PoliciedCalculatorTestCase {
+ private static SCADomain domain;
+ private static CalculatorService calculatorService;
+
+ @Test
+ public void testPolicies() {
+ calculatorService.add(10, 10);
+ calculatorService.multiply(10, 10);
+ calculatorService.divide(10, 10);
+ calculatorService.subtract(10, 10);
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("Calculator.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/Policy.java b/sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/Policy.java
new file mode 100644
index 0000000000..ba17755b88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/Policy.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 javax.xml.namespace.QName;
+
+/**
+ * Interface that will abstract various types of policy specifications
+ * and attachments for example WS-Policy
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Policy {
+ QName getSchemaName();
+ void setUnresolved(boolean unresolved);
+ boolean isUnresolved();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/TestPolicyProcessor.java b/sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/TestPolicyProcessor.java
new file mode 100644
index 0000000000..ff47988bce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/policy/src/test/java/org/apache/tuscany/sca/itest/TestPolicyProcessor.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.itest;
+
+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.ModelFactoryExtensionPoint;
+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.monitor.Monitor;
+import org.apache.tuscany.sca.policy.Policy;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * A PolicyProcessor used for testing.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestPolicyProcessor implements StAXArtifactProcessor<Policy> {
+
+ public TestPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+
+ }
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "Policy");
+ }
+
+ public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
+ return new MockPolicyImplOne();
+ }
+
+ public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<Policy> getModelType() {
+ // TODO Auto-generated method stub
+ return Policy.class;
+ }
+
+ public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+
+ public class MockPolicyImplOne implements Policy {
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "Policy");
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/pom.xml b/sca-java-1.x/branches/sca-android/itest/pom.xml
new file mode 100644
index 0000000000..f18ce5f455
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/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-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Integration Tests</name>
+
+ <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>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/pom.xml b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/pom.xml
new file mode 100644
index 0000000000..0b3c3cf0c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-promotion-interface-missmatch</artifactId>
+ <name>Apache Tuscany Test for Missmatched Interfaces During Promotion</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/BusinessException.java b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/BusinessException.java
new file mode 100644
index 0000000000..764f31b7cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/BusinessException.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 com.example;
+
+public class BusinessException extends Exception {
+
+ private String clientName;
+
+ public BusinessException(String message) {
+ super(message);
+ }
+
+ public BusinessException(String message, String clientName) {
+ super(message);
+ this.clientName = clientName;
+ }
+
+ public String getClientName() {
+ return clientName;
+ }
+
+ public void setClientName(String clientName) {
+ this.clientName = clientName;
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleClient.java b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleClient.java
new file mode 100644
index 0000000000..0c72b52ed9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleClient.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 com.example;
+
+public interface ExampleClient {
+ void runTest();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleClientImpl.java b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleClientImpl.java
new file mode 100644
index 0000000000..d6545b5a23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleClientImpl.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 com.example;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ExampleClient.class)
+@Scope("COMPOSITE")
+public class ExampleClientImpl implements ExampleClient {
+
+ private ExampleService myService;
+
+ @Reference
+ public void setMyService(ExampleService myService) {
+ this.myService = myService;
+ }
+
+ public void runTest() {
+ try {
+ Object result = myService.hello("John");
+ System.out.println("myService returned " + result.getClass().getName());
+ } catch (BusinessException e) {
+ System.out.println("caught exception from hello(): " + e.getMessage() + " for " + e.getClientName());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleService.java b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleService.java
new file mode 100644
index 0000000000..30ea559694
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleService.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 com.example;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExampleService {
+
+ String hello(String name) throws BusinessException;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleServiceImpl.java
new file mode 100644
index 0000000000..b3b6f033e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/java/com/example/ExampleServiceImpl.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 com.example;
+
+public class ExampleServiceImpl implements ExampleService {
+ public String hello(String name) throws BusinessException {
+ throw new BusinessException("bad news", name);
+ // return "Hello, " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/example.composite b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/example.composite
new file mode 100644
index 0000000000..cddf951d65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/example.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"
+ targetNamespace="/model/common/"
+ xmlns:hw="/model/common/"
+ name="example">
+
+ <component name="ExampleClientComponent">
+ <implementation.java class="com.example.ExampleClientImpl" />
+ <reference name="myService" />
+ </component>
+
+ <reference name="myService"
+ promote="ExampleClientComponent/myService">
+ <!--
+ The following interface definition violates the SCA specification because it
+ uses has a different namespace ("/model/common/") than the namespace of the
+ implicit interface.java on the promoted coponent service ("http://example.com").
+ The runtime should report an error for this mismatch.
+ -->
+ <interface.wsdl interface="/model/common/#wsdl.interface(ExampleServicePortType)" />
+ <binding.ws uri="http://localhost:8085/axis2/services/ExampleService" />
+ </reference>
+
+ <component name="ExampleComponent">
+ <implementation.java class="com.example.ExampleServiceImpl"/>
+ <service name="ExampleService">
+ <interface.wsdl interface="/model/common/#wsdl.interface(ExampleServicePortType)" />
+ <binding.ws wsdlElement="/model/common/#wsdl.binding(ExampleServiceSOAP11Binding)"
+ uri="http://localhost:8085/axis2/services/ExampleService" />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/wsdl/ExampleService.wsdl b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/wsdl/ExampleService.wsdl
new file mode 100644
index 0000000000..a8ccde2e11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/wsdl/ExampleService.wsdl
@@ -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.
+-->
+<!--definitions
+ name="EmpFlexFieldService"
+ targetNamespace="/model/common/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="/model/common/"
+ xmlns:errors="http://xmlns.oracle.com/adf/svc/errors/"
+ xmlns:types="/model/common/types/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ -->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:ns0="http://example.com"
+ xmlns:ns2="/model/common/types/"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns1="http://example.com/xsd"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ targetNamespace="/model/common/"
+ xmlns:tns="/model/common/">
+ <wsdl:types>
+ <xs:schema>
+ <import namespace="/model/common/types/" schemaLocation="ExampleServiceTypes.xsd"/>
+ </xs:schema>
+ <xs:schema xmlns:ns="http://example.com" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com">
+ <xs:element name="BusinessException">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="BusinessException" nillable="true" type="ns1:BusinessException"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ <xs:schema xmlns:ax21="http://example.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com/xsd">
+ <xs:complexType name="BusinessException">
+ <xs:complexContent>
+ <xs:extension base="tns:Exception">
+ <xs:sequence/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="helloRequest">
+ <wsdl:part name="parameters" element="ns2:hello"/>
+ </wsdl:message>
+ <wsdl:message name="helloResponse">
+ <wsdl:part name="parameters" element="ns2:helloResponse"/>
+ </wsdl:message>
+ <wsdl:message name="BusinessException">
+ <wsdl:part name="parameters" element="ns0:BusinessException"/>
+ </wsdl:message>
+ <wsdl:portType name="ExampleServicePortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:helloRequest" wsaw:Action="urn:hello"/>
+ <wsdl:output message="tns:helloResponse" wsaw:Action="urn:helloResponse"/>
+ <wsdl:fault message="tns:BusinessException" name="BusinessException" wsaw:Action="urn:helloBusinessException"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="ExampleServiceSOAP11Binding" type="tns:ExampleServicePortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="urn:hello" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="BusinessException">
+ <soap:fault use="literal" name="BusinessException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ExampleServiceSOAP12Binding" type="tns:ExampleServicePortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="hello">
+ <soap12:operation soapAction="urn:hello" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="BusinessException">
+ <soap12:fault use="literal" name="BusinessException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ExampleServiceHttpBinding" type="tns:ExampleServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="hello">
+ <http:operation location="ExampleService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ExampleService">
+ <wsdl:port name="ExampleServiceSOAP11port_http" binding="tns:ExampleServiceSOAP11Binding">
+ <soap:address location="http://localhost:8085/axis2/services/ExampleService"/>
+ </wsdl:port>
+ <wsdl:port name="ExampleServiceSOAP12port_http" binding="tns:ExampleServiceSOAP12Binding">
+ <soap12:address location="http://localhost:8085/axis2/services/ExampleService"/>
+ </wsdl:port>
+ <wsdl:port name="ExampleServiceHttpport" binding="tns:ExampleServiceHttpBinding">
+ <http:address location="http://localhost:8085/axis2/services/ExampleService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/wsdl/ExampleServiceTypes.xsd b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/wsdl/ExampleServiceTypes.xsd
new file mode 100644
index 0000000000..2caec0f20d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/main/resources/wsdl/ExampleServiceTypes.xsd
@@ -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.
+-->
+
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="/model/common/"
+ attributeFormDefault="qualified"
+ elementFormDefault="qualified"
+ xmlns:tns="/model/common/types/"
+ targetNamespace="/model/common/types/">
+ <xs:complexType name="Exception">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="Exception" nillable="true" type="xs:anyType"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="hello">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="helloResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
diff --git a/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/test/java/com/example/ExampleTestCase.java b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/test/java/com/example/ExampleTestCase.java
new file mode 100644
index 0000000000..740af4f43d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/promotion-interface-missmatch/src/test/java/com/example/ExampleTestCase.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 com.example;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExampleTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private ExampleClient client;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("example.composite");
+ client = scaDomain.getService(ExampleClient.class, "ExampleClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ client.runTest();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/pom.xml b/sca-java-1.x/branches/sca-android/itest/properties/pom.xml
new file mode 100644
index 0000000000..62a50f1f54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-properties</artifactId>
+ <name>Apache Tuscany SCA Properties Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <id>generate-customer-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/customer.xsd</schemaFile>
+ <javaPackage>com.example.customer.sdo</javaPackage>
+ <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-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java
new file mode 100644
index 0000000000..b0fd64c9da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.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 mysca.test.myservice.impl;
+
+public interface MyService {
+ /**
+ * This is a method to get the location property value from the sca runtime environment. It is implemented in the
+ * class MyServiceImpl
+ */
+ String getLocation();
+
+ /**
+ * This is a method to get the year property value from the sca runtime environment. It is implemented in the class
+ * MyServiceImpl
+ */
+ String getYear();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java
new file mode 100644
index 0000000000..51d064ba81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.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 mysca.test.myservice.impl;
+
+import java.util.logging.Logger;
+
+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;
+
+/**
+ * This class Implements the interface MyService and gives implementation for all methods which are declared in that
+ * interface. scope is specified as Composite using
+ *
+ * @scope annotation.
+ */
+
+@Service(MyService.class)
+public class MyServiceImpl implements MyService {
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ @ComponentName
+ protected String componentName;
+
+ private Logger logger;
+
+ /**
+ * @ to print the message in the log
+ */
+ public MyServiceImpl() {
+ logger = Logger.getAnonymousLogger();
+ logger.info("creating service instance...");
+ }
+
+ /**
+ * @Init annotation to Start the service. Which is executed all the time
+ */
+ @Init
+ public void start() {
+ logger.info("Start service..");
+ }
+
+ /**
+ * @Destroy annotation to stop the service. Which is executed in the end
+ */
+ @Destroy
+ public void stop() {
+ logger.info("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-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java
new file mode 100644
index 0000000000..38c26e70d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.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 mysca.test.myservice.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class Implements the interface MyService and gives implementation for all methods which are declared in that
+ * interface. scope is specified as Composite using
+ *
+ * @scope annotation.
+ */
+
+@Service(MyService.class)
+public class MyTotalServiceImpl implements MyService {
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyService myService;
+
+ public String getLocation() {
+ return myService.getLocation();
+ }
+
+ public String getYear() {
+ return myService.getYear();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java
new file mode 100644
index 0000000000..68ce5a3cb6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest;
+
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in ABCDComponentImpl Class
+ */
+public interface ABCDComponent {
+
+ /**
+ * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class
+ * ABCDComponentImpl
+ */
+ String getA();
+
+ /**
+ * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class
+ * ABCDComponentImpl
+ */
+ String getB();
+
+ /**
+ * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class
+ * ABCDComponentImpl
+ */
+ String getC();
+
+ /**
+ * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class
+ * ABCDComponentImpl
+ */
+ String getD();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java
new file mode 100644
index 0000000000..6b714c0d67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.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.itest;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * This class Implements the interface ABCDComponent and gives implementation for all methods which are declared in that
+ * interface. scope is specified as Composite using
+ *
+ * @scope annotation.
+ */
+@Scope("COMPOSITE")
+public class ABCDComponentImpl implements ABCDComponent {
+ private ABComponent abComponent;
+ private CDComponent cdComponent;
+
+ /**
+ * It is a method which injects the property value to the variable 'abComponent' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Reference
+ public void setAb(ABComponent component) {
+ this.abComponent = component;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'cdComponent' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @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-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java
new file mode 100644
index 0000000000..586d4864a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in ABComponentImpl Class
+ */
+@Remotable
+public interface ABComponent {
+
+ /**
+ * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class
+ * ABComponentImpl
+ */
+
+ String getA();
+
+ /**
+ * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class
+ * ABComponentImpl
+ */
+ String getB();
+
+ /**
+ * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class
+ * ABComponentImpl
+ */
+ String getZ();
+
+ /**
+ * This is a method to get an integer property value from the SCA runtime environment. It is implemented in the
+ * class ABComponentImpl
+ */
+ int getIntValue();
+
+ /**
+ * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class
+ * ABComponentImpl
+ */
+ String getF();
+
+ /**
+ * This is a method to get collection of property values from the SCA runtime environment. It is implemented in the
+ * class ABComponentImpl
+ */
+ Collection<String> getManyStringValues();
+
+ /**
+ * This is a method to get collection of property value from the SCA runtime environment. It is implemented in the
+ * class ABComponentImpl
+ */
+ Collection<Integer> getManyIntegers();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java
new file mode 100644
index 0000000000..5e3c985144
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * This class Implements the interface ABComponent and gives implementation for all methods which are declared in that
+ * interface.
+ */
+
+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;
+
+ /**
+ * It is a method which injects the property value to the variable 'zProperty' from the SCA runtime environment
+ * using Annotations.
+ */
+ @Property(name = "xpath")
+ public void setZProperty(final String value) {
+ this.zProperty = value;
+ }
+
+ /**
+ * It is a method which injects collection of property values to the variable 'manyStringValues' from the SCA
+ * runtime environment using Annotations.
+ */
+ @Property(name = "foobar")
+ public void setManyStringValues(final Collection<String> value) {
+ this.manyStringValues = value;
+ }
+
+ /**
+ * It is a method which injects collection of integer property values to the variable 'manyIntegerValues' from the
+ * SCA runtime environment using Annotations.
+ */
+ @Property(name = "fooInts")
+ public void setManyIntegers(final Collection<Integer> value) {
+ this.manyIntegerValues = value;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'aProperty' from the SCA runtime environment
+ * using Annotations.
+ */
+ @Property
+ public void setA(final String A) {
+ this.aProperty = A;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'bProperty' from the SCA runtime environment
+ * using Annotations.
+ */
+ @Property
+ public void setB(final String B) {
+ this.bProperty = B;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'fProperty' from the SCA runtime environment
+ * using Annotations.
+ */
+ @Property
+ public void setF(final String F) {
+ this.fProperty = F;
+ }
+
+ /**
+ * It is a method which injects integer property value to the variable 'intValue' from the SCA runtime environment
+ * using Annotations.
+ */
+ @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-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java
new file mode 100644
index 0000000000..52f9871d1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.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.itest;
+
+import java.util.Collection;
+
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in CDComponentImpl Class
+ */
+public interface CDComponent {
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getC();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getC2();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getD();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getNoSource();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getFileProperty();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ Collection<String> getManyValuesFileProperty();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ int getOverrideValue();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java
new file mode 100644
index 0000000000..5b93bd8b8a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.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.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * This class Implements the interface CDComponent and gives implementation for all methods which are declared in that
+ * interface.
+ */
+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;
+
+ /**
+ * It is a method which injects the property value to the variable 'cProperty2' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property(name = "nonFileProperty")
+ public void setC2(final String value) {
+ this.cProperty2 = value;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'overrideNumber' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property(name = "two")
+ public void setOverrideNumber(final int value) {
+ this.overrideNumber = value;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'fileProperty' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property(name = "fileProperty")
+ public void setFileProp(final String value) {
+ this.fileProperty = value;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'manyValuesFileProperty' from the SCA runtime
+ * environment using
+ *
+ * @Property Annotations.
+ */
+ @Property(name = "manyValuesFileProperty")
+ public void setFileManyValueProp(final Collection<String> values) {
+ this.manyValuesFileProperty = values;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'cProperty' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property
+ public void setC(final String C) {
+ this.cProperty = C;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'dProperty' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property
+ public void setD(final String D) {
+ this.dProperty = D;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'nosource' from the SCA runtime environment using
+ *
+ * @Property Annotations.
+ */
+ @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-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java
new file mode 100644
index 0000000000..c0c068d12e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.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.itest;
+
+/**
+ * This is a Java Bean which has setter and getter methods for for the variables used in the property tests.
+ */
+public class ComplexPropertyBean {
+
+ /**
+ * Variable declarations
+ */
+ protected int integerNumber = 25;
+ protected float floatNumber = 50;
+ protected double doubleNumber = 75;
+ protected int[] intArray = null;
+ protected double[] doubleArray = null;
+ protected String[] stringArray = null;
+
+ ComplexPropertyBean numberSet;
+ protected ComplexPropertyBean[] numberSetArray = null;
+
+ public ComplexPropertyBean() {
+
+ }
+
+ public double getDoubleNumber() {
+ return doubleNumber;
+ }
+
+ /**
+ * It is a setter method to set a value for the variable doubleNumber
+ */
+ public void setDoubleNumber(double doubleNumber) {
+ this.doubleNumber = doubleNumber;
+ }
+
+ /**
+ * It is a getter method to get a value for the variable floatNumber
+ */
+ public float getFloatNumber() {
+ return floatNumber;
+ }
+
+ /**
+ * It is a setter method to set a value for the variable floatNumber
+ */
+ public void setFloatNumber(float floatNumber) {
+ this.floatNumber = floatNumber;
+ }
+
+ /**
+ * It is a getter method to get a value for the variable floatNumber
+ */
+ public int getIntegerNumber() {
+ return integerNumber;
+ }
+
+ /**
+ * It is a getter method to get a value for the variable integerNumber
+ */
+ public void setIntegerNumber(int integerNumber) {
+ this.integerNumber = integerNumber;
+ }
+
+ /**
+ * It is a getter method to set a value for the variable numberSet
+ */
+ public ComplexPropertyBean getNumberSet() {
+ return numberSet;
+ }
+
+ /**
+ * It is a setter method to set a value for the variable numberSet
+ */
+ public void setNumberSet(ComplexPropertyBean numberSet) {
+ this.numberSet = numberSet;
+ }
+
+ /**
+ * It is a method which implements toString() function
+ */
+ @Override
+ 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());
+ }
+
+ /**
+ * It is a setter method to set values for the variable stringArray
+ */
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ /**
+ * It is a setter method to set values for the variable stringArray
+ */
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+
+ public int[] getIntArray() {
+ return intArray;
+ }
+
+ public void setIntArray(int[] intArray) {
+ this.intArray = intArray;
+ }
+
+ public double[] getDoubleArray() {
+ return doubleArray;
+ }
+
+ public void setDoubleArray(double[] doubleArray) {
+ this.doubleArray = doubleArray;
+ }
+
+ public ComplexPropertyBean[] getNumberSetArray() {
+ return numberSetArray;
+ }
+
+ public void setNumberSetArray(ComplexPropertyBean[] numberSetArray) {
+ this.numberSetArray = numberSetArray;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java
new file mode 100644
index 0000000000..acd1f26670
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.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;
+
+/**
+ * This is an Interface for the services
+ */
+public interface OverrideService {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java
new file mode 100644
index 0000000000..71dce41efc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.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;
+
+/**
+ * An implementation for the interface OverrideService.
+ */
+
+public class OverrideServiceImpl implements OverrideService {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
new file mode 100644
index 0000000000..17b4e582d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.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.itest;
+
+import java.util.Collection;
+
+import commonj.sdo.DataObject;
+
+import test.jaxb.props.ReturnCodeProperties;
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in PropertyComponentImpl Class
+ */
+public interface PropertyComponent {
+
+ /**
+ * This is a method to get a value for a property name 'location' from the SCA runtime environment. It is
+ * implemented in the class PropertyComponentImpl
+ */
+ public String getLocation();
+
+ /**
+ * This is a method to get a value for a property name 'year' from the SCA runtime environment. It is implemented in
+ * the class PropertyComponentImpl
+ */
+ public String getYear();
+
+ /**
+ * This method is used to test injecting a primitive String Array
+ *
+ * @return The injected array
+ */
+ public String[] getDaysOfTheWeek();
+
+ /**
+ * This method is used to test injecting an Object Integer Array
+ *
+ * @return The injected array
+ */
+ public Integer[] getIntegerNumbers();
+
+ /**
+ * This method is used to test injecting an int Array
+ *
+ * @return The injected array
+ */
+ public int[] getIntNumbers();
+
+ /**
+ * This method is used to test injecting an Object Array
+ *
+ * @return The injected array
+ */
+ public DataObject[] getSdoArrayProperty();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+
+ public ComplexPropertyBean getComplexPropertyOne();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public ComplexPropertyBean getComplexPropertyTwo();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public ComplexPropertyBean getComplexPropertyThree();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public Collection<ComplexPropertyBean> getComplexPropertyFour();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+
+ public ComplexPropertyBean getComplexPropertyFive();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public DataObject getSdoProperty();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public DataObject getCustomerSdo();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public ReturnCodeProperties getComplexJAXBPropertyOne();
+
+ /**
+ * This is a method to get a property value from the SCA runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public ReturnCodeProperties getComplexJAXBPropertyTwo();
+
+ /**
+ * @return
+ */
+ public String getLocationFromComponentContext();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
new file mode 100644
index 0000000000..eb642b6637
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.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.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Property;
+
+import com.example.customer.sdo.impl.CustomerImpl;
+import commonj.sdo.DataObject;
+
+import test.jaxb.props.ReturnCodeProperties;
+
+/**
+ * This class Implements the interface PropertyComponent and gives implementation for all methods which are declared in
+ * that interface.
+ */
+public class PropertyComponentImpl implements PropertyComponent {
+ @Context
+ protected ComponentContext context;
+
+ @Property
+ protected CustomerImpl customerSdo;
+
+ @Property
+ protected DataObject sdoProperty;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyOne;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyTwo;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyThree;
+
+ @Property
+ protected Collection<ComplexPropertyBean> complexPropertyFour;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyFive;
+
+ @Property(name = "location")
+ protected String location;
+
+ @Property(name = "year")
+ protected String year;
+
+ @Property(name = "daysOfTheWeek")
+ protected String[] daysOfTheWeek;
+
+ @Property(name = "integerNumbers")
+ protected Integer[] integerNumbers;
+
+ @Property(name = "intNumbers")
+ protected int[] intNumbers;
+
+ @Property(name = "sdoArray")
+ protected DataObject[] sdoArray;
+
+ @Property
+ protected ReturnCodeProperties complexJAXBPropertyOne;
+
+ @Property
+ protected ReturnCodeProperties complexJAXBPropertyTwo;
+
+ 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;
+ }
+
+ public ComplexPropertyBean getComplexPropertyFive() {
+ return complexPropertyFive;
+ }
+
+ public DataObject getSdoProperty() {
+ return sdoProperty;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'sdoProperty' from the SCA runtime environment.
+ */
+ public void setSdoProperty(DataObject sdoProperty) {
+ System.out.println("Reached here da machi");
+ this.sdoProperty = sdoProperty;
+ }
+
+ public CustomerImpl getCustomerSdo() {
+ return customerSdo;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'customerSdo' from the SCA runtime environment.
+ */
+ public void setCustomerSdo(CustomerImpl customerSdo) {
+ this.customerSdo = customerSdo;
+ }
+
+ /**
+ * This method is used to test injecting an Array
+ *
+ * @return The injected array
+ */
+ public String[] getDaysOfTheWeek() {
+ return daysOfTheWeek;
+ }
+
+ /**
+ * This method is used to test injecting an Object Integer Array
+ *
+ * @return The injected array
+ */
+ public Integer[] getIntegerNumbers() {
+ return integerNumbers;
+ }
+
+ /**
+ * This method is used to test injecting an int Array
+ *
+ * @return The injected array
+ */
+ public int[] getIntNumbers() {
+ return intNumbers;
+ }
+
+ /**
+ * This method is used to test injecting an Object Array
+ *
+ * @return The injected array
+ */
+ public DataObject[] getSdoArrayProperty() {
+ return sdoArray;
+ }
+
+ public String getLocationFromComponentContext() {
+ return context.getProperty(String.class, "location");
+ }
+
+ public ReturnCodeProperties getComplexJAXBPropertyOne() {
+ return complexJAXBPropertyOne;
+ }
+
+ public ReturnCodeProperties getComplexJAXBPropertyTwo() {
+ return complexJAXBPropertyTwo;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java
new file mode 100644
index 0000000000..a57ccd90c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.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;
+
+/**
+ * This is an Interface for the services.
+ */
+public interface PropertyService {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java
new file mode 100644
index 0000000000..c147a2affe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.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.itest.cdi;
+
+public interface Bar {
+ public String getBar();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java
new file mode 100644
index 0000000000..0a84e93828
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.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.cdi;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+@Service(Bar.class)
+public class Foo1 implements Bar {
+
+ @Property
+ protected String bar;
+
+ @Constructor( {"bar"})
+ public Foo1(String b) {
+ this.bar = b;
+ }
+
+ public String getBar() {
+ return this.bar;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java
new file mode 100644
index 0000000000..6344a8aa83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.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.cdi;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+@Service(Bar.class)
+public class Foo2 implements Bar {
+
+ protected String bar;
+
+ @Constructor
+ public Foo2(@Property(name = "bar") String b) {
+ this.bar = b;
+ }
+
+ public String getBar() {
+ return this.bar;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java
new file mode 100644
index 0000000000..11a0a758cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.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.itest.cdi;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+@Service(Bar.class)
+public class Foo3 implements Bar {
+
+ protected String bar;
+
+ @Constructor
+ public Foo3() {
+ this.bar = "bar";
+ }
+
+ public String getBar() {
+ return this.bar;
+ }
+
+ @Property(name = "bar")
+ public void setBar(String b) {
+ this.bar = b;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java
new file mode 100644
index 0000000000..76bcd06fca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.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.
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.06.07 at 03:30:47 PM EDT
+//
+
+
+package test.jaxb.props;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the test.jaxb.props package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _MyRCProps_QNAME = new QName("http://test.sca.jaxb/rcprops", "MyRCProps");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: test.jaxb.props
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link ReturnCodeProperties }
+ *
+ */
+ public ReturnCodeProperties createReturnCodeProperties() {
+ return new ReturnCodeProperties();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ReturnCodeProperties }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://test.sca.jaxb/rcprops", name = "MyRCProps")
+ public JAXBElement<ReturnCodeProperties> createMyRCProps(ReturnCodeProperties value) {
+ return new JAXBElement<ReturnCodeProperties>(_MyRCProps_QNAME, ReturnCodeProperties.class, null, value);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java
new file mode 100644
index 0000000000..7a809ebf1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.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.
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.06.07 at 03:30:47 PM EDT
+//
+
+
+package test.jaxb.props;
+
+import java.math.BigInteger;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ReturnCodeProperties complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="ReturnCodeProperties">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="AInt" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ * &lt;element name="BInteger" type="{http://www.w3.org/2001/XMLSchema}integer"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ReturnCodeProperties", namespace = "http://test.sca.jaxb/rcprops", propOrder = {
+ "a",
+ "b"
+})
+public class ReturnCodeProperties {
+
+ @XmlElement(name = "AInt")
+ protected int a;
+ @XmlElement(name = "BInteger", required = true)
+ protected BigInteger b;
+
+ /**
+ * Gets the value of the a property.
+ *
+ */
+ public int getA() {
+ return a;
+ }
+
+ /**
+ * Sets the value of the a property.
+ *
+ */
+ public void setA(int value) {
+ this.a = value;
+ }
+
+ /**
+ * Gets the value of the b property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getB() {
+ return b;
+ }
+
+ /**
+ * Sets the value of the b property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setB(BigInteger value) {
+ this.b = value;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/package-info.java b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/package-info.java
new file mode 100644
index 0000000000..f726552a62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/java/test/jaxb/props/package-info.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.
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.06.07 at 03:30:47 PM EDT
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://test.sca.jaxb/rcprops", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package test.jaxb.props;
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/ConstructorPropertyInjection.composite b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/ConstructorPropertyInjection.composite
new file mode 100644
index 0000000000..70a251fa16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/ConstructorPropertyInjection.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"
+ name="ConstructorPropertyInjection">
+
+ <component name="Foo1Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.cdi.Foo1" />
+ <property name="bar">fubar</property>
+ </component>
+
+ <component name="Foo2Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.cdi.Foo2" />
+ <property name="bar">fubar</property>
+ </component>
+
+ <component name="Foo3Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.cdi.Foo3" />
+ <property name="bar">fubar</property>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/Outer.composite b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/Outer.composite
new file mode 100644
index 0000000000..b3e529e8b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/Outer.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0" name="Iteration3Composite"
+ targetNamespace="http://foo" local="true" autowire="false">
+
+ <property name="newLocation" type="xsd:anyURI">Raleigh</property>
+ <property name="newYear" type="xsd:anyURI">2008</property>
+ <component name="MyServiceComponent">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ </component>
+ <component name="MyServiceComponentNew">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ <property name="location" source="$newLocation" />
+ <property name="year" source="$newYear" />
+ </component>
+ <component name="MyTotalServiceNewComponent">
+ <implementation.java class="mysca.test.myservice.impl.MyTotalServiceImpl" />
+ <reference name="myService" target="MyServiceComponentNew/MyService" />
+ </component>
+ <component name="MySimpleServiceInRecursiveAnother">
+ <implementation.composite name="foo:MySimpleService" />
+ <property name="newLocation">Durham</property>
+ <property name="newYear">2009</property>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/OuterPropertyTest.composite b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/OuterPropertyTest.composite
new file mode 100644
index 0000000000..5237e964a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/OuterPropertyTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-android/itest/properties/src/main/resources/PropertyTest.composite b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/PropertyTest.composite
new file mode 100644
index 0000000000..75deddbdad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/PropertyTest.composite
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed 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"
+ xmlns:cust="http://www.example.com/Customer"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:rcp="http://test.sca.jaxb/rcprops"
+ 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>
+
+ <dbsdo:import.sdo location="customer.xsd" />
+ <!-- dbsdo:import.sdo factory="com.example.customer.sdo.SdoFactory" / -->
+
+ <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">
+ <MyMoreComplexValue xmlns="">
+ <numberSetArray>
+ <integerNumber>1</integerNumber>
+ <floatNumber>11</floatNumber>
+ <doubleNumber>111</doubleNumber>
+ </numberSetArray>
+ <numberSetArray>
+ <integerNumber>2</integerNumber>
+ <floatNumber>22</floatNumber>
+ <doubleNumber>222</doubleNumber>
+ </numberSetArray>
+ <stringArray>TestString_1</stringArray>
+ <stringArray>TestString_2</stringArray>
+ <intArray>10</intArray>
+ <intArray>20</intArray>
+ <integerNumber>27</integerNumber>
+ <floatNumber>79.34</floatNumber>
+ <doubleNumber>184.52</doubleNumber>
+ <doubleArray>50.05</doubleArray>
+ <doubleArray>25.52</doubleArray>
+ <numberSet>
+ <integerNumber>54</integerNumber>
+ <floatNumber>158.68</floatNumber>
+ <doubleNumber>369.04</doubleNumber>
+ </numberSet>
+ </MyMoreComplexValue>
+ </property>
+
+ <property name="complexFoo" type="foo:MyMoreComplexType">
+ <MyMoreComplexValue xmlns="">
+ <stringArray>TestString_3</stringArray>
+ <stringArray>TestString_4</stringArray>
+ <intArray>100</intArray>
+ <intArray>200</intArray>
+ </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">
+ <MyAnotherComplexValue xmlns="">
+ <stringArray>TestString_1</stringArray>
+ <stringArray>TestString_2</stringArray>
+ <intArray>10</intArray>
+ <integerNumber>27</integerNumber>
+ <floatNumber>79.34</floatNumber>
+ <doubleArray>25.52</doubleArray>
+ <doubleNumber>184.52</doubleNumber>
+ <doubleArray>50.05</doubleArray>
+ <intArray>20</intArray>
+ <numberSetArray>
+ <integerNumber>1</integerNumber>
+ <floatNumber>11</floatNumber>
+ <doubleNumber>111</doubleNumber>
+ </numberSetArray>
+ <numberSetArray>
+ <integerNumber>2</integerNumber>
+ <floatNumber>22</floatNumber>
+ <doubleNumber>222</doubleNumber>
+ </numberSetArray>
+ <numberSet>
+ <integerNumber>54</integerNumber>
+ <floatNumber>158.68</floatNumber>
+ <doubleNumber>369.04</doubleNumber>
+ </numberSet>
+ </MyAnotherComplexValue>
+ </property>
+ <property name="complexPropertyThree" element="foo:PropertyThreeElement">
+ <PropertyThreeElement xmlns="">
+ <stringArray>TestElementString_1</stringArray>
+ <stringArray>TestElementString_2</stringArray>
+ <intArray>10</intArray>
+ <integerNumber>27</integerNumber>
+ <floatNumber>79.34</floatNumber>
+ <doubleArray>25.52</doubleArray>
+ <doubleNumber>184.52</doubleNumber>
+ <doubleArray>50.05</doubleArray>
+ <intArray>20</intArray>
+ <numberSetArray>
+ <integerNumber>1</integerNumber>
+ <floatNumber>11</floatNumber>
+ <doubleNumber>111</doubleNumber>
+ </numberSetArray>
+ <numberSetArray>
+ <integerNumber>2</integerNumber>
+ <floatNumber>22</floatNumber>
+ <doubleNumber>222</doubleNumber>
+ </numberSetArray>
+ <numberSet>
+ <integerNumber>54</integerNumber>
+ <floatNumber>158.68</floatNumber>
+ <doubleNumber>369.04</doubleNumber>
+ </numberSet>
+ </PropertyThreeElement>
+ </property>
+ <property name="complexPropertyFour" element="foo:PropertyFourElement" many="true">
+ <PropertyFourElement xmlns="">
+ <integerNumber>1</integerNumber>
+ <floatNumber>11.11</floatNumber>
+ <doubleNumber>111.111</doubleNumber>
+ <numberSet>
+ <integerNumber>11</integerNumber>
+ <floatNumber>1111.1111</floatNumber>
+ <doubleNumber>11111.11111</doubleNumber>
+ </numberSet>
+ </PropertyFourElement>
+ <PropertyFourElement xmlns="">
+ <integerNumber>2</integerNumber>
+ <floatNumber>22.22</floatNumber>
+ <doubleNumber>222.222</doubleNumber>
+ <numberSet>
+ <integerNumber>22</integerNumber>
+ <floatNumber>2222.2222</floatNumber>
+ <doubleNumber>22222.22222</doubleNumber>
+ </numberSet>
+ </PropertyFourElement>
+ <PropertyFourElement xmlns="">
+ <integerNumber>3</integerNumber>
+ <floatNumber>33.33</floatNumber>
+ <doubleNumber>333.333</doubleNumber>
+ <numberSet>
+ <integerNumber>33</integerNumber>
+ <floatNumber>3333.3333</floatNumber>
+ <doubleNumber>33333.33333</doubleNumber>
+ </numberSet>
+ </PropertyFourElement>
+ </property>
+ <property name="complexPropertyFive" source="$complexFoo"/>
+ <property name="sdoProperty" type="cust:Customer">
+ <cust:customer>
+ <cust:firstName>Firstly Name</cust:firstName>
+ <cust:middleName>Middler Name</cust:middleName>
+ <cust:lastName>Lasting Name</cust:lastName>
+ </cust:customer>
+ </property>
+ <property name="customerSdo" type="cust:Customer">
+ <cust:customer>
+ <cust:firstName>Sdo Firstly Name</cust:firstName>
+ <cust:middleName>Sdo Middler Name</cust:middleName>
+ <cust:lastName>Sdo Lasting Name</cust:lastName>
+ </cust:customer>
+ </property>
+ <property name="location" type="xsd:string">RTP</property>
+ <property name="year" type="xsd:string">2006</property>
+ <property name="daysOfTheWeek" many="true" type="xsd:string">"Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"</property>
+ <property name="integerNumbers" many="true" type="xsd:int">1 2 3 4 5 6 7 8 9 10</property>
+ <property name="intNumbers" many="true" type="xsd:int">10 9 8 7 6 5 4 3 2 1 0</property>
+ <property name="sdoArray" many="true" type="cust:Customer">
+ <cust:customer>
+ <cust:firstName>Firstly Name 1</cust:firstName>
+ <cust:middleName>Middler Name 1</cust:middleName>
+ <cust:lastName>Lasting Name 1</cust:lastName>
+ </cust:customer>
+ <cust:customer>
+ <cust:firstName>Firstly Name 2</cust:firstName>
+ <cust:middleName>Middler Name 2</cust:middleName>
+ <cust:lastName>Lasting Name 2</cust:lastName>
+ </cust:customer>
+ <cust:customer>
+ <cust:firstName>Firstly Name 3</cust:firstName>
+ <cust:middleName>Middler Name 3</cust:middleName>
+ <cust:lastName>Lasting Name 3</cust:lastName>
+ </cust:customer>
+ </property>
+ <property name="complexJAXBPropertyOne" type="rcp:ReturnCodeProperties">
+ <MyRCProps xmlns="http://test.sca.jaxb/rcprops">
+ <AInt>10</AInt>
+ <BInteger>10</BInteger>
+ </MyRCProps>
+ </property>
+ <property name="complexJAXBPropertyTwo" type="rcp:ReturnCodeProperties" file="rcProps.txt"/>
+ </component>
+</composite>
+
+
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/customer.xsd b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/customer.xsd
new file mode 100644
index 0000000000..8861d7e7b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/customer.xsd
@@ -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.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://www.example.com/Customer" targetNamespace="http://www.example.com/Customer">
+
+ <xsd:element name="customer" type="Customer"/>
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string"/>
+ <xsd:element name="middleName" type="xsd:string"/>
+ <xsd:element name="lastName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/fileProperty.txt b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/fileProperty.txt
new file mode 100644
index 0000000000..0d3d9ead83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/properties/src/main/resources/manyValuesFileProperty.txt b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/manyValuesFileProperty.txt
new file mode 100644
index 0000000000..450f397b30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/properties/src/main/resources/mySimpleService.composite b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/mySimpleService.composite
new file mode 100644
index 0000000000..75fdd24add
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/mySimpleService.composite
@@ -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.
+-->
+<composite autowire="false" local="true" name="MySimpleService"
+ targetNamespace="http://foo" xmlns:foo="http://foo" 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 ">
+
+
+ <service name="MyServiceNew1" promote="MyServiceComponentNew/MyService">
+ <interface.java interface="mysca.test.myservice.impl.MyService" />
+ </service>
+
+ <property name="newLocation" type="xsd:anyURI">Raleigh</property>
+ <property name="newYear" type="xsd:anyURI">2008</property>
+
+
+ <component name="MyServiceComponentNew">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ <property name="location" source="$newLocation" />
+ <property name="year" source="$newYear" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/rcProps.txt b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/rcProps.txt
new file mode 100644
index 0000000000..052c291fd0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/rcProps.txt
@@ -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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<MyRCProps xmlns="http://test.sca.jaxb/rcprops">
+ <AInt>20</AInt>
+ <BInteger>20</BInteger>
+</MyRCProps>
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/rcprops.xsd b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/rcprops.xsd
new file mode 100644
index 0000000000..21289fa7b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/main/resources/rcprops.xsd
@@ -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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 elementFormDefault="qualified" targetNamespace="http://test.sca.jaxb/rcprops"
+ xmlns:tns="http://test.sca.jaxb/rcprops" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+
+ <!-- Use some JAXB customizations -->
+
+ <annotation>
+ <appinfo>
+ <jaxb:schemaBindings>
+ <jaxb:package name="test.jaxb.props" />
+ </jaxb:schemaBindings>
+ </appinfo>
+ </annotation>
+
+ <element name="MyRCProps" type="tns:ReturnCodeProperties" />
+
+ <complexType name="ReturnCodeProperties">
+ <sequence>
+ <element name="AInt" type="xsd:int">
+ <annotation>
+ <appinfo>
+ <jaxb:property name="a" />
+ </appinfo>
+ </annotation>
+ </element>
+ <element name="BInteger" type="xsd:integer">
+ <annotation>
+ <appinfo>
+ <jaxb:property name="b" />
+ </appinfo>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+</schema>
+
+
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java
new file mode 100644
index 0000000000..8cf182e24a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.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.itest;
+
+import static junit.framework.Assert.assertEquals;
+import mysca.test.myservice.impl.MyService;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MyTotalServiceTestCase {
+ private static MyService service1;
+ private static MyService service2;
+ private static MyService service3;
+
+ private static SCADomain domain;
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the local
+ * property variables defined in the implementation file with the expected values 'RTP' and '2006'
+ */
+ @Test
+ public void testPropertyDefault() {
+ assertEquals("RTP", service1.getLocation());
+ assertEquals("2006", service1.getYear());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using service2 from the SCA runtime environment with the expected values 'Raleigh'
+ * and '2008'. This overrides the local property values
+ */
+ @Test
+ public void testPropertyOverride() {
+ assertEquals("Raleigh", service2.getLocation());
+ assertEquals("2008", service2.getYear());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using service3 from the SCA runtime environment with the expected values 'Durham'
+ * and '2009'
+ */
+ @Test
+ public void testPropertyNestedOverride() {
+ assertEquals("Durham", service3.getLocation());
+ assertEquals("2009", service3.getYear());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test
+ * Embedded SCA Domain, to start the SCA Domain and to get a reference to the 'outerABService' service
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+
+ domain = SCADomain.newInstance("Outer.composite");
+ service1 = domain.getService(MyService.class, "MyServiceComponent/MyService");
+ service2 = domain.getService(MyService.class, "MyServiceComponentNew/MyService");
+ service3 = domain.getService(MyService.class, "MySimpleServiceInRecursiveAnother");
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
+ * domain, close any previously opened connections etc
+ */
+ @AfterClass
+ public static void tearDown() {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java b/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java
new file mode 100644
index 0000000000..28357c5bbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.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.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;
+
+/**
+ * This is a class which makes user of JUnit Framework, all tests are written using JUnit notation. These tests are used
+ * to test different property values returned from the SCA Runtime Environment which is initialized with the composite
+ * 'OuterPropertyTest.composite'. It basically tests the Simple type of property and Complex type of property from the
+ * SCA Runtime Environment.
+ */
+public class OuterPropertyTestCase {
+
+ private static SCADomain domain;
+ private static ABComponent outerABService;
+
+ /**
+ * Method annotated with
+ *
+ * @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test
+ * Embedded SCA Domain, to start the SCA Domain and to get a reference to the 'outerABService' service
+ */
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("OuterPropertyTest.composite");
+ outerABService = domain.getService(ABComponent.class, "OuterComponent");
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
+ * domain, close any previously opened connections etc
+ */
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden
+ * A'
+ */
+ @Test
+ public void testOverridenA() {
+ assertEquals("Overriden A", outerABService.getA());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden
+ * B'
+ */
+ @Test
+ public void testOverridenB() {
+ assertEquals("Overriden B", outerABService.getB());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden
+ * A'
+ */
+ @Test
+ public void testOverridenF() {
+ assertEquals("Overriden A", outerABService.getF());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden
+ * Z'
+ */
+ @Test
+ public void testOverridenZ() {
+ assertEquals("Overriden Z", outerABService.getZ());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 125
+ */
+ @Test
+ public void testOverridenIntValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 125
+ */
+ @Test
+ public void testDefaultValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 'Apache' ,
+ * 'Tuscany' and 'Java SCA' respectively .
+ */
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = outerABService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 123, 456
+ * and 789
+ */
+ @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-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
new file mode 100644
index 0000000000..6979659ece
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
@@ -0,0 +1,468 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.Arrays;
+import java.util.Iterator;
+
+import java.math.BigInteger;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import test.jaxb.props.ReturnCodeProperties;
+import commonj.sdo.DataObject;
+
+/**
+ * This is a class which makes user of JUnit Framework, all tests are written using JUnit notation. These tests are used
+ * to test different property values returned from the SCA Runtime Environment which is initialized with the composite
+ * 'PropertyTest.composite'. It basically tests all types of property values returned from SCA runtime environment.
+ */
+public class PropertyTestCase {
+ private static SCADomain domain;
+ private static ABComponent abService;
+ private static CDComponent cdService;
+ private static ABCDComponent abcdService;
+ private static PropertyComponent propertyService;
+
+
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'a'
+ */
+ @Test
+ public void testA() {
+ assertEquals("a", abService.getA());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'b'
+ */
+ @Test
+ public void testB() {
+ assertEquals("b", abService.getB());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'c'
+ */
+ @Test
+ public void testC() {
+ assertEquals("c", cdService.getC());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'c'
+ */
+ @Test
+ public void testC2() {
+ assertEquals("c", cdService.getC2());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'd'
+ */
+ @Test
+ public void testD() {
+ assertEquals("d", cdService.getD());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'a'
+ */
+ @Test
+ public void testF() {
+ assertEquals("a", abService.getF());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'z'
+ */
+ @Test
+ public void testZ() {
+ assertEquals("z", abService.getZ());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 1.
+ */
+ @Test
+ public void testIntValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 1.
+ */
+ @Test
+ public void testDefaultValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 1.
+ */
+ @Test
+ public void testDefaultValueOverride() {
+ assertEquals(1, cdService.getOverrideValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'aValue'
+ */
+ @Test
+ public void testNoSource() {
+ assertEquals("aValue", cdService.getNoSource());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value
+ * 'fileValue'
+ */
+ @Test
+ public void testFileProperty() {
+ assertEquals("fileValue", cdService.getFileProperty());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 4 and
+ * 'fileValueTwo' respectively.
+ */
+ @Test
+ public void testManyValuesFileProperty() {
+ Iterator<String> iterator = cdService.getManyValuesFileProperty().iterator();
+ iterator.next();
+ String secondValue = iterator.next();
+ assertEquals(4, cdService.getManyValuesFileProperty().size());
+ assertEquals("fileValueTwo", secondValue);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 'a' ,
+ * 'b', 'c' and 'd' respectively.
+ */
+ @Test
+ public void testABCD() {
+ assertEquals("a", abcdService.getA());
+ assertEquals("b", abcdService.getB());
+ assertEquals("c", abcdService.getC());
+ assertEquals("d", abcdService.getD());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 'RTP'
+ * and '2006' respectively
+ */
+ @Test
+ public void testDefaultProperty() {
+ assertEquals("RTP", propertyService.getLocation());
+ assertEquals("2006", propertyService.getYear());
+
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 'Apache' ,
+ * 'Tuscany' and 'Java SCA' respectively .
+ */
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = abService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 123, 456
+ * and 789 respectively.
+ */
+ @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());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values
+ * 'TestString_1' and 2 respectively.
+ */
+ @Test
+ public void testComplexPropertyOne() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyOne();
+ assertNotNull(propBean);
+ assertEquals("TestString_1", propBean.getStringArray()[0]);
+ assertEquals(2, propBean.numberSetArray[1].integerNumber);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected integer number
+ * and a float number
+ */
+ @Test
+ public void testComplexPropertyTwo() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyTwo();
+ assertNotNull(propBean);
+ assertEquals(10, propBean.intArray[0]);
+ assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected value first
+ * element in the string array and the float number
+ */
+ @Test
+ public void testComplexPropertyThree() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyThree();
+ assertNotNull(propBean);
+ assertEquals("TestElementString_1", propBean.stringArray[0]);
+ assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * complex property value obtained using a service from the SCA runtime environment with the expected values
+ * 1, 222.222 and 33 respectively.
+ */
+ @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());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values
+ * 'TestString_3', 'TestString_4', 100 and 200.
+ */
+ @Test
+ public void testComplexPropertyFive() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyFive();
+ assertNotNull(propBean);
+ assertEquals("TestString_3", propBean.getStringArray()[0]);
+ assertEquals("TestString_4", propBean.getStringArray()[1]);
+ assertEquals(100, propBean.getIntArray()[0]);
+ assertEquals(200, propBean.getIntArray()[1]);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected string values
+ * 'Firstly Name' , 'Middler Name' and 'Lasting Name' respectively
+ */
+ @Test
+ public void testSDOProperty1() {
+ DataObject dataObject = propertyService.getSdoProperty();
+ assertNotNull(dataObject);
+ assertEquals("Firstly Name", dataObject.get("firstName"));
+ assertEquals("Middler Name", dataObject.getString("middleName"));
+ assertEquals("Lasting Name", dataObject.getString("lastName"));
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected string values
+ * 'Sdo Firstly Name', 'Sdo Middler Name' and 'Sdo Lasting Name' respectively
+ */
+ @Test
+ public void testSDOProperty2() {
+ DataObject dataObject = propertyService.getCustomerSdo();
+ assertNotNull(dataObject);
+ assertEquals("Sdo Firstly Name", dataObject.get("firstName"));
+ assertEquals("Sdo Middler Name", dataObject.getString("middleName"));
+ assertEquals("Sdo Lasting Name", dataObject.getString("lastName"));
+ }
+
+
+ @Test
+ public void testGetLocationFromComponentContext() {
+ String location = propertyService.getLocation();
+ assertNotNull(location);
+ String locationFromCC = propertyService.getLocationFromComponentContext();
+ assertNotNull(locationFromCC);
+ assertEquals(location, locationFromCC);
+ }
+
+ @Test
+ public void testGetInjectedStringArrayProperty() {
+ String[] daysOfWeek = propertyService.getDaysOfTheWeek();
+ assertNotNull(daysOfWeek);
+
+ String[] expected = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
+ Assert.assertTrue(Arrays.equals(expected, daysOfWeek));
+ }
+
+ @Test
+ public void testGetInjectedIntegerArrayProperty() {
+ Integer[] numbers = propertyService.getIntegerNumbers();
+ assertNotNull(numbers);
+
+ Integer[] expected = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ Assert.assertTrue(Arrays.equals(expected, numbers));
+ }
+
+ @Test
+ public void testGetInjectedIntArrayProperty() {
+ int[] numbers = propertyService.getIntNumbers();
+ assertNotNull(numbers);
+
+ int[] expected = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+ Assert.assertTrue(Arrays.equals(expected, numbers));
+ }
+
+ @Test
+ public void testGetInjectedSdoArrayProperty() {
+ DataObject[] sdos = propertyService.getSdoArrayProperty();
+ assertNotNull(sdos);
+
+ for (int i = 1; i <= 3; i++) {
+ DataObject dataObject = sdos[i - 1];
+ assertEquals("Firstly Name " + i, dataObject.get("firstName"));
+ assertEquals("Middler Name " + i, dataObject.getString("middleName"));
+ assertEquals("Lasting Name " + i, dataObject.getString("lastName"));
+ }
+ }
+
+ @Test
+ public void testComplexJAXBProperty() {
+ ReturnCodeProperties rc = propertyService.getComplexJAXBPropertyOne();
+ assertEquals(10, rc.getA());
+ assertEquals(new BigInteger("10"), rc.getB());
+ }
+
+ @Test
+ public void testComplexJAXBPropertyFromFile() {
+ ReturnCodeProperties rc = propertyService.getComplexJAXBPropertyTwo();
+ System.out.println("SKSK: a =" + rc.getA());
+ System.out.println("SKSK: b =" + rc.getB());
+ assertEquals(20, rc.getA());
+ assertEquals(new BigInteger("20"), rc.getB());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test
+ * Embedded SCA Domain, to start the SCA Domain and to get a reference to 4 services namely 'abService'
+ * service, 'cdService' service, 'abcdService' service and 'propertyService' service
+ */
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("PropertyTest.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ abService = domain.getService(ABComponent.class, "ABComponent");
+ cdService = domain.getService(CDComponent.class, "CDComponent");
+ abcdService = domain.getService(ABCDComponent.class, "ABCDComponent");
+ propertyService = domain.getService(PropertyComponent.class, "PropertyComponent");
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
+ * domain, close any previously opened connections etc
+ */
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java b/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java
new file mode 100644
index 0000000000..8ee5dce91f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.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.itest.cdi;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ConstructorPropertyInjectionTestCase extends TestCase {
+
+ public void testFoo1() throws Exception {
+ SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite");
+ Bar foo = sca.getService(Bar.class, "Foo1Component");
+ assertEquals("fubar", foo.getBar());
+ }
+
+ public void testFoo2() throws Exception {
+ SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite");
+ Bar foo = sca.getService(Bar.class, "Foo2Component");
+ assertEquals("fubar", foo.getBar());
+ }
+
+ public void testFoo3() throws Exception {
+ SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite");
+ Bar foo = sca.getService(Bar.class, "Foo3Component");
+ assertEquals("fubar", foo.getBar());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/pom.xml b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/pom.xml
new file mode 100644
index 0000000000..48d45e50f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/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.4-SNAPSHOT</version>
+ <!--relativePath>../pom.xml</relativePath-->
+ </parent>
+ <artifactId>itest-recursive-multi-level</artifactId>
+ <name>Apache Tuscany SCA Recusive Multi-Level Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java
new file mode 100644
index 0000000000..214d4d8a1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.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 mysca.test.myservice;
+
+
+public interface MyService {
+ String getLocation();
+ String getYear();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java
new file mode 100644
index 0000000000..51948a3b81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.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 mysca.test.myservice;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+import mysca.test.myservice.MyService;
+
+@Service(MyService.class)
+public class MyServiceImpl implements MyService {
+
+ @Property(name="location")
+ protected String location = "ABC";
+
+ @Property(name="year")
+ protected String year = "2006";
+
+
+ public String getLocation()
+ {
+ return location;
+ }
+
+ public String getYear()
+ {
+ return year;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java
new file mode 100644
index 0000000000..08df8ade17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.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 mysca.test.myservice;
+
+public interface MySimpleTotalService {
+ String getLocation();
+ String getYear();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java
new file mode 100644
index 0000000000..2ad9f815f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.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 mysca.test.myservice;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import mysca.test.myservice.MyService;
+import mysca.test.myservice.MySimpleTotalService;
+
+@Service(MySimpleTotalService.class)
+public class MySimpleTotalServiceImpl implements MySimpleTotalService
+{
+ // default required==true so it is 1:1
+ @Reference
+ public MyService myService;
+
+
+ public String getLocation()
+ {
+ return myService.getLocation();
+ }
+
+ public String getYear()
+ {
+ return myService.getYear();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite
new file mode 100644
index 0000000000..975f61c664
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService1Auto.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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0"
+ name="TotalComposite1Auto"
+ targetNamespace="http://foo"
+ local="true"
+ autowire="false">
+
+ <property name="newLocation" type="xsd:anyURI">Level 1</property>
+ <property name="newYear" type="xsd:anyURI">2001</property>
+
+ <component name="ServiceComponentLevel1Auto">
+ <implementation.java class="mysca.test.myservice.MyServiceImpl"/>
+ <property name="location" source="$newLocation"/>
+ <property name="year" source="$newYear"/>
+ </component>
+
+ <service name="MyServiceLevel1Auto" promote="TotalServiceComponentLevel1Auto/MySimpleTotalService">
+ <interface.java interface="mysca.test.myservice.MySimpleTotalService"/>
+ </service>
+
+ <component name="TotalServiceComponentLevel1Auto">
+ <implementation.java class="mysca.test.myservice.MySimpleTotalServiceImpl"/>
+ <reference name="myService" autowire="true"/>
+ </component>
+
+ <reference name="myServiceReference1Auto" promote="TotalServiceComponentLevel1Auto/myService">
+ <interface.java interface="mysca.test.myservice.MyService"/>
+ </reference>
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite
new file mode 100644
index 0000000000..f9bbcc76d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService2Auto.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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0"
+ name="TotalComposite2Auto"
+ targetNamespace="http://foo"
+ local="true"
+ autowire="false">
+
+ <property name="newLocation" type="xsd:anyURI">Level 2</property>
+ <property name="newYear" type="xsd:anyURI">2002</property>
+
+ <component name="ServiceComponentLevel2Auto">
+ <implementation.java class="mysca.test.myservice.MyServiceImpl"/>
+ <property name="location">Default 2</property>
+ <property name="year">1992</property>
+ </component>
+
+ <service name="MyServiceLevel2Auto" promote="TotalServiceInRecursive2Auto/MyServiceLevel1Auto"/>
+
+ <component name="TotalServiceInRecursive2Auto">
+ <implementation.composite name="foo:TotalComposite1Auto"/>
+ <reference name="myServiceReference1Auto" autowire="true"/>
+ <property name="newLocation" source="$newLocation"/>
+ <property name="newYear" source="$newYear"/>
+ </component>
+
+ <reference name="myServiceReference2Auto" promote="TotalServiceInRecursive2Auto/myServiceReference1Auto"/>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite
new file mode 100644
index 0000000000..09fd10fb7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/main/resources/TotalService3Auto.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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0"
+ name="TotalComposite3Auto"
+ targetNamespace="http://foo"
+ local="true"
+ autowire="false">
+
+ <property name="newLocation" type="xsd:anyURI">Level 3</property>
+ <property name="newYear" type="xsd:anyURI">2003</property>
+
+ <component name="ServiceComponentLevel3Auto">
+ <implementation.java class="mysca.test.myservice.MyServiceImpl"/>
+ <property name="location">Default 3</property>
+ <property name="year">1993</property>
+ </component>
+
+ <service name="MyServiceLevel3Auto" promote="TotalServiceInRecursive3Auto/MyServiceLevel2Auto">
+ </service>
+
+ <component name="TotalServiceInRecursive3Auto" autowire="true">
+ <implementation.composite name="foo:TotalComposite2Auto"/>
+ <reference name="myServiceReference2Auto"/>
+ <property name="newLocation" source="$newLocation"/>
+ <property name="newYear" source="$newYear"/>
+ </component>
+
+ <reference name="myServiceReference3Auto" promote="TotalServiceInRecursive3Auto/myServiceReference2Auto">
+ </reference>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java
new file mode 100644
index 0000000000..d8d6fe0dc5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.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 test.sca.tests;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import mysca.test.myservice.MySimpleTotalService;
+import junit.framework.TestCase;
+
+
+/**
+ * Tests to make sure that autowiring and recusive composite work together
+ *
+ */
+public class MultiLevelTestCase extends TestCase
+{
+ private SCADomain domain1;
+ private SCADomain domain2;
+ private SCADomain domain3;
+ private MySimpleTotalService myService1;
+ private MySimpleTotalService myService2;
+ private MySimpleTotalService myService3;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ domain1 = SCADomain.newInstance("TotalService1Auto.composite");
+ domain2 = SCADomain.newInstance("TotalService2Auto.composite");
+ domain3 = SCADomain.newInstance("TotalService3Auto.composite");
+
+ myService1 = domain1.getService(MySimpleTotalService.class, "TotalServiceComponentLevel1Auto");
+ myService2 = domain2.getService(MySimpleTotalService.class, "TotalServiceInRecursive2Auto/MyServiceLevel1Auto");
+ myService3 = domain3.getService(MySimpleTotalService.class, "TotalServiceInRecursive3Auto/MyServiceLevel2Auto");
+ }
+
+ public void testLevel1()
+ {
+ assertEquals("Level 1",myService1.getLocation());
+ assertEquals("2001",myService1.getYear());
+ }
+
+ public void testLevel2()
+ {
+ assertEquals("Default 2",myService2.getLocation());
+ assertEquals("1992",myService2.getYear());
+ }
+
+ public void testLevel3()
+ {
+ assertEquals("Default 3",myService3.getLocation());
+ assertEquals("1993",myService3.getYear());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/pom.xml b/sca-java-1.x/branches/sca-android/itest/recursive-ws/pom.xml
new file mode 100644
index 0000000000..5ed11a4c7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-recursive-ws</artifactId>
+ <name>Apache Tuscany SCA Recursive WS Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ </dependencies>
+
+ <!-- Declare tuscany-host-jetty dependency in the default profile so that it can be replaced -->
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/Target.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/Target.java
new file mode 100644
index 0000000000..c77fcea868
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/Target.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 policy;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Target {
+ String hello(String arg);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java
new file mode 100644
index 0000000000..87e412829e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/TargetClientImpl.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 policy;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetClientImpl implements Target {
+
+ @Reference
+ protected Target targetService;
+
+ public String hello(String arg) {
+ return "Target: Hello " + targetService.hello(arg) + "!";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java
new file mode 100644
index 0000000000..e565055252
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.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 policy;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetServiceImpl implements Target {
+
+ public String hello(String arg) {
+ return "Target: Hello " + arg + "!";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/Composer.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/Composer.java
new file mode 100644
index 0000000000..e53f99d9c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/Composer.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 recursive;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Composer {
+ public String Compose(String s);
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerClient.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerClient.java
new file mode 100644
index 0000000000..7956d153cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerClient.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 recursive;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * For testing purpose
+ */
+public class ComposerClient {
+
+ public final static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("Client.composite");
+ Composer composer = scaDomain.getService(Composer.class, "ClientComponent/Composer");
+ System.out.println(composer.Compose("ABC"));
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerClientImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerClientImpl.java
new file mode 100644
index 0000000000..3d75b7b165
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerClientImpl.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 recursive;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComposerClientImpl implements Composer {
+ @Reference
+ protected Composer composerWS;
+
+ /**
+ * @see recursive.Composer#Compose(java.lang.String)
+ */
+ public String Compose(String s) {
+ return composerWS.Compose(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerImpl.java
new file mode 100644
index 0000000000..8b77484922
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerImpl.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 recursive;
+
+/**
+ * Composer Component Implementation
+ *
+ */
+
+public class ComposerImpl implements Composer {
+
+ public String Compose(String s) {
+ System.out.println("Composing " + s + "...");
+ return "Composed: " + s;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerServer.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerServer.java
new file mode 100644
index 0000000000..5035d1cbd9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/java/recursive/ComposerServer.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 recursive;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * For testing purpose
+ */
+public class ComposerServer {
+
+ public final static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("Outer.composite");
+ System.out.println("Press Enter to exit...");
+ System.in.read();
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Client.composite b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Client.composite
new file mode 100644
index 0000000000..56d7c01377
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Client.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://client" name="Client">
+ <component name="ClientComponent">
+ <implementation.java class="recursive.ComposerClientImpl" />
+ <reference name="composerWS">
+ <binding.ws uri="http://localhost:8085/OuterService"/>
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Inner.composite b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Inner.composite
new file mode 100644
index 0000000000..b054ae0944
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Inner.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" targetNamespace="http://inner" name="Inner">
+ <component name="InnerComponent">
+ <implementation.java class="recursive.ComposerImpl" />
+ </component>
+ <service name="OuterService" promote="InnerComponent"/>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Outer.composite b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Outer.composite
new file mode 100644
index 0000000000..3c3f327b28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/Outer.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://outer" xmlns:inner="http://inner"
+ name="Outer">
+ <component name="OuterComponent">
+ <implementation.composite name="inner:Inner" />
+ <service name="OuterService">
+ <interface.java interface="recursive.Composer" />
+ <binding.ws uri="http://localhost:8085/OuterService" />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/bindingoverride/InnerComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/bindingoverride/InnerComposite.composite
new file mode 100644
index 0000000000..b5c180919c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/bindingoverride/InnerComposite.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://bindingoverride"
+ xmlns:bindingoverride="http://bindingoverride"
+ name="BindingOverrideInnerComposite">
+
+ <service name="InnerService" promote="InnerServiceComponent">
+ <interface.java interface="policy.Target"/>
+ </service>
+
+ <component name="InnerServiceComponent">
+ <implementation.java class="policy.TargetServiceImpl"/>
+ <service name="Target">
+ <interface.java interface="policy.Target"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/bindingoverride/OuterComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/bindingoverride/OuterComposite.composite
new file mode 100644
index 0000000000..891cac0b79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/bindingoverride/OuterComposite.composite
@@ -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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bindingoverride"
+ xmlns:bindingoverride="http://bindingoverride"
+ name="BindingOverrideOuterComposite">
+
+ <component name="OuterClientComponent">
+ <implementation.java class="policy.TargetClientImpl"/>
+ <reference name="targetService" target="OuterServiceComponent">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="OuterServiceComponent">
+ <implementation.composite name="bindingoverride:BindingOverrideInnerComposite"/>
+ <service name="InnerService">
+ <interface.java interface="policy.Target"/>
+ <binding.ws uri="http://localhost:8085/OuterTargetServiceComponent"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite
new file mode 100644
index 0000000000..4b398743eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.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://policy"
+ xmlns:policy="http://policy"
+ name="PolicyInnerComposite">
+
+ <service name="TargetService" promote="TargetServiceComponent">
+ <interface.java interface="policy.Target"/>
+ </service>
+
+ <component name="TargetServiceComponent">
+ <implementation.java class="policy.TargetServiceImpl"/>
+ <service name="Target">
+ <interface.java interface="policy.Target"/>
+ <binding.ws uri="http://localhost:8085/TargetServiceComponent"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite
new file mode 100644
index 0000000000..b50bc29a1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.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://policy"
+ xmlns:policy="http://policy"
+ name="PolicyOuterComposite"
+ requires="policy:TestIntent_1">
+
+ <component name="TargetClientComponent">
+ <implementation.java class="policy.TargetClientImpl"/>
+ <reference name="targetService" target="OuterTargetServiceComponent">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="OuterTargetServiceComponent">
+ <implementation.composite name="policy:PolicyInnerComposite"/>
+ <service name="TargetService">
+ <interface.java interface="policy.Target"/>
+ <binding.ws uri="http://localhost:8085/OuterTargetServiceComponent"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/definitions.xml b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/definitions.xml
new file mode 100644
index 0000000000..3ae202f4aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/main/resources/policy/definitions.xml
@@ -0,0 +1,39 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://policy" >
+
+ <!-- Policy Intents -->
+ <sca:intent name="TestIntent_1" constrains="sca:binding.ws">
+ <description>Test Intent One</description>
+ </sca:intent>
+
+ <!-- Policy Sets -->
+ <sca:policySet name="TestPolicySet_1_binding"
+ provides="ip:TestIntent_1"
+ appliesTo="sca:binding.ws"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/bindingoverride/BindingOverrideTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/bindingoverride/BindingOverrideTestCase.java
new file mode 100644
index 0000000000..c6e46564f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/bindingoverride/BindingOverrideTestCase.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 bindingoverride;
+
+import junit.framework.Assert;
+
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import policy.Target;
+
+public class BindingOverrideTestCase{
+
+ private SCADomain domain;
+ private Target targetClient;
+
+ @Before
+ public void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("bindingoverride/OuterComposite.composite");
+ targetClient = domain.getService(Target.class, "OuterClientComponent");
+ } catch(Exception ex) {
+ System.out.println(ex.toString());
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ //@Ignore("TUSCANY-2352")
+ public void test() throws Exception {
+ Assert.assertEquals("Target: Hello Target: Hello Fred!!", targetClient.hello("Fred"));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java
new file mode 100644
index 0000000000..3e71246da2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/policy/PolicyTestCase.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 policy;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.impl.CompositeImpl;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.annotations.EndsConversation;
+
+public class PolicyTestCase{
+
+ private SCADomain domain;
+ private Target targetClient;
+
+ @Before
+ public void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("policy/PolicyOuterComposite.composite");
+ targetClient = domain.getService(Target.class, "TargetClientComponent");
+ } catch(Exception ex) {
+ System.out.println(ex.toString());
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void test() throws Exception {
+ //Check that the binding policy sets do flow down to the component but not down to the
+ //component inside implementation.composite
+ Component outerComponent = ((DefaultSCADomain)domain).getComponent("OuterTargetServiceComponent");
+
+ // The outer component service bindings should have policy sets attached
+ Assert.assertEquals(1, ((PolicySetAttachPoint)outerComponent.getServices().get(0).getBindings().get(0)).getPolicySets().size());
+
+ Component component =((CompositeImpl)outerComponent.getImplementation()).getComponents().get(0);
+
+ // The original inner component service binding should not have policy sets attached
+ Assert.assertEquals(0, ((PolicySetAttachPoint)component.getServices().get(0).getBindings().get(0)).getPolicySets().size());
+
+ // The promoted inner component service binding should have policy sets attached
+ Assert.assertEquals(1, ((PolicySetAttachPoint)component.getServices().get(1).getBindings().get(0)).getPolicySets().size());
+
+ String result = targetClient.hello("Fred");
+
+ System.out.println(result);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/recursive/ComposerClientTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/recursive/ComposerClientTestCase.java
new file mode 100644
index 0000000000..6638d65551
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/recursive/ComposerClientTestCase.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 recursive;
+
+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;
+
+import recursive.Composer;
+
+/**
+ * Test case for helloworld web service client
+ */
+public class ComposerClientTestCase {
+
+ private Composer composer;
+ private SCADomain scaDomain;
+
+ private SCATestCaseRunner server;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("Client.composite");
+ composer = scaDomain.getService(Composer.class, "ClientComponent/Composer");
+
+ server = new SCATestCaseRunner(ComposerTestServer.class);
+ server.before();
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testWSClient() throws Exception {
+ String msg = composer.Compose("ABC");
+ Assert.assertEquals("Composed: ABC", msg);
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/recursive/ComposerTestServer.java b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/recursive/ComposerTestServer.java
new file mode 100644
index 0000000000..214379bcea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive-ws/src/test/java/recursive/ComposerTestServer.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 recursive;
+
+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 ComposerTestServer {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("Outer.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/pom.xml b/sca-java-1.x/branches/sca-android/itest/recursive/pom.xml
new file mode 100644
index 0000000000..20aa39e90d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/circular/include/DemoClass.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/circular/include/DemoClass.java
new file mode 100644
index 0000000000..fe42911486
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/circular/include/DemoClass.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 circular.include;
+
+public class DemoClass {
+
+ public String demo() {
+ return "hello";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/CompositeClient.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/CompositeClient.java
new file mode 100644
index 0000000000..5edc305970
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/composite/Source.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/Source.java
new file mode 100644
index 0000000000..d0efcc1df1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/composite/SourceCallback.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/SourceCallback.java
new file mode 100644
index 0000000000..baa95a8e39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/composite/SourceImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/SourceImpl.java
new file mode 100644
index 0000000000..b9a0c7ff74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/composite/Target.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/Target.java
new file mode 100644
index 0000000000..9a8f68a7fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/composite/TargetImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/composite/TargetImpl.java
new file mode 100644
index 0000000000..86686e9233
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/foo/A.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/A.java
new file mode 100644
index 0000000000..e87cbde26d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/A.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 foo;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(I.class)
+public class A implements I {
+ public String get(int i) {
+ return A.class.getName();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/B.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/B.java
new file mode 100644
index 0000000000..9d060cab59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/B.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 foo;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(I.class)
+public class B implements I {
+ protected I i = null;
+
+ @Reference(name = "i", required = true)
+ public void setC(I c) {
+ this.i = c;
+ }
+
+ public String get(int i) {
+ return this.i.get(i);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/I.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/I.java
new file mode 100644
index 0000000000..f6d55baef3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/foo/I.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 foo;
+
+public interface I {
+ String get(int i);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/Target.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/Target.java
new file mode 100644
index 0000000000..c77fcea868
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/Target.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 policy;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Target {
+ String hello(String arg);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/TargetClientImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/TargetClientImpl.java
new file mode 100644
index 0000000000..87e412829e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/TargetClientImpl.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 policy;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetClientImpl implements Target {
+
+ @Reference
+ protected Target targetService;
+
+ public String hello(String arg) {
+ return "Target: Hello " + targetService.hello(arg) + "!";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/TargetServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/TargetServiceImpl.java
new file mode 100644
index 0000000000..e565055252
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/policy/TargetServiceImpl.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 policy;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetServiceImpl implements Target {
+
+ public String hello(String arg) {
+ return "Target: Hello " + arg + "!";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/ComponentAImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/ComponentAImpl.java
new file mode 100644
index 0000000000..f513949105
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/sample/ComponentCImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/ComponentCImpl.java
new file mode 100644
index 0000000000..586a9ee6a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/sample/ComponentEImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/ComponentEImpl.java
new file mode 100644
index 0000000000..dbf2735aa7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/sample/ComponentFImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/ComponentFImpl.java
new file mode 100644
index 0000000000..5e136e536c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/sample/Service1.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/sample/Service1.java
new file mode 100644
index 0000000000..81bdce79f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/java/test/Aggregator.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/Aggregator.java
new file mode 100644
index 0000000000..88b3bed1b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/Aggregator.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 test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Aggregator {
+ String getAggregatedData();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/AggregatorImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/AggregatorImpl.java
new file mode 100644
index 0000000000..f6ac6c8741
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/AggregatorImpl.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 test;
+
+import java.util.List;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Aggregator.class)
+public class AggregatorImpl implements Aggregator {
+
+ @Reference(name = "uniSource")
+ protected Source source;
+
+ @Reference(name = "multiSource")
+ protected List<Source> sources;
+
+ public String getAggregatedData() {
+ System.out.println("uniSource: " + source.getData());
+ StringBuffer sb = new StringBuffer();
+ int i = 0;
+ for (Source s : sources) {
+ if (i != 0) {
+ sb.append(", ");
+ } else {
+ sb.append("multiSource: ");
+ }
+ sb.append(s.getData());
+ i++;
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/InnerSourceImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/InnerSourceImpl.java
new file mode 100644
index 0000000000..c8dad5ae35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/InnerSourceImpl.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 test;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Source.class)
+public class InnerSourceImpl implements Source {
+
+ public String getData() {
+ return "InnerSource";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/OuterSourceImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/OuterSourceImpl.java
new file mode 100644
index 0000000000..11816e82cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/OuterSourceImpl.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 test;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Source.class)
+public class OuterSourceImpl implements Source {
+
+ public String getData() {
+ return "OuterSource";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/Source.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/Source.java
new file mode 100644
index 0000000000..9b93740d9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test/Source.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 test;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Source {
+ String getData();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/Target.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/Target.java
new file mode 100644
index 0000000000..4883e12f49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/Target.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 test1.composite;
+
+public interface Target {
+ String hello(String arg);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetOne.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetOne.java
new file mode 100644
index 0000000000..a7c68f4ffd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetOne.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 test1.composite;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetOne implements Target {
+
+ public String hello(String arg) {
+ return "TargetOne: Hello " + arg + "!";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetTwo.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetTwo.java
new file mode 100644
index 0000000000..7fff8e2e9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetTwo.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 test1.composite;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetTwo implements Target {
+
+ public String hello(String arg) {
+ return "TargetTwo: Hello " + arg + "!";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/AComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/AComposite.composite
new file mode 100644
index 0000000000..1b5dee8762
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/AComposite.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"
+ xmlns:sample="http://sample"
+ name="AComposite">
+
+ <component name="AComponent">
+ <implementation.composite name="sample:BComposite"/>
+ </component>
+
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/BComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/BComposite.composite
new file mode 100644
index 0000000000..7d4588eba4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/BComposite.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"
+ name="BComposite">
+
+ <service name="BService" promote="BComponent">
+ <interface.java interface="sample.C"/>
+ </service>
+
+ <component name="BComponent">
+ <implementation.composite name="sample:CComposite"/>
+
+ <reference name="PromotedRefX" target="XComponent"/>
+ <reference name="PromotedRefY" target="YComponent"/>
+ </component>
+
+ <component name="XComponent">
+ <implementation.java class="sample.XImpl"/>
+ </component>
+
+ <component name="YComponent">
+ <implementation.java class="sample.YImpl"/>
+ </component>
+
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/CComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/CComposite.composite
new file mode 100644
index 0000000000..6d7b4ec600
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/CComposite.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CComposite">
+
+ <service name="CService" promote="CComponent">
+ <interface.java interface="sample.C"/>
+ </service>
+
+ <reference name="PromotedRefX" promote="CComponent/refX">
+ <interface.java interface="sample.X"/>
+ </reference>
+
+ <reference name="PromotedRefY" promote="CComponent/refY">
+ <interface.java interface="sample.Y"/>
+ </reference>
+
+ <component name="CComponent">
+ <implementation.java class="sample.CImpl"/>
+ <reference name="refX"/>
+ <reference name="refY"/>
+ </component>
+
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Composite1.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Composite1.composite
new file mode 100644
index 0000000000..56fd7c621f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/resources/Composite2.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Composite2.composite
new file mode 100644
index 0000000000..54f10673a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Composite2.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://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-android/itest/recursive/src/main/resources/Composite3.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Composite3.composite
new file mode 100644
index 0000000000..040653493f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Composite3.composite
@@ -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.
+-->
+<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-android/itest/recursive/src/main/resources/Demo1Composite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Demo1Composite.composite
new file mode 100644
index 0000000000..6b2a964b9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Demo1Composite.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample" xmlns:sample="http://sample" name="Demo1Composite"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+ <include name="sample:Demo2Composite" />
+ <component name="Demo1Component">
+ <implementation.java class="circular.include.DemoClass" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Demo2Composite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Demo2Composite.composite
new file mode 100644
index 0000000000..6b8c0a348e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Demo2Composite.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample" xmlns:sample="http://sample" name="Demo2Composite"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+ <include name="sample:Demo1Composite" />
+ <component name="Demo2Component">
+ <implementation.java class="circular.include.DemoClass" />
+ </component>
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Inner.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Inner.composite
new file mode 100644
index 0000000000..398ebdf6e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Inner.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://test"
+ xmlns:sample="http://test"
+ name="Inner">
+
+ <component name="Aggregator">
+ <implementation.java class="test.AggregatorImpl"/>
+ <reference name="uniSource" target="InnerSource/Source"/>
+ <reference name="multiSource" target="InnerSource/Source"/>
+ </component>
+
+ <component name="InnerSource">
+ <implementation.java class="test.InnerSourceImpl"/>
+ </component>
+
+ <reference name="uniSource" promote="Aggregator/uniSource">
+ <binding.sca/>
+ </reference>
+
+ <reference name="multiSource" promote="Aggregator/multiSource">
+ <binding.sca/>
+ </reference>
+
+ <service name="aggregator" promote="Aggregator"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/InnerComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/InnerComposite.composite
new file mode 100644
index 0000000000..3376ac8ff5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/resources/InnerComposite2.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/InnerComposite2.composite
new file mode 100644
index 0000000000..c9eff4fa9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..289b92a3f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/META-INF/sca-contribution.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.
+-->
+<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-android/itest/recursive/src/main/resources/Outer.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Outer.composite
new file mode 100644
index 0000000000..987990d854
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/Outer.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://test"
+ xmlns:test="http://test"
+ name="Outer">
+
+ <component name="OuterSource">
+ <implementation.java class="test.OuterSourceImpl"/>
+ </component>
+
+ <component name="Inner">
+ <!-- Implemented by Composite3 -->
+ <implementation.composite name="test:Inner"/>
+
+ <reference name="uniSource" target="OuterSource"/>
+
+ <reference name="multiSource" target="OuterSource"/>
+
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/OuterComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/OuterComposite.composite
new file mode 100644
index 0000000000..cb1c1e13d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/recursive/src/main/resources/foo/foo.png b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/foo.png
new file mode 100644
index 0000000000..0f2ec78aaf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/foo.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o1.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o1.composite
new file mode 100644
index 0000000000..1d31c2f424
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o1.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O1Composite">
+
+ <service name="O1Service" promote="AComponent">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="foo.A" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o2.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o2.composite
new file mode 100644
index 0000000000..4f21c21860
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o2.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O2Composite">
+
+ <service name="O2Service" promote="O1Component/O1Service">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="O1Component">
+ <implementation.composite name="bar:O1Composite" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o3.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o3.composite
new file mode 100644
index 0000000000..72c732c03e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o3.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" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O3Composite">
+
+ <service name="O3Service" promote="BComponent">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="BComponent">
+ <implementation.java class="foo.B" />
+ </component>
+
+ <reference name="O3Reference" promote="BComponent/i">
+ <interface.java interface="foo.I" />
+ </reference>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o4.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o4.composite
new file mode 100644
index 0000000000..f8f07eed09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/foo/o4.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://bar" xmlns:bar="http://bar"
+ name="O4Composite">
+
+ <service name="O4Service" promote="O3Component/O3Service">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="O3Component">
+ <implementation.composite name="bar:O3Composite" />
+ <reference name="O3Reference" target="O2Component/O2Service" />
+ </component>
+
+ <component name="O2Component">
+ <implementation.composite name="bar:O2Composite" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite
new file mode 100644
index 0000000000..4a6df023b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyInnerComposite.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"
+ targetNamespace="http://policy"
+ xmlns:policy="http://policy"
+ name="PolicyInnerComposite">
+
+ <service name="TargetService" promote="TargetServiceComponent">
+ </service>
+
+ <component name="TargetServiceComponent">
+ <implementation.java class="policy.TargetServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite
new file mode 100644
index 0000000000..25007aebb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyOuterComposite.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"
+ targetNamespace="http://policy"
+ xmlns:policy="http://policy"
+ requires="policy:TestIntent_1"
+ name="PolicyOuterComposite">
+
+ <component name="TargetClientComponent">
+ <implementation.java class="policy.TargetClientImpl"/>
+ <reference name="targetService" target="OuterTargetServiceComponent"/>
+ </component>
+
+ <component name="OuterTargetServiceComponent">
+ <implementation.composite name="policy:PolicyInnerComposite"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/definitions.xml b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/definitions.xml
new file mode 100644
index 0000000000..957028e3bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/policy/definitions.xml
@@ -0,0 +1,46 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://policy" >
+
+ <!-- Policy Intents -->
+ <sca:intent name="TestIntent_1" constrains="sca:implementation">
+ <description>Test Intent One</description>
+ </sca:intent>
+
+ <!-- Policy Sets -->
+ <sca:policySet name="TestPolicySet_1_composite"
+ provides="ip:TestIntent_1"
+ appliesTo="sca:implementation.composite"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_1_java"
+ provides="ip:TestIntent_1"
+ appliesTo="sca:implementation.java"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/test1/InnerComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/test1/InnerComposite.composite
new file mode 100644
index 0000000000..177fa10550
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/test1/InnerComposite.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://sample1"
+ xmlns:sample1="http://sample1"
+ name="InnerComposite">
+
+ <service name="Service_One" promote="ComponentOne">
+ <interface.java interface="test1.composite.Target"/>
+ </service>
+ <service name="Service_Two" promote="ComponentTwo">
+ <interface.java interface="test1.composite.Target"/>
+ </service>
+
+ <component name="ComponentOne">
+ <implementation.java class="test1.composite.TargetOne"/>
+ </component>
+ <component name="ComponentTwo">
+ <implementation.java class="test1.composite.TargetTwo"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/test1/OuterComposite.composite b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/test1/OuterComposite.composite
new file mode 100644
index 0000000000..d05a67f45f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/main/resources/test1/OuterComposite.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"
+ targetNamespace="http://sample1"
+ xmlns:sample1="http://sample1"
+ name="OuterComposite">
+ <component name="Test1TargetComponent">
+ <implementation.composite name="sample1:InnerComposite"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/circular/include/CircularIncludeTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/circular/include/CircularIncludeTestCase.java
new file mode 100644
index 0000000000..1f7c35dd91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/circular/include/CircularIncludeTestCase.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 circular.include;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.Test;
+
+public class CircularIncludeTestCase {
+
+ @Test
+ public void testCyclicInclude() {
+ SCADomain scaDomain = SCADomain.newInstance("Demo1Composite.composite");
+
+ DemoClass demoService = scaDomain.getService(DemoClass.class, "Demo1Component");
+ String demo = demoService.demo();
+ Assert.assertEquals("hello", demo);
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/CompositeTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/CompositeTestCase.java
new file mode 100644
index 0000000000..5482e47463
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/CompositeTestCase.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 composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeTestCase extends TestCase {
+
+ private SCADomain domain;
+ private Source source;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("OuterComposite.composite");
+ source = domain.getService(Source.class, "SourceComponent");
+ }
+
+ @Override
+ 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-android/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java
new file mode 100644
index 0000000000..f042113f7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.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 composite;
+
+import java.io.File;
+import java.net.URL;
+
+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 org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+public class LocateServiceEmbeddedSCADomainTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution contribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ // Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ File contribLocation = new File("./target/classes/");
+ URL contributionURL = contribLocation.toURL();
+ contribution = contributionService.contribute("http://contribution", contributionURL, false);
+ for (Composite deployable : contribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : contribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void testValidLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponent");
+ assertNotNull(source);
+ } catch (Throwable t) {
+ fail("Could not locate service");
+ }
+ }
+
+ public void testInvalidLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponentXXX");
+ // The source proxy can be created for the remote target but it will throw exception when a method is invoked
+ source.clientMethod("ABC");
+ fail("Expected to generate org.osoa.sca.ServiceRuntimeException but did not when invoking service with async");
+ } catch (org.osoa.sca.ServiceRuntimeException e) {
+ // expected.
+ }
+ }
+
+ public void testValidRecursiveLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponent/InnerSourceService");
+ assertNotNull(source);
+ } catch (Throwable t) {
+ fail("Could not locate service");
+ }
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://contribution");
+
+ // Stop Components from my composite
+ for (Composite deployable : contribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java
new file mode 100644
index 0000000000..87eb948452
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.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 composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class LocateServiceSCADomainTestCase extends TestCase {
+
+ private SCADomain domain;
+
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("OuterComposite.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void testValidLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponent");
+ assertNotNull(source);
+ } catch (Throwable t) {
+ fail("Could not locate service");
+ }
+ }
+
+ public void testInvalidLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponentXXX");
+ // The source proxy can be created for the remote target but it will throw exception when a method is invoked
+ source.clientMethod("ABC");
+ fail("Expected to generate org.osoa.sca.ServiceRuntimeException but did not when invoking service with async");
+ } catch (org.osoa.sca.ServiceRuntimeException e) {
+ // expected.
+ }
+ }
+
+ public void testValidRecursiveLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponent/InnerSourceService");
+ assertNotNull(source);
+ } catch (Throwable t) {
+ fail("Could not locate service");
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/foo/O2TestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/foo/O2TestCase.java
new file mode 100644
index 0000000000..d617ec8592
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/foo/O2TestCase.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 foo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class O2TestCase extends TestCase {
+
+ public void testGet() throws Exception {
+ SCADomain sca = SCADomain.newInstance("foo/o2.composite");
+ I i = sca.getService(I.class, "O1Component");
+ assertEquals("foo.A", i.get(0));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/foo/O4TestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/foo/O4TestCase.java
new file mode 100644
index 0000000000..15626c75ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/foo/O4TestCase.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 foo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class O4TestCase extends TestCase {
+
+ public void testO3Component() throws Exception {
+ SCADomain sca = SCADomain.newInstance("foo/o4.composite");
+ I i = sca.getService(I.class, "O3Component");
+ assertEquals("foo.A", i.get(0));
+ }
+
+ public void testO2Component() throws Exception {
+ SCADomain sca = SCADomain.newInstance("foo/o4.composite");
+ I i = sca.getService(I.class, "O2Component");
+ assertEquals("foo.A", i.get(0));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/policy/PolicyTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/policy/PolicyTestCase.java
new file mode 100644
index 0000000000..c9cc84f7d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/policy/PolicyTestCase.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 policy;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.impl.CompositeImpl;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PolicyTestCase {
+
+ private SCADomain domain;
+ private Target targetClient;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("policy/PolicyOuterComposite.composite");
+ targetClient = domain.getService(Target.class, "TargetClientComponent");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void test() throws Exception {
+ try {
+ //Check that the implementation policy sets don't flow down to the components
+ //implementations that are themselves composites (implementation.composite)
+ Component outerComponent = ((DefaultSCADomain)domain).getComponent("OuterTargetServiceComponent");
+
+ Assert.assertEquals(0, outerComponent.getPolicySets().size());
+
+ for (Component component :((CompositeImpl)outerComponent.getImplementation()).getComponents()){
+ Assert.assertEquals(0, component.getPolicySets().size());
+ }
+
+ // debugging
+ String result = targetClient.hello("Fred");
+
+ System.out.println(result);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/C.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/C.java
new file mode 100644
index 0000000000..bf8391348b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/C.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 sample;
+
+/**
+ * Simple Service
+ */
+public interface C {
+
+ /**
+ * Sample operation
+ *
+ * @return A String
+ */
+ String cOp();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/CImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/CImpl.java
new file mode 100644
index 0000000000..466284983e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/CImpl.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 sample;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a simple service
+ */
+@Service(C.class)
+public class CImpl implements C {
+
+ /**
+ * Reference to X
+ */
+ private X xRef;
+
+ /**
+ * Reference to Y
+ */
+ private Y yRef;
+
+ /**
+ * Setter for refX
+ *
+ * @param x Reference to X
+ */
+ @Reference(name="refX")
+ protected void setX(X x)
+ {
+ System.out.println("Setting X on CImpl to " + x);
+ xRef = x;
+ }
+
+ /**
+ * Setter for refY
+ *
+ * @param y Reference to Y
+ */
+ @Reference(name="refY")
+ protected void setY(Y y)
+ {
+ System.out.println("Setting Y on CImpl to " + y);
+ yRef = y;
+ }
+
+ /**
+ * Simple operation that uses the injected references to X and Y
+ *
+ * @return "C:cOp() - xResult = " + xRef.xOP() + " yResult = " + yRef.yOp();
+ */
+ public String cOp() {
+ Assert.assertNotNull(xRef);
+ Assert.assertNotNull(yRef);
+
+ String xResult = xRef.xOp();
+ String yResult = yRef.yOp();
+
+ return "C:cOp() - xResult = " + xResult + " yResult = " + yResult;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/NestedTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/NestedTestCase.java
new file mode 100644
index 0000000000..fc5d251460
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/NestedTestCase.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 sample;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+
+/**
+ * Test for implementation.composite using implementation.composite
+ */
+public class NestedTestCase extends TestCase {
+
+ /**
+ * Reference to the domain
+ */
+ private SCADomain domain;
+
+ /**
+ * Tear down the domain
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ /**
+ * This tests having:
+ *
+ * AComponent -> implementation.composite(BComposite)
+ * BComposite -> implementation.composite(CComposite)
+ *
+ * This test fails.
+ *
+ * @throws Exception Failed
+ */
+ public void testAComponent() throws Exception {
+ domain = SCADomain.newInstance("AComposite.composite");
+
+ System.out.println("Deployed names = " + domain.getComponentManager().getComponentNames());
+
+ C c = domain.getService(C.class, "AComponent");
+
+ String result = c.cOp();
+ System.out.println("Method call returned [" + result + "]");
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result.indexOf("C:cOp()") != -1);
+ Assert.assertTrue(result.indexOf("X:xOp()") != -1);
+ Assert.assertTrue(result.indexOf("Y:yOp()") != -1);
+ }
+
+
+ /**
+ * This tests having:
+ *
+ * BComposite -> implementation.composite(CComposite)
+ *
+ * This test works.
+ *
+ * @throws Exception Failed
+ */
+ public void testBComponent() throws Exception {
+ domain = SCADomain.newInstance("BComposite.composite");
+
+ System.out.println("Deployed names = " + domain.getComponentManager().getComponentNames());
+
+ C c = domain.getService(C.class, "BComponent");
+
+ String result = c.cOp();
+ System.out.println("Method call returned [" + result + "]");
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result.indexOf("C:cOp()") != -1);
+ Assert.assertTrue(result.indexOf("X:xOp()") != -1);
+ Assert.assertTrue(result.indexOf("Y:yOp()") != -1);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java
new file mode 100644
index 0000000000..a543add69b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.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 sample;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+//FIXME Fix this test case
+public class RecursiveCompositeTestCaseFIXME extends TestCase {
+
+ private SCADomain domain;
+ private Service1 tracker, tracker2;
+
+ @Override
+ 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");
+
+ }
+
+ @Override
+ 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-android/itest/recursive/src/test/java/sample/X.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/X.java
new file mode 100644
index 0000000000..e3a9335068
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/X.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 sample;
+
+/**
+ * Simple Service
+ */
+public interface X {
+
+ /**
+ * Simple Operation
+ *
+ * @return A String
+ */
+ String xOp();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/XImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/XImpl.java
new file mode 100644
index 0000000000..e430807568
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/XImpl.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 sample;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a simple service
+ */
+@Service(X.class)
+public class XImpl implements X {
+
+ /**
+ * Simple operation
+ *
+ * @return "X:xOp()"
+ */
+ public String xOp() {
+ return "X:xOp()";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/Y.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/Y.java
new file mode 100644
index 0000000000..c15a4f635a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/Y.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 sample;
+
+/**
+ * Simple Service
+ */
+public interface Y {
+
+ /**
+ * Simple Operation
+ *
+ * @return A String
+ */
+ String yOp();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/YImpl.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/YImpl.java
new file mode 100644
index 0000000000..994c9eb95f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/sample/YImpl.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.Service;
+
+/**
+ * Implementation of a Simple Service
+ */
+@Service(Y.class)
+public class YImpl implements Y {
+
+ /**
+ * A simple operation
+ *
+ * @return "Y:yOp()"
+ */
+ public String yOp() {
+ return "Y:yOp()";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test/InnerTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test/InnerTestCase.java
new file mode 100644
index 0000000000..ebb4bc7acb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test/InnerTestCase.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 test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class InnerTestCase extends TestCase {
+
+ private SCADomain domain;
+ private Aggregator aggregator;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("Inner.composite");
+ aggregator = domain.getService(Aggregator.class, "Aggregator");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ String result = aggregator.getAggregatedData();
+ assertTrue(result.contains("InnerSource"));
+ assertTrue(result.contains("InnerSource"));
+ System.out.println(result);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test/OuterTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test/OuterTestCase.java
new file mode 100644
index 0000000000..6e95f5808b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test/OuterTestCase.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 test;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class OuterTestCase {
+
+ private SCADomain domain;
+ private Aggregator aggregator;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("Outer.composite");
+ aggregator = domain.getService(Aggregator.class, "Inner");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+ @Ignore("TUSCANY-2484")
+ @Test
+ public void test() throws Exception {
+ String result = aggregator.getAggregatedData();
+ Assert.assertTrue(result.contains("InnerSource"));
+ Assert.assertTrue(result.contains("OuterSource"));
+ System.out.println(result);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java
new file mode 100644
index 0000000000..b3abcac06e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.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 test1.composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Simple client program that invokes the components that we wired together.
+ */
+public class CompositeClientTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Target target;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("test1/OuterComposite.composite");
+ target = scaDomain.getService(Target.class, "Test1TargetComponent/Service_Two");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testComposite() throws Exception {
+ String res = target.hello("Wang Feng");
+ assertEquals("TargetTwo: Hello Wang Feng!", res);
+ }
+
+ // Test for problem in TUSCANY-2010
+ public void testURLs() throws Exception {
+ try {
+ System.out.println("Component URI: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getURI());
+ System.out.println(" Service Name: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getName());
+ System.out.println(" Binding Name: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getName());
+ System.out.println(" Binding URI: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getURI());
+ assertEquals("/Test1TargetComponent/Service_One", scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getURI());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/pom.xml b/sca-java-1.x/branches/sca-android/itest/references/pom.xml
new file mode 100644
index 0000000000..5558936b92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-references</artifactId>
+ <name>Apache Tuscany SCA References Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java
new file mode 100644
index 0000000000..f8c0850118
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.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.references;
+
+public interface AComponent {
+
+ String fooB();
+
+ String fooC();
+
+ String fooBC();
+
+ String fooD1();
+
+ String fooD2();
+
+ String fooMultipleD();
+
+ String fooMultipleDArray();
+
+ String fooMultipleDServiceRef();
+
+ DComponent getDReference();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java
new file mode 100644
index 0000000000..647fff0159
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.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.itest.references;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+
+public class AComponentImpl implements AComponent {
+
+ @Reference(name = "bReference")
+ protected BComponent b;
+
+ @Reference
+ protected CComponent cReference;
+
+ @Reference(required = false)
+ protected DComponent dReference;
+
+ @Reference(name = "dReferences")
+ public Collection<DComponent> dReferences;
+
+ @Reference(name = "dReferenceArray")
+ public DComponent[] dReferenceArray;
+
+
+ @Reference(name = "dServiceReferences")
+ public List<ServiceReference<DComponent>> dServiceReferences;
+
+ private DComponent dReference1;
+
+ private DComponent dReference2;
+
+ @Reference(name = "dReference1")
+ public void setDReference(DComponent dReference) {
+ this.dReference1 = dReference;
+ }
+
+ @Reference
+ public void setDReference2(DComponent dReference2) {
+ this.dReference2 = dReference2;
+ }
+
+ public String fooB() {
+ return b.bFoo();
+ }
+
+ public String fooC() {
+ return cReference.cFoo();
+ }
+
+ public String fooBC() {
+ return b.fooC();
+ }
+
+ public String fooD() {
+ return dReference1.dFoo();
+ }
+
+ public String fooD1() {
+ return dReference1.dFoo();
+ }
+
+ public String fooD2() {
+ return dReference2.dFoo();
+ }
+
+ public String fooMultipleDArray() {
+ StringBuffer str = new StringBuffer();
+ for (DComponent d : dReferenceArray) {
+ str.append(d.getComponentName());
+ str.append(',');
+ }
+ if (str.length() > 0) {
+ str.deleteCharAt(str.length() - 1);
+ }
+ return str.toString();
+ }
+
+ public String fooMultipleD() {
+ StringBuffer str = new StringBuffer();
+ for (DComponent d : dReferences) {
+ str.append(d.getComponentName());
+ str.append(',');
+ }
+ if (str.length() > 0) {
+ str.deleteCharAt(str.length() - 1);
+ }
+ return str.toString();
+ }
+
+ public String fooMultipleDServiceRef() {
+ StringBuffer str = new StringBuffer();
+ for (ServiceReference<DComponent> d : dServiceReferences) {
+ str.append(d.getService().getComponentName());
+ str.append(',');
+ }
+ if (str.length() > 0) {
+ str.deleteCharAt(str.length() - 1);
+ }
+ return str.toString();
+ }
+
+ public DComponent getDReference() {
+ return dReference;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java
new file mode 100644
index 0000000000..785920bb2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.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.itest.references;
+
+public interface BComponent {
+
+ String bFoo();
+
+ String fooC();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java
new file mode 100644
index 0000000000..6b1065ab0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.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.references;
+
+import org.osoa.sca.annotations.Reference;
+
+public class BComponentImpl implements BComponent {
+
+ protected CComponent cReference;
+
+ public BComponentImpl(@Reference(name = "cReference") CComponent cReference) {
+ this.cReference = cReference;
+ }
+
+ public String bFoo() {
+ return "BComponent";
+ }
+
+ public String fooC() {
+ return "B" + cReference.cFoo();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java
new file mode 100644
index 0000000000..d436c28adc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.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.references;
+
+public interface CComponent {
+
+ String cFoo();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java
new file mode 100644
index 0000000000..a1823e1cdc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.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.references;
+
+public class CComponentImpl implements CComponent {
+
+ public String cFoo() {
+ return "CComponent";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java
new file mode 100644
index 0000000000..2618ec7095
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.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.references;
+
+import org.osoa.sca.annotations.Remotable;
+
+public interface DComponent {
+
+ String dFoo();
+ String getComponentName();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java
new file mode 100644
index 0000000000..79c802bc97
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.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.references;
+
+import org.osoa.sca.annotations.ComponentName;
+
+public class DComponentImpl implements DComponent {
+ @ComponentName
+ public String name;
+
+ public String dFoo() {
+ return "DComponent";
+ }
+
+ public String getComponentName() {
+ return name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/resources/AutoWiredReferencesTest.composite b/sca-java-1.x/branches/sca-android/itest/references/src/main/resources/AutoWiredReferencesTest.composite
new file mode 100644
index 0000000000..9f88f05abe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/resources/AutoWiredReferencesTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="AutowireReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autowire="true">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.references.AComponent" />
+ </service>
+
+ <component name="AComponent" autowire="false">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" autowire="true" />
+ <reference name="dReference1" />
+ <!--
+ <reference name="dReference1" target="DComponent" />
+ -->
+ <reference name="DReference2" target="DComponent" />
+ <reference name="dReferences" autowire="true" />
+ <reference name="dReferenceArray" autowire="true" />
+ <reference name="dServiceReferences" target="DComponent DComponent1" />
+
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/resources/InnerReferencesTest.composite b/sca-java-1.x/branches/sca-android/itest/references/src/main/resources/InnerReferencesTest.composite
new file mode 100644
index 0000000000..6cadc52c13
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/resources/InnerReferencesTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="InnerReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.references.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ <reference name="DReference2" target="DComponent" />
+ <reference name="dReferences" target="DComponent DComponent1" />
+ <reference name="dReferenceArray" target="DComponent1" />
+ <reference name="dServiceReferences" target="DComponent DComponent1" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.BComponentImpl" />
+ <reference name="cReference" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/main/resources/ManualWiredReferencesTest.composite b/sca-java-1.x/branches/sca-android/itest/references/src/main/resources/ManualWiredReferencesTest.composite
new file mode 100644
index 0000000000..3b546a34e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/main/resources/ManualWiredReferencesTest.composite
@@ -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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="ManualWiredReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autowire="true">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.references.AComponent" />
+ </service>
+
+ <component name="AComponent" >
+ <implementation.java class="org.apache.tuscany.sca.itest.references.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent/CComponent">
+ <binding.sca uri="DComponent"/>
+ </reference>
+ <reference name="dReference1" >
+ <binding.sca uri="DComponent"/>
+ </reference>
+ <reference name="DReference2" target="DComponent" >
+ <!-- binding.ws uri="DComponent"/-->
+ </reference>
+ <reference name="dReferences" target="DComponent DComponent1" />
+ <reference name="dReferenceArray" target="DComponent DComponent1" />
+ <reference name="dServiceReferences" target="DComponent DComponent1" />
+
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ <service name="DComponentImpl">
+ <binding.sca/>
+ <!-- binding.ws/-->
+ </service>
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java b/sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java
new file mode 100644
index 0000000000..b803f4bfa4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.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.itest.references;
+
+import static junit.framework.Assert.assertEquals;
+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 AutoWiredReferenceTestCase {
+ private static SCADomain domain;
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("AutoWiredReferencesTest.composite");
+ acomponent = domain.getService(AComponent.class, "AComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testD1Reference() {
+ acomponent.fooD1();
+ }
+
+ @Test
+ public void testD2Reference() {
+ assertEquals("DComponent", acomponent.fooD2());
+ }
+
+ @Test
+ public void testMultiDReferenceArray() {
+ String components = acomponent.fooMultipleDArray();
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test
+ public void testMultiDServiceReference() {
+ String components = acomponent.fooMultipleDServiceRef();
+ Assert.assertTrue(components.contains("DComponent"));
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.getDReference().dFoo();
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java b/sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java
new file mode 100644
index 0000000000..1d8284f0fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.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.itest.references;
+
+import static junit.framework.Assert.assertEquals;
+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 InnerReferenceTestCase {
+ private static SCADomain domain;
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("InnerReferencesTest.composite");
+ acomponent = domain.getService(AComponent.class, "AComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testD1Reference() {
+ assertEquals("DComponent", acomponent.fooD1());
+ }
+
+ @Test
+ public void testD2Reference() {
+ assertEquals("DComponent", acomponent.fooD2());
+ }
+
+ @Test
+ public void testMultiDReference() {
+ String components = acomponent.fooMultipleD();
+ Assert.assertTrue(components.contains("DComponent"));
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test
+ public void testMultiDReferenceArray() {
+ String components = acomponent.fooMultipleDArray();
+ Assert.assertTrue(components.equals("DComponent1"));
+ }
+
+ @Test
+ public void testMultiDServiceReference() {
+ String components = acomponent.fooMultipleDServiceRef();
+ Assert.assertTrue(components.contains("DComponent"));
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRequiredFalseReference() {
+ acomponent.getDReference().dFoo();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java b/sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java
new file mode 100644
index 0000000000..4b3a745a19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.references;
+
+import static junit.framework.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ManualWiredReferenceTestCase {
+ private static SCADomain domain;
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("ManualWiredReferencesTest.composite");
+ acomponent = domain.getService(AComponent.class, "AComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testD1Reference() {
+ acomponent.fooD1();
+ }
+
+ @Ignore
+ @Test
+ public void testD2Reference() {
+ assertEquals("DComponent", acomponent.fooD2());
+ }
+
+ @Test
+ public void testMultiDReferenceArray() {
+ String components = acomponent.fooMultipleDArray();
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test
+ public void testMultiDServiceReference() {
+ String components = acomponent.fooMultipleDServiceRef();
+ Assert.assertTrue(components.contains("DComponent"));
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.getDReference().dFoo();
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/scopes/pom.xml b/sca-java-1.x/branches/sca-android/itest/scopes/pom.xml
new file mode 100644
index 0000000000..cf7010ca91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/scopes/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <name>Apache Tuscany SCA Scopes Integration Tests</name>
+ <artifactId>itest-scopes</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java b/sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java
new file mode 100644
index 0000000000..4aa414be8e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.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.scopes;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Test Composite scope
+ */
+@Scope("COMPOSITE")
+public class CompositeScopeStateVerifierImpl implements StateVerifier {
+
+ // State data for this module (composite).
+ // In order to support thread-based state verification,
+ // the module state needs to be a ThreadLocal.
+ ThreadLocal<Integer> moduleState;
+
+ public CompositeScopeStateVerifierImpl() {
+ moduleState = new ThreadLocal<Integer>();
+ }
+
+ public void setState(int i) {
+ moduleState.set(i);
+ }
+
+ public boolean checkState(int i) {
+ return (moduleState.get() == i);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java b/sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java
new file mode 100644
index 0000000000..fae4dcd586
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.scopes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Test request scope
+ */
+@Scope("REQUEST")
+public class RequestScopeStateVerifierImpl implements StateVerifier {
+ // State data for this request thread.
+ int requestState;
+
+ public void setState(int i) {
+ requestState = i;
+ }
+
+ public boolean checkState(int i) {
+ return (requestState == i);
+ }
+
+ @Init
+ public void init() {
+ requestState = 0;
+ }
+
+ @Destroy
+ public void destroy() {
+ requestState = -1;
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java b/sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java
new file mode 100644
index 0000000000..878f7e4cc6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.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.scopes;
+
+public interface StateVerifier {
+ void setState(int i);
+ boolean checkState(int i);
+}
+
diff --git a/sca-java-1.x/branches/sca-android/itest/scopes/src/main/resources/scopes.composite b/sca-java-1.x/branches/sca-android/itest/scopes/src/main/resources/scopes.composite
new file mode 100644
index 0000000000..54a1b66830
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/scopes/src/main/resources/scopes.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="Scopes">
+
+ <!-- Components used to test scopes. -->
+
+ <component name="RequestScopeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.scopes.RequestScopeStateVerifierImpl"/>
+ </component>
+
+ <component name="ModuleScopeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.scopes.CompositeScopeStateVerifierImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java b/sca-java-1.x/branches/sca-android/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java
new file mode 100644
index 0000000000..ce2519cbc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.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.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.scopes.StateVerifier;
+
+public class ScopeTestCase extends TestCase {
+
+ final static int numThreads = 4; // number of threads to drive each scope container
+ final static int iterations = 200; // number of iterations per thread
+ private SCADomain domain;
+
+ // Test scope containers.
+ // The request scope container isn't hooked up for some reason so the code below
+ // that tests request scope is commented out.
+ // Code could be added to test session scope once it is supported in a standalone environment.
+
+ public void testScopes() throws InterruptedException {
+
+ Thread[] moduleScopeThreadTable = new Thread[numThreads];
+ Thread[] requestScopeThreadTable = new Thread[numThreads];
+
+ for(int i=0; i<numThreads; i++)
+ {
+ moduleScopeThreadTable[i] = new ModuleScopeTestThread();
+ requestScopeThreadTable[i] = new RequestScopeTestThread();
+ }
+ for(int j=0; j<numThreads; j++)
+ {
+ moduleScopeThreadTable[j].start();
+ requestScopeThreadTable[j].start();
+ }
+ for(int k=0; k<numThreads; k++)
+ {
+ moduleScopeThreadTable[k].join();
+ requestScopeThreadTable[k].join();
+ }
+ }
+
+ private class ModuleScopeTestThread extends Thread {
+ @Override
+ public void run() {
+ StateVerifier moduleScopeService = domain.getService(StateVerifier.class, "ModuleScopeComponent");
+ for(int i=1; i<=iterations; i++) {
+ moduleScopeService.setState(i);
+ if (!moduleScopeService.checkState(i))
+ fail("The module scope service lost its state on iteration " + i);
+ }
+ }
+ }
+
+ private class RequestScopeTestThread extends Thread {
+ @Override
+ public void run() {
+ StateVerifier requestScopeService = domain.getService(StateVerifier.class, "RequestScopeComponent");
+ for(int i=1; i<=iterations; i++) {
+ requestScopeService.setState(i);
+ if (!requestScopeService.checkState(i))
+ fail("The request scope service lost its state on iteration " + i);
+ }
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("scopes.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/pom.xml b/sca-java-1.x/branches/sca-android/itest/serialization/pom.xml
new file mode 100644
index 0000000000..9a6c3ea1e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-serialization</artifactId>
+ <name>Apache Tuscany SCA Serialization Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalService.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalService.java
new file mode 100644
index 0000000000..fa0f1c88d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalService.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.itest.servicereference;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * A very simple Conversational Service
+ *
+ * @version $Date$ $Revision$
+ */
+@Conversational
+@Callback(ConversationalServiceCallback.class)
+public interface ConversationalService {
+
+ /**
+ * Default value for the user data
+ *
+ * @See {@link #getUserData()}
+ * @See {@link #setUserData(String)}
+ */
+ String DEFAULT_USER_DATA = "NOT SET";
+
+ /**
+ * Retrieves the conversation ID for this Service
+ *
+ * @return The conversation ID for this Service
+ */
+ Object getConversationID();
+
+ /**
+ * Creates a self reference to this Service
+ *
+ * @return A self reference to this Service
+ */
+ ServiceReference<ConversationalService> createSelfRef();
+
+ /**
+ * Sets some user data on the instance
+ *
+ * @param a_Data Some data
+ *
+ * @See {@link #getUserData()}
+ */
+ void setUserData(String a_Data);
+
+ /**
+ * Gets some user data on the instance
+ *
+ * @return Some data
+ *
+ * @See {@link #setUserData(String)}
+ */
+ String getUserData();
+
+ /**
+ * Method that triggers the callback.
+ *
+ * @param msg A message to pass with the callback
+ * @throws Exception Test failed
+ */
+ void triggerCallback(String msg) throws Exception;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceCallback.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceCallback.java
new file mode 100644
index 0000000000..85d5dd860c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceCallback.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.itest.servicereference;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * This is the callback for the ConversationalService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Conversational
+public interface ConversationalServiceCallback {
+
+ /**
+ * Simple callback method.
+ *
+ * @param msg The message for the call back
+ */
+ void callback(String msg);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceImpl.java
new file mode 100644
index 0000000000..50c98d1afc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceImpl.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.servicereference;
+
+import org.apache.tuscany.sca.itest.servicereference.utils.ServiceReferenceUtils;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+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.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service implementation
+ *
+ * @version $Date$ $Revision$
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+public class ConversationalServiceImpl implements ConversationalService {
+
+ /**
+ * The Conversation ID
+ */
+ private Object m_ConversationID;
+
+ /**
+ * Injected reference to the call back.
+ */
+ @Callback
+ protected CallableReference<ConversationalServiceCallback> theCallbackRef;
+
+ /**
+ * Injected reference to the ComponentContext.
+ */
+ @Context
+ protected ComponentContext m_Ctx;
+
+ /**
+ * Some user data
+ */
+ private String m_UserData = DEFAULT_USER_DATA;
+
+ /**
+ * Constructor
+ */
+ public ConversationalServiceImpl() {
+ }
+
+ /**
+ * Used to inject the Conversation ID
+ *
+ * @param a_ConversationID the Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(Object a_ConversationID) {
+ m_ConversationID = a_ConversationID;
+ }
+
+ /**
+ * Retrieves the conversation ID for this Service
+ *
+ * @return The conversation ID for this Service
+ */
+ public Object getConversationID() {
+ return m_ConversationID;
+ }
+
+ /**
+ * Creates a self reference to this Service
+ *
+ * @return A self reference to this Service
+ */
+ public ServiceReference<ConversationalService> createSelfRef() {
+ return m_Ctx.createSelfReference(ConversationalService.class);
+ }
+
+ /**
+ * Sets some user data on the instance
+ *
+ * @param a_Data Some data
+ *
+ * @See {@link #getUserData()}
+ */
+ public void setUserData(String a_Data) {
+ m_UserData = a_Data;
+ }
+
+ /**
+ * Gets some user data on the instance
+ *
+ * @return Some data
+ *
+ * @See {@link #setUserData(String)}
+ */
+ public String getUserData() {
+ return m_UserData;
+ }
+
+ /**
+ * Method that triggers the callback.
+ *
+ * @param msg A message to pass with the callback
+ * @throws Exception Test failed
+ */
+ public void triggerCallback(String msg) throws Exception {
+ Assert.assertNotNull(theCallbackRef);
+
+ // Serialize the CallableReference
+ byte[] serializedCR = ServiceReferenceUtils.serialize(theCallbackRef);
+ Assert.assertNotNull(serializedCR);
+
+ // Deserlaize the CallableReference
+ CallableReference<?> cr = ServiceReferenceUtils.deserializeCallableReference(serializedCR);
+ Assert.assertNotNull(cr);
+ CallableReference<ConversationalServiceCallback> regotCallbackRef
+ = (CallableReference<ConversationalServiceCallback>) cr;
+
+ // Use the deseralized CallbackReference
+ regotCallbackRef.getService().callback(msg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClient.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClient.java
new file mode 100644
index 0000000000..c268f9bda7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClient.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.itest.servicereference;
+
+
+/**
+ * This is a test client that is used to test Serializing and Deserializing
+ * ServiceReferences within a SCA Application
+ *
+ * @version $Date$ $Revision$
+ */
+public interface SCAManagedClient {
+
+ /**
+ * Tests Serializing a Stateless ServiceReference
+ *
+ * @throws Exception Test failed
+ */
+ void testSerializeStatelessServiceReference() throws Exception;
+
+ /**
+ * Tests Serializing a Nested Stateless ServiceReference.
+ *
+ * @throws Exception Test failed
+ */
+ void testSerializeNestedStatelessServiceReference() throws Exception;
+
+ /**
+ * Tests Serializing a Callback to a Stateless Service as managed
+ * SCA code
+ *
+ * @throws Exception Test failed
+ */
+ void testSerializeCallbackToStatelessServiceInsideSCA() throws Exception;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClientImpl.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClientImpl.java
new file mode 100644
index 0000000000..cf0307eb8e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClientImpl.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.itest.servicereference;
+
+import org.apache.tuscany.sca.itest.servicereference.utils.ServiceReferenceUtils;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is a test client that is used to test Serializing and Deserializing
+ * ServiceReferences within a SCA Application
+ *
+ * @version $Date$ $Revision$
+ */
+@Service(SCAManagedClient.class)
+public class SCAManagedClientImpl implements SCAManagedClient, StatelessServiceCallback {
+
+ /**
+ * Injected reference to the StatelessService
+ */
+ @Reference(name = "statelessService")
+ protected ServiceReference<StatelessService> statelessServiceRef;
+
+ /**
+ * Injected reference to the Nested StatelessService.
+ */
+ @Reference(name = "nestedStatelessService")
+ protected ServiceReference<StatelessService> nestedStatelessServiceRef;
+
+ /**
+ * Tests Serializing a Stateless ServiceReference
+ *
+ * @throws Exception Test failed
+ */
+ public void testSerializeStatelessServiceReference() throws Exception {
+ doTestSerializeStatelessServiceReference(statelessServiceRef);
+ }
+
+ /**
+ * Tests Serializing a Nested Stateless ServiceReference.
+ *
+ * @throws Exception Test failed
+ */
+ public void testSerializeNestedStatelessServiceReference() throws Exception {
+ doTestSerializeStatelessServiceReference(nestedStatelessServiceRef);
+ }
+
+ /**
+ * Tests Serializing a Stateless ServiceReference.
+ *
+ * @throws Exception Test failed
+ */
+ private void doTestSerializeStatelessServiceReference(
+ ServiceReference<StatelessService> aServiceRef) throws Exception {
+ Assert.assertNotNull(aServiceRef);
+
+ StatelessService service = aServiceRef.getService();
+ service.getCurrentTime();
+
+ // Serialize the ServiceReference
+ byte[] serializedSR = ServiceReferenceUtils.serialize(aServiceRef);
+ Assert.assertNotNull(serializedSR);
+
+ // Deserialize the ServiceReference
+ ServiceReference<?> deserializedSR = ServiceReferenceUtils.deserializeServiceReference(serializedSR);
+ Assert.assertNotNull(deserializedSR);
+ ServiceReference<StatelessService> regotServiceRef = (ServiceReference<StatelessService>) deserializedSR;
+ Assert.assertNotNull(regotServiceRef);
+
+ // Use the ServiceReference to access the Service.
+ StatelessService regotService = regotServiceRef.getService();
+ Assert.assertNotNull(regotService);
+ }
+
+ /**
+ * Simple callback method
+ *
+ * @param msg The call back message
+ */
+ public void callback(String msg) {
+ System.out.println("Stateless Callback with message " + msg);
+ }
+
+ /**
+ * Tests Serializing a Callback to a Stateless Service as managed
+ * SCA code
+ *
+ * @throws Exception Test failed
+ */
+ public void testSerializeCallbackToStatelessServiceInsideSCA() throws Exception {
+ Assert.assertNotNull(statelessServiceRef);
+
+ StatelessService service = statelessServiceRef.getService();
+ String msg = "A message for the callback " + System.currentTimeMillis();
+ service.triggerCallback(msg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClient.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClient.java
new file mode 100644
index 0000000000..deb8f75816
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClient.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.servicereference;
+
+import org.osoa.sca.annotations.Conversational;
+
+
+/**
+ * This is a test client that is used to test Serializing and Deserializing
+ * ServiceReferences within a SCA Application where the client that the Callback
+ * is referring is actually Conversational.
+ *
+ * @version $Rev$ $Date$
+ */
+@Conversational
+public interface SCAManagedConversationalClient {
+
+ /**
+ * Tests Serializing a Conversational ServiceReference.
+ *
+ * @throws Exception Test failed
+ */
+ void testSerializeConversationalServiceReference() throws Exception;
+
+ /**
+ * Tests Serializing a Nested Conversational ServiceReference.
+ *
+ * @throws Exception Test failed
+ */
+ void testSerializeNestedConversationalServiceReference() throws Exception;
+
+ /**
+ * Tests Serializing a Callback to a Conversational Service as managed
+ * SCA code.
+ *
+ * @throws Exception Test failed
+ */
+ void testSerializeCallbackToConversationalServiceInsideSCA() throws Exception;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClientImpl.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClientImpl.java
new file mode 100644
index 0000000000..60ecb7717a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClientImpl.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.itest.servicereference;
+
+import org.apache.tuscany.sca.itest.servicereference.utils.ServiceReferenceUtils;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is a test client that is used to test Serializing and Deserializing
+ * ServiceReferences within a SCA Application
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(SCAManagedConversationalClient.class)
+@Scope("CONVERSATION")
+public class SCAManagedConversationalClientImpl implements SCAManagedConversationalClient, ConversationalServiceCallback {
+
+ /**
+ * Injected reference to the ConversationalService.
+ */
+ @Reference(name = "conversationalService")
+ protected ServiceReference<ConversationalService> conversationalServiceRef;
+
+ /**
+ * Injected reference to the ConversationalService.
+ */
+ @Reference(name = "nestedConversationalService")
+ protected ServiceReference<ConversationalService> nestedConversationalServiceRef;
+
+ /**
+ * This is the message that we sent to the callback.
+ */
+ private String messageSentToCallback;
+
+ /**
+ * Tests Serializing a Conversational ServiceReference.
+ *
+ * @throws Exception Test failed
+ */
+ public void testSerializeConversationalServiceReference() throws Exception {
+ doTestSerializeConversationalServiceReference(conversationalServiceRef);
+ }
+
+ /**
+ * Tests Serializing a Nested Conversational ServiceReference.
+ *
+ * @throws Exception Test failed
+ */
+ public void testSerializeNestedConversationalServiceReference() throws Exception {
+ doTestSerializeConversationalServiceReference(nestedConversationalServiceRef);
+ }
+
+ /**
+ * Test Serializing a Conversational ServiceReference.
+ *
+ * @param aServiceRef The Reference to Serialize
+ * @throws Exception Test failed.
+ */
+ private void doTestSerializeConversationalServiceReference(ServiceReference<ConversationalService> aServiceRef) throws Exception {
+ Assert.assertNotNull(aServiceRef);
+
+ ConversationalService service = aServiceRef.getService();
+ Object origConvID = service.getConversationID();
+ Assert.assertNotNull(origConvID);
+
+ // Serialize the ServiceReference
+ byte[] serializedSR = ServiceReferenceUtils.serialize(aServiceRef);
+ Assert.assertNotNull(serializedSR);
+
+ // Deserialize the ServiceReference
+ ServiceReference<?> deserializedSR = ServiceReferenceUtils.deserializeServiceReference(serializedSR);
+ Assert.assertNotNull(deserializedSR);
+ ServiceReference<ConversationalService> regotServiceRef = (ServiceReference<ConversationalService>) deserializedSR;
+ Assert.assertNotNull(regotServiceRef);
+
+ // Use the ServiceReference to access the Service.
+ ConversationalService regotService = regotServiceRef.getService();
+ Assert.assertNotNull(regotService);
+ Object regotConvID = regotService.getConversationID();
+ Assert.assertNotNull(regotConvID);
+
+ // Make sure we have the same Conversation ID
+ Assert.assertEquals(origConvID, regotConvID);
+ }
+
+
+ /**
+ * Tests Serializing a Callback to a Conversational Service as managed
+ * SCA code.
+ *
+ * @throws Exception Test failed
+ */
+ public void testSerializeCallbackToConversationalServiceInsideSCA() throws Exception {
+ Assert.assertNotNull(conversationalServiceRef);
+
+ ConversationalService service = conversationalServiceRef.getService();
+ messageSentToCallback = "A message for the callback " + System.currentTimeMillis();
+ service.triggerCallback(messageSentToCallback);
+ }
+
+ /**
+ * Simple callback method.
+ *
+ * @param msg The call back message
+ */
+ public void callback(String msg) {
+ System.out.println("Stateless Callback with message " + msg);
+
+ // Make sure we received the message we expected
+ Assert.assertEquals(messageSentToCallback, msg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessService.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessService.java
new file mode 100644
index 0000000000..8a1fe48436
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessService.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.servicereference;
+
+import org.osoa.sca.annotations.Callback;
+
+
+/**
+ * A very simple Stateless Service
+ *
+ * @version $Date$ $Revision$
+ */
+@Callback(StatelessServiceCallback.class)
+public interface StatelessService {
+
+ /**
+ * Gets the current time
+ *
+ * @return The current time
+ */
+ String getCurrentTime();
+
+ /**
+ * Method that triggers the callback
+ *
+ * @param msg A message to pass with the callback
+ * @throws Exception Test failed
+ */
+ void triggerCallback(String msg) throws Exception;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceCallback.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceCallback.java
new file mode 100644
index 0000000000..ffe3a3b8ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceCallback.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.itest.servicereference;
+
+/**
+ * This is the callback for the StatelessService
+ *
+ * @version $Date$ $Revision$
+ */
+public interface StatelessServiceCallback {
+
+ /**
+ * Simple callback method
+ *
+ * @param msg The message for the call back
+ */
+ void callback(String msg);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceImpl.java
new file mode 100644
index 0000000000..24d43f79e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceImpl.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.itest.servicereference;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.tuscany.sca.itest.servicereference.utils.ServiceReferenceUtils;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple Stateless Service implementation
+ *
+ * @version $Date$ $Revision$
+ */
+@Service(StatelessService.class)
+public class StatelessServiceImpl implements StatelessService {
+
+ /**
+ * Injected reference to the call back
+ */
+ @Callback
+ protected CallableReference<StatelessServiceCallback> theCallbackRef;
+
+ /**
+ * Constructor
+ */
+ public StatelessServiceImpl() {
+ }
+
+ /**
+ * Gets the current time
+ *
+ * @return The current time
+ */
+ public String getCurrentTime() {
+ SimpleDateFormat sdf = new SimpleDateFormat();
+ return sdf.format(new Date());
+ }
+
+ /**
+ * Method that triggers the callback
+ *
+ * @param msg A message to pass with the callback
+ * @throws Exception Test failed
+ */
+ public void triggerCallback(String msg) throws Exception {
+ Assert.assertNotNull(theCallbackRef);
+
+ // Serialize the CallableReference
+ byte[] serializedCR = ServiceReferenceUtils.serialize(theCallbackRef);
+ Assert.assertNotNull(serializedCR);
+
+ // Deserlaize the CallableReference
+ CallableReference<?> cr = ServiceReferenceUtils.deserializeCallableReference(serializedCR);
+ Assert.assertNotNull(cr);
+ CallableReference<StatelessServiceCallback> regotCallbackRef
+ = (CallableReference<StatelessServiceCallback>) cr;
+
+ // Use the deseralized CallbackReference
+ regotCallbackRef.getService().callback(msg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/utils/ServiceReferenceUtils.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/utils/ServiceReferenceUtils.java
new file mode 100644
index 0000000000..2749891bd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/utils/ServiceReferenceUtils.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.servicereference.utils;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * Utility methods that are used by the ServiceReference Serialization tests
+ *
+ * @version $Date $Revision$
+ */
+public final class ServiceReferenceUtils {
+
+ /**
+ * Constructor
+ */
+ private ServiceReferenceUtils() {
+ }
+
+ /**
+ * Serializes the specified Object to a byte[]
+ *
+ * @param obj The Object to Serialize
+ * @return The Serialized Object as a byte[]
+ * @throws IOException Failed to Serialize the Object
+ */
+ public static byte[] serialize(Object obj) throws IOException {
+ ByteArrayOutputStream bos = null;
+ try {
+ ObjectOutputStream oos = null;
+ bos = new ByteArrayOutputStream();
+ try {
+ oos = new ObjectOutputStream(bos);
+ oos.writeObject(obj);
+ oos.flush();
+ } finally {
+ if (oos != null) {
+ oos.close();
+ }
+ }
+ } finally {
+ if (bos != null) {
+ bos.close();
+ }
+ }
+
+ return bos.toByteArray();
+ }
+
+ /**
+ * Deserializes the specified byte[] into a ServiceReference
+ *
+ * @param serializedSR The Serialized ServiceReference to deserialize
+ * @return The deserialized ServiceReference
+ * @throws IOException Failed to deserialize the ServiceReference
+ * @throws ClassNotFoundException Failed to deserialize the ServiceReference
+ */
+ public static ServiceReference<?> deserializeServiceReference(byte[] serializedSR)
+ throws IOException, ClassNotFoundException {
+ return (ServiceReference<?>) deserialize(serializedSR);
+ }
+
+ /**
+ * Deserializes the specified byte[] into a CallableReference
+ *
+ * @param callableRef The Serialized CallableReference to deserialize
+ * @return The deserialized ServiceReference
+ * @throws IOException Failed to deserialize the CallableReference
+ * @throws ClassNotFoundException Failed to deserialize the CallableReference
+ */
+ public static CallableReference<?> deserializeCallableReference(byte[] callableRef)
+ throws IOException, ClassNotFoundException {
+ return (CallableReference<?>) deserialize(callableRef);
+ }
+
+ /**
+ * Deserializes the specified byte[] into an Object
+ *
+ * @param serializedObj The Serialized Object to deserialize
+ * @return The deserialized Object
+ * @throws IOException Failed to deserialize the Object
+ * @throws ClassNotFoundException Failed to deserialize the Object
+ */
+ public static Object deserialize(byte[] serializedSR) throws IOException, ClassNotFoundException {
+ ByteArrayInputStream bis = null;
+ try {
+ ObjectInputStream ois = null;
+ bis = new ByteArrayInputStream(serializedSR);
+ try {
+ ois = new ObjectInputStream(bis);
+ Object obj = ois.readObject();
+ return obj;
+ } finally {
+ if (ois != null) {
+ ois.close();
+ }
+ }
+ } finally {
+ if (bis != null) {
+ bis.close();
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/resources/ServiceReferenceSerializationTest.composite b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/resources/ServiceReferenceSerializationTest.composite
new file mode 100644
index 0000000000..28c32d6fa4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/resources/ServiceReferenceSerializationTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="ServiceReferenceSerializationTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="StatelessComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.servicereference.StatelessServiceImpl" />
+ </component>
+
+ <component name="ConversationalComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.servicereference.ConversationalServiceImpl" />
+ </component>
+
+ <component name="SCAManagedClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.servicereference.SCAManagedClientImpl" />
+ <reference name="statelessService" target="StatelessComponent"/>
+ <reference name="nestedStatelessService" target="NestedComponent/StatelessNestedService"/>
+ </component>
+
+ <component name="SCAManagedConversationalClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.servicereference.SCAManagedConversationalClientImpl" />
+ <reference name="conversationalService" target="ConversationalComponent"/>
+ <reference name="nestedConversationalService" target="NestedComponent/ConversationalNestedService"/>
+ </component>
+
+ <component name="NestedComponent">
+ <implementation.composite name="foo:NestedComposite" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/main/resources/nestedcomposite.composite b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/resources/nestedcomposite.composite
new file mode 100644
index 0000000000..8e1a132b0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/main/resources/nestedcomposite.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="NestedComposite" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="StatelessNestedService" promote = "StatelessNestedComponent"/>
+
+ <service name="ConversationalNestedService" promote = "ConversationalNestedComponent"/>
+
+ <component name="StatelessNestedComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.servicereference.StatelessServiceImpl" />
+ </component>
+
+ <component name="ConversationalNestedComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.servicereference.ConversationalServiceImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/serialization/src/test/java/org/apache/tuscany/sca/itest/servicereference/SerializeServiceReferenceTestCase.java b/sca-java-1.x/branches/sca-android/itest/serialization/src/test/java/org/apache/tuscany/sca/itest/servicereference/SerializeServiceReferenceTestCase.java
new file mode 100644
index 0000000000..76e77284fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/serialization/src/test/java/org/apache/tuscany/sca/itest/servicereference/SerializeServiceReferenceTestCase.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.servicereference;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * A test case that will attempt to Serialize and Deserialize Service References
+ *
+ * @version $Date$ $Revision$
+ */
+public class SerializeServiceReferenceTestCase {
+ /**
+ * Reference to the SCA Domain
+ */
+ private static SCADomain domain;
+
+ /**
+ * Initialise the SCA Domain
+ *
+ * @throws Exception Failed to initialise the SCA Domain
+ */
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("ServiceReferenceSerializationTest.composite");
+ Assert.assertNotNull(domain);
+ }
+
+ /**
+ * Shutdown the SCA Domain
+ *
+ * @throws Exception Failed to shutdown the SCA Domain
+ */
+ @AfterClass
+ public static void destroy() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ /**
+ * Tests Serializing a Stateless ServiceReference as managed
+ * SCA code
+ *
+ * @throws Exception Test failed
+ */
+ @Test
+ public void testSerializeStatelessServiceReferenceInsideSCA() throws Exception {
+ SCAManagedClient client = domain.getService(
+ SCAManagedClient.class, "SCAManagedClientComponent");
+
+ client.testSerializeStatelessServiceReference();
+ }
+
+ /**
+ * Tests Serializing a Nested Stateless ServiceReference as managed
+ * SCA code.
+ *
+ * @throws Exception Test failed
+ */
+ @Test
+ public void testSerializeNestedStatelessServiceReferenceInsideSCA() throws Exception {
+ SCAManagedClient client = domain.getService(
+ SCAManagedClient.class, "SCAManagedClientComponent");
+
+ client.testSerializeNestedStatelessServiceReference();
+ }
+
+ /**
+ * Tests Serializing a Conversational ServiceReference as managed
+ * SCA code
+ *
+ * @throws Exception Test failed
+ */
+ @Test
+ public void testSerializeConversationalServiceReferenceInsideSCA() throws Exception {
+ SCAManagedConversationalClient client = domain.getService(
+ SCAManagedConversationalClient.class, "SCAManagedConversationalClientComponent");
+
+ client.testSerializeConversationalServiceReference();
+ }
+
+ /**
+ * Tests Serializing a Nested Conversational ServiceReference as managed
+ * SCA code.
+ *
+ * @throws Exception Test failed
+ */
+ @Test
+ public void testSerializeNestedConversationalServiceReferenceInsideSCA() throws Exception {
+ SCAManagedConversationalClient client = domain.getService(
+ SCAManagedConversationalClient.class, "SCAManagedConversationalClientComponent");
+
+ client.testSerializeNestedConversationalServiceReference();
+ }
+
+ /**
+ * Tests Serializing a Callback to a Stateless Service as managed
+ * SCA code
+ *
+ * @throws Exception Test failed
+ */
+ @Test
+ public void testSerializeCallbackToStatelessServiceInsideSCA() throws Exception {
+ SCAManagedClient client = domain.getService(
+ SCAManagedClient.class, "SCAManagedClientComponent");
+
+ client.testSerializeCallbackToStatelessServiceInsideSCA();
+ }
+
+ /**
+ * Tests Serializing a Callback to a Conversational Service as managed
+ * SCA code.
+ *
+ * @throws Exception Test failed
+ */
+ @Test
+ public void testSerializeCallbackToConversationalServiceInsideSCA() throws Exception {
+ SCAManagedConversationalClient client = domain.getService(
+ SCAManagedConversationalClient.class, "SCAManagedConversationalClientComponent");
+
+ client.testSerializeCallbackToConversationalServiceInsideSCA();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/pom.xml b/sca-java-1.x/branches/sca-android/itest/services/pom.xml
new file mode 100644
index 0000000000..fdd5213a47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-services</artifactId>
+ <name>Apache Tuscany SCA Services Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java
new file mode 100644
index 0000000000..1304ba4288
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.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.services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AComponent {
+ String foo();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java
new file mode 100644
index 0000000000..3577e09add
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.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.services;
+
+public class AComponentImpl implements AComponent {
+
+ public String foo() {
+ return "AComponent";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java
new file mode 100644
index 0000000000..2e9b56d64d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.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.services;
+
+public interface BComponent {
+
+ String foo();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java
new file mode 100644
index 0000000000..cda3f38636
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.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.itest.services;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+public class BComponentImpl implements BComponent {
+
+ public String foo() {
+ return "BComponent";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java
new file mode 100644
index 0000000000..39806a8101
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.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.services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CComponent {
+ String foo();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java
new file mode 100644
index 0000000000..8713e5ab22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.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.services;
+
+public class CComponentImpl implements CComponent {
+
+ public String foo() {
+ return "CComponent";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java
new file mode 100644
index 0000000000..aa745deb63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.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.services;
+
+
+public interface D1Component {
+ String foo1();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java
new file mode 100644
index 0000000000..83da15089f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.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.services;
+
+
+public interface DComponent {
+ String foo();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java
new file mode 100644
index 0000000000..36189f94bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.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.itest.services;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces = {DComponent.class, D1Component.class})
+public class DComponentImpl implements DComponent, D1Component {
+
+ public String foo() {
+ return "DComponent";
+ }
+
+ public String foo1() {
+ return "DComponent";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/services/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..37ea8f677d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/resources/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" targetNamespace="http://foo" xmlns:foo="http://foo">
+ <deployable composite="foo:InnerServicesTest" />
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/main/resources/ServicesTest.composite b/sca-java-1.x/branches/sca-android/itest/services/src/main/resources/ServicesTest.composite
new file mode 100644
index 0000000000..eda885f9ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/main/resources/ServicesTest.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="InnerServicesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="AComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.AComponentImpl" />
+ </component>
+
+ <component name="AComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.AComponentImpl" />
+ <service name="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.AComponent" />
+ </service>
+ </component>
+
+ <component name="BComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.BComponentImpl" />
+ </component>
+
+ <component name="BComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.BComponentImpl" />
+ <service name="BComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.BComponent" />
+ </service>
+ </component>
+
+ <component name="CComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.CComponentImpl" />
+ </component>
+
+ <component name="CComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.CComponentImpl" />
+ <service name="CComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.CComponent" />
+ </service>
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.DComponentImpl" />
+ </component>
+
+ <component name="DComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.DComponentImpl" />
+ <service name="DComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.DComponent" />
+ </service>
+ <service name="D1Component">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.D1Component" />
+ </service>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java b/sca-java-1.x/branches/sca-android/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java
new file mode 100644
index 0000000000..ba6cac279c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.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.itest.services;
+
+import static junit.framework.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class ServicesTestCase {
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ if (domain == null) {
+ domain = SCADomain.newInstance("ServicesTest.composite");
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testAService() {
+ AComponent a1 = domain.getService(AComponent.class, "AComponent1");
+ assertEquals("AComponent", a1.foo());
+
+ AComponent a2 = domain.getService(AComponent.class, "AComponent2/AComponent");
+ assertEquals("AComponent", a2.foo());
+ }
+
+ @Test
+ public void testBService() {
+ BComponent a1 = domain.getService(BComponent.class, "BComponent1");
+ assertEquals("BComponent", a1.foo());
+
+ BComponent a2 = domain.getService(BComponent.class, "BComponent2/BComponent");
+ assertEquals("BComponent", a2.foo());
+ }
+
+ @Test
+ public void testCService() {
+ CComponent a1 = domain.getService(CComponent.class, "CComponent1");
+ assertEquals("CComponent", a1.foo());
+
+ CComponent a2 = domain.getService(CComponent.class, "CComponent2/CComponent");
+ assertEquals("CComponent", a2.foo());
+ }
+
+ @Test
+ public void testDService() {
+ DComponent a1 = domain.getService(DComponent.class, "DComponent1/DComponent");
+ assertEquals("DComponent", a1.foo());
+
+ D1Component a2 = domain.getService(D1Component.class, "DComponent1/D1Component");
+ assertEquals("DComponent", a2.foo1());
+
+ try {
+ domain.getService(DComponent.class, "DComponent1");
+ Assert.fail("The service name is required");
+ } catch (ServiceRuntimeException e) {
+ Assert.assertTrue("The service name is required", true);
+ }
+
+ DComponent a3 = domain.getService(DComponent.class, "DComponent2/DComponent");
+ assertEquals("DComponent", a3.foo());
+
+ D1Component a4 = domain.getService(D1Component.class, "DComponent2/D1Component");
+ assertEquals("DComponent", a4.foo1());
+
+ }
+
+ public static void main(String[] args) throws Exception {
+ ServicesTestCase.init();
+ ServicesTestCase tester = new ServicesTestCase();
+ tester.testAService();
+ tester.testBService();
+ tester.testCService();
+ tester.testDService();
+ ServicesTestCase.destroy();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/pom.xml b/sca-java-1.x/branches/sca-android/itest/spring/pom.xml
new file mode 100644
index 0000000000..331b9c4c17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-spring</artifactId>
+ <name>Apache Tuscany SCA Implementation.spring Integration Tests</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-transaction</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Spring dependencies... -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.0.8</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.0.8</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.0.8</version>
+ </dependency>
+
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/META-INF/sca/SpringDelegationHelloWorld-context.xml b/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/META-INF/sca/SpringDelegationHelloWorld-context.xml
new file mode 100644
index 0000000000..18ab7e332d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/META-INF/sca/SpringDelegationHelloWorld-context.xml
@@ -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.
+-->
+<!-- Application context for the SpringHelloWorld testcase -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+ <bean id="delegateBean"
+ class="org.apache.tuscany.sca.itest.spring.TestHelloWorldBean" lazy-init="true">
+ </bean>
+
+ <bean id="testBean"
+ class="org.apache.tuscany.sca.itest.spring.TestHelloWorldDelegatorBean" lazy-init="true">
+ <property name="delegate"><ref bean="delegateBean"/></property>
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml b/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
new file mode 100644
index 0000000000..62e4e077b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.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.
+-->
+<!-- Application context for the SpringHelloWorld testcase -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.sca.itest.spring.TestHelloWorldBean" lazy-init="true">
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite b/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite
new file mode 100644
index 0000000000..70b2d5fdab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.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="SpringHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.spring.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="META-INF/sca/SpringDelegationHelloWorld-context.xml"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite b/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite
new file mode 100644
index 0000000000..bab9ecb528
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.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="SpringHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.spring.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="META-INF/sca/SpringHelloWorld-context.xml"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..634e3d34af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.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.spring;
+
+
+/**
+ * Basic "hello world" style test case for testing Spring component implementation
+ *
+ */
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ /**
+ * Calls the hello world service and checks that it gives the right response...
+ */
+ public void testHello() 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-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java
new file mode 100644
index 0000000000..aeb7918add
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.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.itest.spring;
+
+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;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ service = domain.getService(getServiceClass(), "ClientComponent");
+ }
+
+ abstract protected Class<T> getServiceClass();
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ String compositeName = className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ System.out.println("Using composite: " + compositeName);
+ return compositeName;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java
new file mode 100644
index 0000000000..3957e49bf3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.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.itest.spring;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Interface for the "hello world" service - predictably simple with a single operation
+ * "sayHello"
+ *
+ */
+@Remotable
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java
new file mode 100644
index 0000000000..d75d19295d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.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.itest.spring;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * A simple proxy Java class which implements the HelloWorld interface but which uses
+ * a reference "delegate" to actually provide the HelloWorld service
+ *
+ */
+public class HelloWorldProxy implements HelloWorld {
+
+ // Here is the reference "delegate" - it implements the HelloWorld interface...
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ // Simply call the reference to satisfy the service request...
+ System.out.println("HelloWorldProxy - calling sayHello");
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java
new file mode 100644
index 0000000000..4088691ccd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.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.itest.spring;
+
+/**
+ * A basic test case of:
+ * 1) A composite containing a component with a Spring implementation
+ * 2) The composite has a component with a Java POJO implementation which uses the
+ * Spring implementation to satisfy a reference
+ *
+ */
+public class SpringDelegationHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java
new file mode 100644
index 0000000000..840bf59b73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.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.spring;
+
+/**
+ * A basic test case of:
+ * 1) A composite containing a component with a Spring implementation
+ * 2) The composite has a component with a Java POJO implementation which uses the
+ * Spring implementation to satisfy a reference
+ * 3) The Spring component delegates function to a second spring bean
+ *
+ */
+public class SpringHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java
new file mode 100644
index 0000000000..fa7967c964
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.spring;
+
+/**
+ * A simple test Spring bean which provides the HelloWorld service
+ *
+ */
+
+public class TestHelloWorldBean implements HelloWorld {
+
+ static String hello = "Hello ";
+
+ // Classic "Hello xxx" response to any input message
+ public String sayHello(String message) {
+ System.out.println("TestHelloWorldBean - sayHello called");
+ return (hello + message);
+ }
+
+} // end class TestHelloWorldBean
diff --git a/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java
new file mode 100644
index 0000000000..b57cc7f366
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.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.spring;
+
+/**
+ * A simple test Spring bean which delgates to another bean
+ *
+ */
+
+public class TestHelloWorldDelegatorBean implements HelloWorld {
+
+ HelloWorld delegate;
+
+ public void setDelegate(HelloWorld delegate) {
+ this.delegate = delegate;
+ }
+
+ // Classic "Hello xxx" response to any input message
+ public String sayHello(String message) {
+ System.out.println("TestHelloWorldDelegatorBean - sayHello called");
+ return delegate.sayHello(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/pom.xml b/sca-java-1.x/branches/sca-android/itest/transaction/pom.xml
new file mode 100644
index 0000000000..3b8f3700f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-transaction</artifactId>
+ <name>Apache Tuscany SCA Transaction Policy Integration Test</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-transaction</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-ra</artifactId>
+ <version>4.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.3.1.4</version>
+ </dependency>
+
+ <!--
+ <dependency>
+ <groupId>jotm</groupId>
+ <artifactId>jotm</artifactId>
+ <version>2.0.10</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jta</artifactId>
+ <groupId>javax.transaction</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>connector</artifactId>
+ <groupId>javax.resource</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java
new file mode 100644
index 0000000000..d7d18181d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AccountNotFoundException extends Exception {
+ private static final long serialVersionUID = -4709084750220950706L;
+
+ public AccountNotFoundException() {
+ super();
+ }
+
+ public AccountNotFoundException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.java
new file mode 100644
index 0000000000..ac986dd417
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.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.itest.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AccountService {
+ float getBalance(String accountNumber) throws AccountNotFoundException;
+
+ void deposit(String accountNumber, float amount) throws AccountNotFoundException;
+
+ void withdraw(String accountNumber, float amount) throws OverDraftException, AccountNotFoundException;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.java
new file mode 100644
index 0000000000..a6ea036da7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.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.itest.transaction;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AccountServiceImpl implements AccountService {
+ protected Map<String, Float> accounts = new HashMap<String, Float>();
+
+ /**
+ * @see org.apache.tuscany.sca.itest.transaction.AccountService#deposit(String, float)
+ */
+ public void deposit(String accountNumber, float amount) throws AccountNotFoundException {
+ float balance = getBalance(accountNumber);
+ balance += amount;
+ save(accountNumber, balance);
+ accounts.put(accountNumber, balance);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.itest.transaction.AccountService#getBalance(String)
+ */
+ public float getBalance(String accountNumber) throws AccountNotFoundException {
+ Float balance = accounts.get(accountNumber);
+ if (balance == null) {
+ balance = load(accountNumber);
+ accounts.put(accountNumber, balance);
+ }
+ return balance;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.itest.transaction.AccountService#withdraw(String, float)
+ */
+ public void withdraw(String accountNumber, float amount) throws OverDraftException, AccountNotFoundException {
+ float balance = getBalance(accountNumber);
+ if (amount > balance) {
+ throw new OverDraftException("Insufficient fund");
+ }
+ balance -= amount;
+ save(accountNumber, balance);
+ accounts.put(accountNumber, balance);
+ }
+
+ protected abstract float load(String accountNumber) throws AccountNotFoundException;
+
+ protected abstract void save(String accountNumber, float balance) throws AccountNotFoundException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.java
new file mode 100644
index 0000000000..3e1cb29f33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.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.sca.itest.transaction;
+
+import java.io.File;
+import java.util.Enumeration;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.ActiveMQSession;
+import org.apache.activemq.broker.BrokerService;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(AccountService.class)
+@Scope("COMPOSITE")
+public class CheckingAccountServiceImpl extends AccountServiceImpl {
+ private static final String url = "tcp://localhost:61616";
+ private BrokerService broker;
+ private Queue queue;
+
+ @Init
+ public void init() throws Exception {
+ broker = new BrokerService();
+ broker.setBrokerName("localhost");
+ broker.setPersistent(false);
+ broker.addConnector(url);
+ broker.start();
+
+ ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url);
+ Connection conn = connFac.createConnection();
+ ActiveMQSession session = (ActiveMQSession)conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
+ queue = session.createQueue("CheckAccounts");
+ MessageProducer producer = session.createProducer(queue);
+ MapMessage map = session.createMapMessage();
+
+ for (int i = 0; i < 3; i++) {
+ String accountNumber = "C00" + (i + 1);
+ float balance = (float)(1000.0 + Math.random() * 200.0);
+ map.setStringProperty("accountNumber", accountNumber);
+ map.setFloatProperty("balance", balance);
+
+ map.setString("accountNumber", accountNumber);
+ map.setFloat("balance", balance);
+
+ producer.send(map);
+ }
+ session.commit();
+ conn.close();
+ }
+
+ @Destroy
+ public void destroy() throws Exception {
+ if (broker != null) {
+ broker.stop();
+ }
+ }
+
+ @Override
+ protected float load(String accountNumber) throws AccountNotFoundException {
+ try {
+ ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url);
+ Connection conn = connFac.createConnection();
+ conn.start();
+ Session session = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
+ QueueBrowser browser = session.createBrowser(queue, "accountNumber = '" + accountNumber + "'");
+ Enumeration msgs = browser.getEnumeration();
+ if (msgs.hasMoreElements()) {
+ MapMessage msg = (MapMessage)msgs.nextElement();
+ float balance = msg.getFloat("balance");
+ conn.close();
+ return balance;
+ } else {
+ conn.close();
+ throw new AccountNotFoundException(accountNumber);
+ }
+ } catch (JMSException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Override
+ protected void save(String accountNumber, float balance) throws AccountNotFoundException {
+ try {
+ ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url);
+ Connection conn = connFac.createConnection();
+ conn.start();
+ ActiveMQSession session = (ActiveMQSession)conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(queue, "accountNumber = '" + accountNumber + "'");
+ Message msg = consumer.receive(1000);
+ if (msg == null) {
+ conn.close();
+ throw new AccountNotFoundException(accountNumber);
+ }
+ MapMessage map = session.createMapMessage();
+ map.setStringProperty("accountNumber", accountNumber);
+ map.setFloatProperty("balance", balance);
+
+ map.setString("accountNumber", accountNumber);
+ map.setFloat("balance", balance);
+
+ MessageProducer producer = session.createProducer(queue);
+ producer.send(map);
+ conn.close();
+
+ } catch (JMSException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java
new file mode 100644
index 0000000000..4d504a6a36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OverDraftException extends Exception {
+ private static final long serialVersionUID = -4709084750220950706L;
+
+ public OverDraftException() {
+ super();
+ }
+
+ public OverDraftException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.java
new file mode 100644
index 0000000000..156b34227d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.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.itest.transaction;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.logging.Logger;
+
+import javax.sql.XAConnection;
+
+import org.apache.derby.jdbc.EmbeddedXADataSource;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(AccountService.class)
+@Scope("COMPOSITE")
+public class SavingsAccountServiceImpl extends AccountServiceImpl {
+ private final static Logger log = Logger.getLogger(SavingsAccountServiceImpl.class.getName());
+ private EmbeddedXADataSource xads;
+
+ @Init
+ public void init() throws SQLException {
+ // Create the database and a table
+ xads = new EmbeddedXADataSource();
+ xads.setDatabaseName("target/test");
+ xads.setCreateDatabase("create");
+
+ XAConnection xaconn = xads.getXAConnection();
+ Connection conn = xaconn.getConnection();
+ PreparedStatement ps =
+ conn.prepareStatement("create table SavingsAccounts(accountNumber char(100), balance float)");
+ try {
+ ps.execute();
+ } catch (SQLException ex) {
+ log.info(ex.getMessage());
+ }
+ ps = conn.prepareStatement("delete from SavingsAccounts");
+ ps.execute();
+
+ ps = conn.prepareStatement("insert into SavingsAccounts(accountNumber, balance) values(?, ?)");
+ for (int i = 0; i < 2; i++) {
+ ps.setString(1, "S00" + (i+1));
+ ps.setFloat(2, (float)(1000.0f + Math.random() * 500.0));
+ ps.executeUpdate();
+ }
+ conn.commit();
+ conn.close();
+ }
+
+ @Override
+ protected float load(String accountNumber) throws AccountNotFoundException {
+ try {
+ XAConnection xaconn = xads.getXAConnection();
+
+ Connection conn = xaconn.getConnection();
+ PreparedStatement ps = conn.prepareStatement("select balance from SavingsAccounts where accountNumber=?");
+ ps.setString(1, accountNumber);
+ ResultSet rs1 = ps.executeQuery();
+ boolean found = rs1.next();
+ if (found) {
+ float balance = rs1.getFloat(1);
+ conn.commit();
+ conn.close();
+ return balance;
+ } else {
+ conn.commit();
+ conn.close();
+ throw new AccountNotFoundException(accountNumber);
+ }
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Override
+ protected void save(String accountNumber, float balance) throws AccountNotFoundException {
+ try {
+ XAConnection xaconn = xads.getXAConnection();
+
+ Connection conn = xaconn.getConnection();
+ PreparedStatement ps = conn.prepareStatement("update SavingsAccounts set balance=? where accountNumber=?");
+ ps.setFloat(1, balance);
+ ps.setString(2, accountNumber);
+ int rows = ps.executeUpdate();
+ conn.commit();
+ boolean found = (rows >= 1);
+ if (found) {
+ conn.close();
+ } else {
+ conn.close();
+ throw new AccountNotFoundException(accountNumber);
+ }
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Destroy
+ public void destroy() throws SQLException {
+ XAConnection xaconn = xads.getXAConnection();
+ Connection conn = xaconn.getConnection();
+ PreparedStatement ps = conn.prepareStatement("drop table SavingsAccounts");
+ ps.execute();
+ conn.commit();
+ conn.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.java
new file mode 100644
index 0000000000..b7ea5f2663
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.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.itest.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TransferService {
+ String[] getAccounts();
+
+ float getBalance(String accountNumber) throws AccountNotFoundException;
+
+ void transfer(String from, String to, float amount) throws OverDraftException, AccountNotFoundException;
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.java
new file mode 100644
index 0000000000..341a7e53e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.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.itest.transaction;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(TransferService.class)
+public class TransferServiceImpl implements TransferService {
+ @Reference
+ protected AccountService savings;
+
+ @Reference
+ protected AccountService checking;
+
+ /**
+ * @see org.apache.tuscany.sca.itest.transaction.TransferService#transfer(java.lang.String, java.lang.String, float)
+ */
+ public void transfer(String from, String to, float amount) throws OverDraftException, AccountNotFoundException {
+ if (from.startsWith("C")) {
+ checking.withdraw(from, amount);
+ } else {
+ savings.withdraw(from, amount);
+ }
+ if (to.startsWith("C")) {
+ checking.deposit(to, amount);
+ } else {
+ savings.deposit(to, amount);
+ }
+ }
+
+ public float getBalance(String accountNumber) throws AccountNotFoundException {
+ if(accountNumber.startsWith("C")) {
+ return checking.getBalance(accountNumber);
+ } else {
+ return savings.getBalance(accountNumber);
+ }
+ }
+
+ public String[] getAccounts() {
+ return new String[] {"S001", "S002", "C001"};
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/accounts.composite b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/accounts.composite
new file mode 100644
index 0000000000..f4c6b650c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/accounts.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" xmlns:foo="http://foo" targetNamespace="http://account"
+ name="Accounts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="TransferServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.transaction.TransferServiceImpl"
+ requires="managedTransaction.global" />
+ <service name="TransferService" />
+ <reference name="savings" requires="propagatesTransaction" target="SavingsAccountServiceComponent"></reference>
+ <reference name="checking" requires="propagatesTransaction" target="CheckingAccountServiceComponent"></reference>
+ </component>
+
+ <component name="SavingsAccountServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.transaction.SavingsAccountServiceImpl"
+ requires="managedTransaction.global" />
+ <service name="AccountService" requires="propagatesTransaction" />
+ </component>
+
+ <component name="CheckingAccountServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.transaction.CheckingAccountServiceImpl"
+ requires="managedTransaction.global" />
+ <service name="AccountService" requires="propagatesTransaction" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..8aa6ba313a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/definitions.xml
@@ -0,0 +1,99 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <policySet name="tuscany:ManagedTransactionPolicySet" provides="managedTransaction" appliesTo="sca:implementation.java">
+ <intentMap provides="managedTransaction" default="global">
+ <qualifier name="global">
+ <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_GLOBAL" />
+ </qualifier>
+ <qualifier name="local">
+ <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_LOCAL" />
+ </qualifier>
+ </intentMap>
+ </policySet>
+
+ <policySet name="tuscany:NoManagedTransactionPolicySet" provides="noManagedTransaction"
+ appliesTo="implementation">
+ <tuscany:transactionPolicy action="REQUIRE_NONE" />
+ </policySet>
+
+ <policySet name="tuscany:PropagatesTransactionPolicySet" provides="propagatesTransaction" appliesTo="sca:component">
+ <tuscany:transactionPolicy action="PROPAGATE" />
+ </policySet>
+
+ <policySet name="tuscany:SuspendsTransactionPolicySet" provides="suspendsTransaction" appliesTo="sca:binding.sca">
+ <tuscany:transactionPolicy action="SUSPEND" />
+ </policySet>
+
+ <policySet name="tuscany:TransactedOneWayPolicySet" provides="transactedOneWay" appliesTo="sca:binding.sca">
+ <tuscany:transactionPolicy action="PROPAGATE" />
+ </policySet>
+
+ <policySet name="tuscany:ImmediateOneWayPolicySet" provides="immediateOneWay" appliesTo="sca:binding.sca">
+ <tuscany:transactionPolicy action="SUSPEND" />
+ </policySet>
+
+ <intent name="managedTransaction" constrains="implementation">
+ <description>Used to indicate the transaction environment desired by a component implementation.</description>
+ </intent>
+ <intent name="managedTransaction.global">
+ <description>
+ Used to indicate that a component implementation requires a managed global transaction.
+ </description>
+ </intent>
+ <intent name="managedTransaction.local">
+ <description>
+ Used to indicate that a component implementation requires a managed local transaction.
+ </description>
+ </intent>
+ <intent name="noManagedTransaction" constrains="implementation">
+ <description>
+ Used to indicate that a component implementation will manage its own transaction resources.
+ </description>
+ </intent>
+ <intent name="propagatesTransaction" constrains="binding">
+ <description>
+ Used to indicate that a reference will propagate any client transaction or that a service will be dispatched
+ under any received transaction.
+ </description>
+ </intent>
+ <intent name="suspendsTransaction" constrains="binding">
+ <description>
+ Used to indicate that a reference will not propagate any client transaction or that a service will not be
+ dispatched under any received transaction.
+ </description>
+ </intent>
+ <intent name="transactedOneWay" constrains="binding">
+ <description>
+ Used to indicate that the component requires the SCA runtime to transact OneWay send of messages as part of
+ any client global transaction or to transact oneWay message receipt as part of any service global
+ transaction.
+ </description>
+ </intent>
+ <intent name="immediateOneWay" constrains="binding">
+ <description>
+ Used to indicate that the component requires the SCA runtime to process the sending or receiving of OneWay
+ messages immediately, regardless of any transaction under which the sending/receiving component runs.
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/log4j.properties b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..698ee41d7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/main/resources/log4j.properties
@@ -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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+
+
+# Print only messages of level WARN or above in the package com.foo.
+log4j.logger.org.apache.tuscany=INFO \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.java
new file mode 100644
index 0000000000..c23628ff91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.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.itest.transaction;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.logging.Logger;
+
+import javax.sql.XAConnection;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import junit.framework.TestCase;
+
+import org.apache.derby.jdbc.EmbeddedXADataSource;
+import org.apache.tuscany.sca.policy.transaction.TransactionManagerHelper;
+import org.apache.tuscany.sca.policy.transaction.TransactionManagerWrapper;
+
+public class ConcurrentXAResourceTestCase extends TestCase {
+ class TestThread extends Thread {
+ private int counter;
+
+ TestThread(int i) {
+ counter = i;
+ }
+
+ public void run() {
+ log.info(this + " running...");
+
+ EmbeddedXADataSource xads = new EmbeddedXADataSource();
+ xads.setDatabaseName("target/test" + counter);
+ xads.setCreateDatabase("create");
+ Connection conn = null;
+ try {
+
+ Transaction trans = helper.managedGlobalTransactionPreInvoke();
+
+ XAConnection xaconn = xads.getXAConnection();
+
+ trans.enlistResource(xaconn.getXAResource());
+
+ conn = xaconn.getConnection();
+ try {
+ conn.prepareStatement("create table T1(col1 char(100))").execute();
+ } catch (SQLException ex) {
+ log.info("table T1 exists");
+ }
+ conn.prepareStatement("insert into T1 values('kkkkkkkk')").execute();
+ ResultSet rs = conn.prepareStatement("select count(*) from T1").executeQuery();
+ rs.next();
+ log.info(String.valueOf(rs.getInt(1)));
+
+ helper.managedGlobalTransactionPostInvoke(trans, false);
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ } finally {
+ try {
+ conn.close();
+ } catch (Exception _ex) {
+ _ex.printStackTrace();
+ }
+ }
+ }
+
+ }
+ private TransactionManagerWrapper activator;
+ private TransactionManagerHelper helper;
+
+ private Logger log = Logger.getLogger(this.getClass().getName());
+
+ public void setUp() throws Exception {
+ activator = new TransactionManagerWrapper();
+ activator.start();
+ TransactionManager tm = activator.getTransactionManager();
+ helper = new TransactionManagerHelper(tm);
+ }
+
+ public void tearDown() throws Exception {
+ activator.stop();
+
+ }
+
+ public void testConcurrent() {
+ TestThread[] tts = new TestThread[5];
+ for (int i = 0; i < tts.length; i++) {
+ tts[i] = new TestThread(i);
+ tts[i].start();
+ // log.info("one TestThread started...");
+ }
+ try {
+ for (TestThread tt : tts) {
+ while (tt != null && tt.isAlive()) {
+ // log.info("wait for...");
+ Thread.sleep(200);
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.java b/sca-java-1.x/branches/sca-android/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.java
new file mode 100644
index 0000000000..36884f6098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.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.itest.transaction;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TransactionTestCase {
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("accounts.composite");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testTransaction() throws Exception {
+ TransferService service = domain.getService(TransferService.class, "TransferServiceComponent");
+ String[] accounts = service.getAccounts();
+ for (int i = 0; i < accounts.length; i++) {
+ float balance = service.getBalance(accounts[i]);
+ System.out.println("[" + i + "] " + accounts[i] + ":" + balance);
+ }
+ service.transfer(accounts[0], accounts[2], 200.0f);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/pom.xml b/sca-java-1.x/branches/sca-android/itest/validation/pom.xml
new file mode 100644
index 0000000000..3d1d0c04f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/pom.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-validation</artifactId>
+ <name>Apache Tuscany SCA Validation Integration Test</name>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-monitor-logging</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-resource</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-ejb</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ejb-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-widget-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>1.4-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> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/account/Customer.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/account/Customer.java
new file mode 100644
index 0000000000..acb74c38ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/account/Customer.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 binding.ejb.account;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Customer {
+
+ /**
+ * This method deposits the amount. method accesses external EJB to get the
+ * current balance and add the amount to existing balance.
+ *
+ * @param String amount to be deposited
+ * @return total amount in customer account after deposit
+ */
+ Double depositAmount(java.lang.String accountNo, Double amount);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/account/CustomerImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/account/CustomerImpl.java
new file mode 100644
index 0000000000..52ddfa9aba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/account/CustomerImpl.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 binding.ejb.account;
+
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import binding.ejb.calculator.AddService;
+
+@Service(Customer.class)
+public class CustomerImpl implements Customer {
+
+ private AddService extEJBService = null;
+
+ public AddService getExtEJBService() {
+ return extEJBService;
+ }
+
+ @Reference
+ public void setExtEJBService(AddService extEJBService) {
+ this.extEJBService = extEJBService;
+ }
+
+ // this method invokes external EJB through EJB reference binding
+ public Double depositAmount(java.lang.String accountNo, Double amount) {
+
+ Double total = null;
+
+ System.out.println("In component implementation. Invoking external EJB through EJB reference binding ");
+
+ try {
+ Double balance = extEJBService.add(amount.doubleValue(), 1000); //invoke external ejb through ejb reference binding
+ total = balance + amount;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return total;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/calculator/AddService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/calculator/AddService.java
new file mode 100644
index 0000000000..aec8998083
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/calculator/AddService.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 binding.ejb.calculator;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AddService {
+ double add(double n1, double n2);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/calculator/AddServiceHome.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/calculator/AddServiceHome.java
new file mode 100644
index 0000000000..5df24b6379
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/ejb/calculator/AddServiceHome.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 binding.ejb.calculator;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+public interface AddServiceHome extends EJBHome {
+
+ AddService create() throws CreateException, RemoteException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/jms/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/jms/HelloWorldService.java
new file mode 100644
index 0000000000..33bfe1d0ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/jms/HelloWorldService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package binding.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldService {
+ String sayHello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/jms/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/jms/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..a6a40b0ed1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/binding/jms/HelloWorldServiceImpl.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package binding.jms;
+
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ public String sayHello(String name) {
+ return "jmsHello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddService.java
new file mode 100644
index 0000000000..35ba2cbfac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddService.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 calculator.warning;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+ String getServiceName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddServiceImpl.java
new file mode 100644
index 0000000000..ef305370cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddServiceImpl.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.warning;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ @Property(name="serviceName")
+ protected String serviceName = "addService";
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+ public String getServiceName(){
+ return serviceName;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddServiceImplWithServiceName.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddServiceImplWithServiceName.java
new file mode 100644
index 0000000000..aacde27842
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/AddServiceImplWithServiceName.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.warning;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the Add service
+ */
+@Service(AddService.class)
+public class AddServiceImplWithServiceName implements AddService {
+
+ @Property(name="serviceName")
+ protected String serviceName = "addService";
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+ public String getServiceName(){
+ return serviceName;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/CalculatorClient.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/CalculatorClient.java
new file mode 100644
index 0000000000..185f17a5ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/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.warning;
+
+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-android/itest/validation/src/main/java/calculator/warning/CalculatorService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/CalculatorService.java
new file mode 100644
index 0000000000..f472d6aaf6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/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.warning;
+
+
+/**
+ * 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-android/itest/validation/src/main/java/calculator/warning/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..77aafe83de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/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.warning;
+
+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-android/itest/validation/src/main/java/calculator/warning/DivideService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/DivideService.java
new file mode 100644
index 0000000000..a93d23e61c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/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.warning;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/DivideServiceImpl.java
new file mode 100644
index 0000000000..080594034b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/DivideServiceImpl.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.warning;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/MultiplyService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/MultiplyService.java
new file mode 100644
index 0000000000..20d48e93d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/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.warning;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..96f0b55fa2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/MultiplyServiceImpl.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.warning;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/PropertyService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/PropertyService.java
new file mode 100644
index 0000000000..4f1ccc96f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/PropertyService.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 calculator.warning;
+
+/**
+ * The Property service interface
+ */
+public interface PropertyService {
+
+ String getFirstName();
+ String getLastName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/PropertyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/PropertyServiceImpl.java
new file mode 100644
index 0000000000..429daf5f2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/PropertyServiceImpl.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.warning;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * An implementation of the Property service
+ */
+public class PropertyServiceImpl implements PropertyService {
+
+ @Property(name="firstName", required=false)
+ protected String firstName;
+
+ @Property(name="lastName", required=true)
+ protected String lastName;
+
+ public String getFirstName(){
+ return firstName;
+ }
+
+ public String getLastName(){
+ return lastName;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractService.java
new file mode 100644
index 0000000000..40e382dc74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/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.warning;
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractServiceImpl.java
new file mode 100644
index 0000000000..8cdbe0813d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractServiceImpl.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.warning;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractServiceImplWithServiceName.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractServiceImplWithServiceName.java
new file mode 100644
index 0000000000..d5e9fcf020
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/calculator/warning/SubtractServiceImplWithServiceName.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 calculator.warning;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the subtract service.
+ */
+@Service(SubtractService.class)
+public class SubtractServiceImplWithServiceName implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/AddService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/AddService.java
new file mode 100644
index 0000000000..0db8ce4f5c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/AddService.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 impl.java;
+
+/**
+ * The Add service interface
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+ String getServiceName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/AddServiceImpl.java
new file mode 100644
index 0000000000..83f2685d54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/AddServiceImpl.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 impl.java;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ @Property(name="serviceName")
+ protected String serviceName = "addService";
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+ public String getServiceName(){
+ return serviceName;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/CalculatorClient.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/CalculatorClient.java
new file mode 100644
index 0000000000..e34ce3db26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/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 impl.java;
+
+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-android/itest/validation/src/main/java/impl/java/CalculatorService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/CalculatorService.java
new file mode 100644
index 0000000000..5d583fd604
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/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 impl.java;
+
+
+/**
+ * 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-android/itest/validation/src/main/java/impl/java/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..0183e2a259
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/CalculatorServiceImpl.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 impl.java;
+
+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;
+ }
+
+ @Reference
+ private void add(int n1, int n2) {
+
+ }
+
+ 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-android/itest/validation/src/main/java/impl/java/DivideService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/DivideService.java
new file mode 100644
index 0000000000..85ebadc9a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/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 impl.java;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/DivideServiceImpl.java
new file mode 100644
index 0000000000..863c298234
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/DivideServiceImpl.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 impl.java;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/MultiplyService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/MultiplyService.java
new file mode 100644
index 0000000000..e1bf7fbddc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/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 impl.java;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..6346ea3582
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/MultiplyServiceImpl.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 impl.java;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/SubtractService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/SubtractService.java
new file mode 100644
index 0000000000..57759bb496
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/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 impl.java;
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/SubtractServiceImpl.java
new file mode 100644
index 0000000000..16e3e6a23d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/java/SubtractServiceImpl.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 impl.java;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestImpl.java
new file mode 100644
index 0000000000..6f9df2c034
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestImpl.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 impl.osgi;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ *
+ * Test class - Implementation of an OSGi service
+ *
+ */
+public class OSGiTestImpl implements OSGiTestInterface, BundleActivator {
+
+ public String testService() {
+
+ return OSGiTestImpl.class.getName();
+
+ }
+
+ public void start(BundleContext bc) throws Exception {
+
+ bc.registerService(OSGiTestInterface.class.getName(), this, new Hashtable<String, Object>());
+
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestInterface.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestInterface.java
new file mode 100644
index 0000000000..bafff878cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestInterface.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 impl.osgi;
+
+/**
+ *
+ * Test class - Interface for an OSGi service
+ *
+ */
+public interface OSGiTestInterface {
+
+ String testService() throws Exception ;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestWithPropertyImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestWithPropertyImpl.java
new file mode 100644
index 0000000000..e44d93e6be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/osgi/OSGiTestWithPropertyImpl.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 impl.osgi;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osoa.sca.annotations.Property;
+
+/**
+ *
+ * Test class - Implementation of an OSGi service
+ *
+ */
+public class OSGiTestWithPropertyImpl implements OSGiTestInterface, BundleActivator {
+
+ @Property
+ public double exchangeRate;
+
+ private String currency;
+
+ @Property
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String testService() throws Exception {
+
+ if (exchangeRate != 2.0)
+ throw new Exception("Property exchangeRate not set correctly, expected 2.0, got " + exchangeRate);
+ if (!"USD".equals(currency))
+ throw new Exception("Property currency not set correctly, expected USD, got " + currency);
+ return OSGiTestWithPropertyImpl.class.getName();
+
+ }
+
+ public void start(BundleContext bc) throws Exception {
+
+ bc.registerService(OSGiTestInterface.class.getName(), this, new Hashtable<String, Object>());
+
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/HelloWorld.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/HelloWorld.java
new file mode 100644
index 0000000000..ef0b491617
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/HelloWorld.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 impl.spring;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Interface for the "hello world" service - predictably simple with a single operation
+ * "sayHello"
+ *
+ */
+@Remotable
+public interface HelloWorld {
+
+ @OneWay
+ String sayHello(String s);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/HelloWorldProxy.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/HelloWorldProxy.java
new file mode 100644
index 0000000000..2e3458f0d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/HelloWorldProxy.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 impl.spring;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * A simple proxy Java class which implements the HelloWorld interface but which uses
+ * a reference "delegate" to actually provide the HelloWorld service
+ *
+ */
+public class HelloWorldProxy implements HelloWorld {
+
+ // Here is the reference "delegate" - it implements the HelloWorld interface...
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ // Simply call the reference to satisfy the service request...
+ System.out.println("HelloWorldProxy - calling sayHello");
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/TestHelloWorldBean.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/TestHelloWorldBean.java
new file mode 100644
index 0000000000..87904f2a72
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/impl/spring/TestHelloWorldBean.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 impl.spring;
+
+/**
+ * A simple test Spring bean which provides the HelloWorld service
+ *
+ */
+
+public class TestHelloWorldBean implements HelloWorld {
+
+ static String hello = "Hello ";
+
+ // Classic "Hello xxx" response to any input message
+ public String sayHello(String message) {
+ System.out.println("TestHelloWorldBean - sayHello called");
+ return (hello + message);
+ }
+
+} // end class TestHelloWorldBean
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/interfacejava/xml/CalculatorService.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/interfacejava/xml/CalculatorService.java
new file mode 100644
index 0000000000..fa1a621f12
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/interfacejava/xml/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 interfacejava.xml;
+
+import org.osoa.sca.annotations.OneWay;
+/**
+ * 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);
+
+ @OneWay
+ double divide(double n1, double n2);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/interfacejava/xml/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/interfacejava/xml/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..ebf7a79589
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/java/interfacejava/xml/CalculatorServiceImpl.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 interfacejava.xml;
+
+import org.osoa.sca.annotations.Reference;
+
+import calculator.warning.AddService;
+import calculator.warning.DivideService;
+import calculator.warning.MultiplyService;
+import calculator.warning.SubtractService;
+
+
+/**
+ * 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-android/itest/validation/src/main/resources/ComponentReferenceTargetNotFound/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ComponentReferenceTargetNotFound/Calculator.composite
new file mode 100644
index 0000000000..b2e7da05a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ComponentReferenceTargetNotFound/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent_one" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateComponentName/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateComponentName/Calculator.composite
new file mode 100644
index 0000000000..4ba9f0724b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateComponentName/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationPropertyName/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationPropertyName/Calculator.composite
new file mode 100644
index 0000000000..b935dd194a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationPropertyName/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="AddServiceComponent_one">
+ <implementation.composite name="sample:dummyImplementation">
+ <property name="serviceName" type="xsd:anyURI">addService</property>
+ </implementation.composite>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationPropertyName/dummyImplementation.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationPropertyName/dummyImplementation.composite
new file mode 100644
index 0000000000..2b633f3139
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationPropertyName/dummyImplementation.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="dummyImplementation">
+
+ <property name="serviceName" type="xsd:anyURI">addService</property>
+ <property name="serviceName" type="xsd:anyURI">addService</property>
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationReferenceName/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationReferenceName/Calculator.composite
new file mode 100644
index 0000000000..940e27a1e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationReferenceName/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="CalculatorServiceComponent_one">
+ <implementation.composite name="sample:dummyImplementation">
+ <reference name="addService" target="AddServiceComponent" />
+ </implementation.composite>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationReferenceName/dummyImplementation.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationReferenceName/dummyImplementation.composite
new file mode 100644
index 0000000000..50d78cb2a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateImplementationReferenceName/dummyImplementation.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="dummyImplementation">
+
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="addService" target="AddServiceComponent" />
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicatePropertyName/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicatePropertyName/Calculator.composite
new file mode 100644
index 0000000000..bd788e47b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicatePropertyName/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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">
+ <property name="serviceName" type="xsd:anyURI">addService</property>
+ <property name="serviceName" type="xsd:anyURI">addMyService</property>
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateReferenceName/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateReferenceName/Calculator.composite
new file mode 100644
index 0000000000..7281878c0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/DuplicateReferenceName/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent" />
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
new file mode 100644
index 0000000000..609ffed02d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/META-INF/sca/SpringHelloWorld-context.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.
+-->
+<!-- Application context for the SpringHelloWorld testcase -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+ <bean id="testBean" class="impl.spring.TestHelloWorldBean" lazy-init="true">
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/MultipleBindingsForService/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/MultipleBindingsForService/Calculator.composite
new file mode 100644
index 0000000000..08e18decc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/MultipleBindingsForService/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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">
+ <service name="AddService">
+ <binding.sca name="addBinding"/>
+ <binding.sca name="addBinding"/>
+ </service>
+ <implementation.java class="calculator.warning.AddServiceImplWithServiceName"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImplWithServiceName"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoComponentImplementation/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoComponentImplementation/Calculator.composite
new file mode 100644
index 0000000000..36e71e398b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoComponentImplementation/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="AddServiceComponent_one">
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoCompositeNamespace/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoCompositeNamespace/Calculator.composite
new file mode 100644
index 0000000000..9a46e09363
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoCompositeNamespace/Calculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoMatchingBinding/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoMatchingBinding/Calculator.composite
new file mode 100644
index 0000000000..59017f0c09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/NoMatchingBinding/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent">
+ <binding.sca/>
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ <service name="AddService">
+ <binding.ws uri="http://localhost:8085/AddServiceComponent"/>
+ </service>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PromotedReferenceNotFound/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PromotedReferenceNotFound/Calculator.composite
new file mode 100644
index 0000000000..462a95dd02
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PromotedReferenceNotFound/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <reference name="promotedAddReference" promote="AddService/addService"/>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PromotedServiceNotFound/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PromotedServiceNotFound/Calculator.composite
new file mode 100644
index 0000000000..4b6c44bd58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PromotedServiceNotFound/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <service name="promotedAddService" promote="AddServiceComponent_one"/>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/Calculator.composite
new file mode 100644
index 0000000000..a397e3384c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+ <component name="PropertyServiceComponent">
+ <property name="firstName" type="xsd:anyURI" mustSupply="true">Simon</property>
+ <property name="lastName" type="xsd:anyURI">Laws</property>
+ <implementation.java class="calculator.warning.PropertyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/CalculatorNullMustSupply.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/CalculatorNullMustSupply.composite
new file mode 100644
index 0000000000..08fab865fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/CalculatorNullMustSupply.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+ <component name="PropertyServiceComponent">
+ <implementation.java class="calculator.warning.PropertyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/CalculatorOverrideManyAttribute.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/CalculatorOverrideManyAttribute.composite
new file mode 100644
index 0000000000..3a5f59b17c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyAttribute/CalculatorOverrideManyAttribute.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+ <component name="PropertyServiceComponent">
+ <property name="lastName" type="xsd:anyURI" many="true">Laws</property>
+ <implementation.java class="calculator.warning.PropertyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyNotFound/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyNotFound/Calculator.composite
new file mode 100644
index 0000000000..8221e41430
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/PropertyNotFound/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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">
+ <property name="serviceName_one" type="xsd:anyURI">addService</property>
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleComponentInterface/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleComponentInterface/Calculator.composite
new file mode 100644
index 0000000000..9c5ae7027f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleComponentInterface/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent">
+ <interface.java interface="calculator.warning.SubtractService"/>
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleInterface/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleInterface/Calculator.composite
new file mode 100644
index 0000000000..3c85ed32e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleInterface/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService" target="SubtractServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleMultiplicity/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleMultiplicity/Calculator.composite
new file mode 100644
index 0000000000..2d1a1e01f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceIncompatibleMultiplicity/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService" multiplicity="1..n" 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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceNotFound/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceNotFound/Calculator.composite
new file mode 100644
index 0000000000..efb457ac9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceNotFound/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService_one" target="AddServiceComponent" />
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceWithoutTargets/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceWithoutTargets/Calculator.composite
new file mode 100644
index 0000000000..a5beaf4ec9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ReferenceWithoutTargets/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService"/>
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ServiceNotFoundForComponentService/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ServiceNotFoundForComponentService/Calculator.composite
new file mode 100644
index 0000000000..06c3eeeaca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/ServiceNotFoundForComponentService/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="AddServiceComponent_one">
+ <service name="AddService_one"/>
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/UnresolvedComponentImplementation/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/UnresolvedComponentImplementation/Calculator.composite
new file mode 100644
index 0000000000..821ce570c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/UnresolvedComponentImplementation/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ xmlns:sca="http://sca"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="AddServiceComponent_one">
+ <implementation.composite name="sca:dummyImplementation.composite"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/XsdValidation/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/XsdValidation/Calculator.composite
new file mode 100644
index 0000000000..63ccaa9957
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/XsdValidation/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <binding.ws/>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/ContributionReadException/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/ContributionReadException/Calculator.composite
new file mode 100644
index 0000000000..da565081f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/ContributionReadException/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.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </components>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/PolicyImplValidationException/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/PolicyImplValidationException/Calculator.composite
new file mode 100644
index 0000000000..6153d40c3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/PolicyImplValidationException/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.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl" requires="tuscany:logging"/>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/PolicyServiceValidationException/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/PolicyServiceValidationException/Calculator.composite
new file mode 100644
index 0000000000..a3eb60bf58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/PolicyServiceValidationException/Calculator.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:calc="http://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)" requires="tuscany:logging"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedBindingElement/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedBindingElement/Calculator.composite
new file mode 100644
index 0000000000..6233d47d8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedBindingElement/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://calc"
+ targetNamespace="http://calc"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <binding.ws/>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedImplementationElement/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedImplementationElement/Calculator.composite
new file mode 100644
index 0000000000..6a9af9e070
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedImplementationElement/Calculator.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:calc="http://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <implementation.java/>
+ <interface.java interface="calculator.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedInterfaceElement/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedInterfaceElement/Calculator.composite
new file mode 100644
index 0000000000..49b26c78f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/assemblyxml/UnexpectedInterfaceElement/Calculator.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:calc="http://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl"/>
+ <interface.java/>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/InvalidWsdlElementAttr/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/InvalidWsdlElementAttr/Calculator.composite
new file mode 100644
index 0000000000..c34a160b61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/InvalidWsdlElementAttr/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:8085/Calculator" wsdlElement="http://sample/calculator"/>
+ <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.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/MustUseWsdlBinding/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/MustUseWsdlBinding/Calculator.composite
new file mode 100644
index 0000000000..293c4d725d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/MustUseWsdlBinding/Calculator.composite
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://sample.calculator"
+ targetNamespace="http://calc"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="Calculator-bad-wsdlElement">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)">
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>http://localhost:8085/Calculator</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworld.wsdl
new file mode 100644
index 0000000000..013a55b61e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworld.wsdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<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:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+ <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:HelloWorldSoapJmsBinding" name="HelloWorldSoapJmsPort">
+ <wsdlsoap:address location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworldwsjms.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworldwsjms.composite
new file mode 100644
index 0000000000..b7ff1e304f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworldwsjms.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="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl" />
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapJmsBinding2)"
+ uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/helloworld.wsdl
new file mode 100644
index 0000000000..218dbc47c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/helloworld.wsdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<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:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+ <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:8085/HelloWorldService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/helloworldwsclient.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/helloworldwsclient.composite
new file mode 100644
index 0000000000..5975c27663
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/helloworldwsclient.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://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldwsclient">
+
+ <!-- A component with an embedded reference definition connecting to an external webservice
+ The wsdl interface for the reference is derived from the information specified by the 'wsdlElement'
+ -->
+ <component name="HelloTuscanyServiceComponent">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <reference name="helloWorldService">
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort2)"/>
+ </reference>
+ </component>
+
+ <!-- A component with a reference promoted as a composite reference -->
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ </component>
+
+ <reference name="HelloWorldService" promote="HelloWorldServiceComponent/helloWorldService">
+ <interface.java interface="binding.jms.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort2)"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworld.wsdl
new file mode 100644
index 0000000000..013a55b61e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworld.wsdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<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:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+ <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:HelloWorldSoapJmsBinding" name="HelloWorldSoapJmsPort">
+ <wsdlsoap:address location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworldwsjms.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworldwsjms.composite
new file mode 100644
index 0000000000..8cda0b007e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworldwsjms.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="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl" />
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.service(HelloWorldService2)"
+ uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingejb/UnknownEJBSessionType/account.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingejb/UnknownEJBSessionType/account.composite
new file mode 100644
index 0000000000..781319d619
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingejb/UnknownEJBSessionType/account.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" name="account">
+
+ <!-- composite refrence with ejb binding. Modify host and port number in uri attribute based on where you have installed target ResumeBank EJB -->
+
+ <component name="CustomerComponent">
+ <implementation.java class="binding.ejb.account.CustomerImpl" />
+ <reference name="extEJBService">
+ <!-- To use the CosNaming, use the following URI -->
+ <!--
+ <binding.ejb uri="corbaname:iiop:1.2@localhost:1050#AddServiceBean" />
+ -->
+ <binding.ejb session-type="state" uri="hello-addservice/AddServiceBean/binding.ejb.calculator.AddService" />
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingejb/UnknownEJBVersion/account.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingejb/UnknownEJBVersion/account.composite
new file mode 100644
index 0000000000..8a0dfac98b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingejb/UnknownEJBVersion/account.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" name="account">
+
+ <!-- composite refrence with ejb binding. Modify host and port number in uri attribute based on where you have installed target ResumeBank EJB -->
+
+ <component name="CustomerComponent">
+ <implementation.java class="binding.ejb.account.CustomerImpl" />
+ <reference name="extEJBService">
+ <!-- To use the CosNaming, use the following URI -->
+ <!--
+ <binding.ejb uri="corbaname:iiop:1.2@localhost:1050#AddServiceBean" />
+ -->
+ <binding.ejb ejb-version="EJB4" uri="hello-addservice/AddServiceBean/binding.ejb.calculator.AddService" />
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessActivationSpec/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessActivationSpec/service.composite
new file mode 100644
index 0000000000..fcfe408582
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessActivationSpec/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <activationSpec name="jms"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessDestinationType/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessDestinationType/service.composite
new file mode 100644
index 0000000000..ede3b3fd40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessDestinationType/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always" type="queue"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessHeaders/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessHeaders/service.composite
new file mode 100644
index 0000000000..a8c89a0bf5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessHeaders/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ <headers JMSType="jms"/>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResourceAdapter/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResourceAdapter/service.composite
new file mode 100644
index 0000000000..b4e56d1789
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResourceAdapter/service.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="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <resourceAdapter name="resAdpName"/>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseActivationSpec/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseActivationSpec/service.composite
new file mode 100644
index 0000000000..e68eb75d64
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseActivationSpec/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <activationSpec name="jms"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseConnectionFactory/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseConnectionFactory/service.composite
new file mode 100644
index 0000000000..00c7a3f86b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseConnectionFactory/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <connectionFactory name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseDestinationType/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseDestinationType/service.composite
new file mode 100644
index 0000000000..d656d47cfd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/DoesntProcessResponseDestinationType/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always" type="queue"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidCorrelationScheme/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidCorrelationScheme/service.composite
new file mode 100644
index 0000000000..ad1daacfcf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidCorrelationScheme/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms correlationScheme="correlationScheme" initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidJMSDeliveryMode/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidJMSDeliveryMode/service.composite
new file mode 100644
index 0000000000..145aea9fbc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidJMSDeliveryMode/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ <headers JMSType="jms" JMSDeliveryMode="NON_PERSISTENTS" JMSPriority="8"/>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidJMSPriority/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidJMSPriority/service.composite
new file mode 100644
index 0000000000..c52da84a0c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidJMSPriority/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ <headers JMSType="jms" JMSDeliveryMode="NON_PERSISTENT" JMSPriority="20"/>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidResponseDestinationType/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidResponseDestinationType/service.composite
new file mode 100644
index 0000000000..fb35f5d1b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/InvalidResponseDestinationType/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always" type="no"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingActivationSpecName/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingActivationSpecName/service.composite
new file mode 100644
index 0000000000..fcdf25455c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingActivationSpecName/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <activationSpec name=""/>
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingConnectionFactoryName/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingConnectionFactoryName/service.composite
new file mode 100644
index 0000000000..14f1314a1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingConnectionFactoryName/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <connectionFactory name=""/>
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingResponseActivationSpec/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingResponseActivationSpec/service.composite
new file mode 100644
index 0000000000..1a3cb21ac6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingResponseActivationSpec/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <activationSpec name=""/>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingResponseConnectionFactory/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingResponseConnectionFactory/service.composite
new file mode 100644
index 0000000000..80b8f9d938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MissingResponseConnectionFactory/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <connectionFactory name=""/>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MustStartWithSchema/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MustStartWithSchema/service.composite
new file mode 100644
index 0000000000..8fd1e2f554
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/MustStartWithSchema/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61616" uri="tuscany://localhost:17171">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnexpectedElement/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnexpectedElement/service.composite
new file mode 100644
index 0000000000..b74682e1bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnexpectedElement/service.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="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ <resourceAdapter name="resource">
+ <property name="resourceName" type="jms"/>
+ </resourceAdapter>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnexpectedResponseElement/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnexpectedResponseElement/service.composite
new file mode 100644
index 0000000000..f439ab6260
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnexpectedResponseElement/service.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="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ <connectionFactory name="RespQueueA">
+ <property name="RespQueueA"/>
+ </connectionFactory>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnknownTokenInURI/service.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnknownTokenInURI/service.composite
new file mode 100644
index 0000000000..e22f30152e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/bindingjms/UnknownTokenInURI/service.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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61616" uri="jms://queue.sample?transport.jms=QueueConnectionFactory">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/java/AttributePackageMissing/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/java/AttributePackageMissing/Calculator.composite
new file mode 100644
index 0000000000..6ef7558d95
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/java/AttributePackageMissing/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://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <export.java xmlns:ns="http://ns"/>
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/namespace/AttributeNameSpaceMissing/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/namespace/AttributeNameSpaceMissing/Calculator.composite
new file mode 100644
index 0000000000..77a2715373
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/namespace/AttributeNameSpaceMissing/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://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <export xmlns:ns="http://ns"/>
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/resource/AttributeURIMissing/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/resource/AttributeURIMissing/Calculator.composite
new file mode 100644
index 0000000000..6e5fcf1286
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/resource/AttributeURIMissing/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://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <!-- export.resource xmlns:ns="http://ns"/-->
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/resource/AttributeURIMissing/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/resource/AttributeURIMissing/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8a2a1a23be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/resource/AttributeURIMissing/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://calc"
+ xmlns:calc="http://calc">
+ <deployable composite="calc:Calculator"/>
+ <import.resource xmlns="http://www.osoa.org/xmlns/sca/1.0"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/xml/AttributeCompositeMissing/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/xml/AttributeCompositeMissing/Calculator.composite
new file mode 100644
index 0000000000..70f91d1a7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/xml/AttributeCompositeMissing/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.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/xml/AttributeCompositeMissing/sca-contribution.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/xml/AttributeCompositeMissing/sca-contribution.xml
new file mode 100644
index 0000000000..7f5eb546e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/contribution/xml/AttributeCompositeMissing/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/AttributeUnrecognizedNamespace/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/AttributeUnrecognizedNamespace/helloworld.composite
new file mode 100644
index 0000000000..0dfe52985a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/AttributeUnrecognizedNamespace/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="hna:HelloWorld"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/AttributeWithoutNamespace/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/AttributeWithoutNamespace/helloworld.composite
new file mode 100644
index 0000000000..d3f249720d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/AttributeWithoutNamespace/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="{HelloWorld"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/deploy.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/deploy.xml
new file mode 100644
index 0000000000..571aa37d58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.bpel b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.bpel
new file mode 100644
index 0000000000..a8eb389704
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"/>
+ </sequence>
+</process>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.componentType
new file mode 100644
index 0000000000..2b360111cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/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="helloPartnerLink">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.composite
new file mode 100644
index 0000000000..575927a5de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="hns:HelloWorld2"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.wsdl
new file mode 100644
index 0000000000..46cf381577
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.wsdl
@@ -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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/deploy.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/deploy.xml
new file mode 100644
index 0000000000..571aa37d58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.bpel b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.bpel
new file mode 100644
index 0000000000..a8eb389704
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"/>
+ </sequence>
+</process>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.componentType
new file mode 100644
index 0000000000..2b360111cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/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="helloPartnerLink">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.composite
new file mode 100644
index 0000000000..b4623b5c2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/deploy.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/deploy.xml
new file mode 100644
index 0000000000..571aa37d58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.bpel b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.bpel
new file mode 100644
index 0000000000..973d1f618a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"/>
+ </sequence>
+</process>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.componentType
new file mode 100644
index 0000000000..2b360111cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/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="helloPartnerLink">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.composite
new file mode 100644
index 0000000000..b4623b5c2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.wsdl
new file mode 100644
index 0000000000..46cf381577
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.wsdl
@@ -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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/deploy.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/deploy.xml
new file mode 100644
index 0000000000..571aa37d58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.bpel b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.bpel
new file mode 100644
index 0000000000..5d2aeddc3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca-bpel/200801"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me"
+ sca:service="service" sca:reference="reference"/>
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"/>
+ </sequence>
+</process>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.componentType
new file mode 100644
index 0000000000..077df56290
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/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="helloPartnerLink">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.composite
new file mode 100644
index 0000000000..b4623b5c2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.wsdl
new file mode 100644
index 0000000000..46cf381577
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.wsdl
@@ -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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/deploy.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/deploy.xml
new file mode 100644
index 0000000000..571aa37d58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.bpel b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.bpel
new file mode 100644
index 0000000000..68df3156a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld2.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"/>
+ </sequence>
+</process>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.componentType
new file mode 100644
index 0000000000..2b360111cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/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="helloPartnerLink">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.composite
new file mode 100644
index 0000000000..b4623b5c2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.wsdl
new file mode 100644
index 0000000000..46cf381577
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.wsdl
@@ -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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/deploy.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/deploy.xml
new file mode 100644
index 0000000000..571aa37d58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.bpel b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.bpel
new file mode 100644
index 0000000000..a8eb389704
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"/>
+ </sequence>
+</process>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.componentType
new file mode 100644
index 0000000000..2b360111cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/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="helloPartnerLink">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.composite
new file mode 100644
index 0000000000..b4623b5c2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.wsdl
new file mode 100644
index 0000000000..695fd60887
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/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://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite
new file mode 100644
index 0000000000..94ee650207
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.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"
+ targetNamespace="http://sample/ejb"
+ xmlns:sc="http://sample/composite"
+ name="TestEJB">
+
+ <component name="TestEJB">
+ <implementation.ejb/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/java/ClassNotFoundException/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/java/ClassNotFoundException/Calculator.composite
new file mode 100644
index 0000000000..f3cf93ddaa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/java/ClassNotFoundException/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="impl.java.CalculatorServiceImpl_one"/>
+ <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="impl.java.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="impl.java.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="impl.java.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="impl.java.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/java/ContributionResolveException/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/java/ContributionResolveException/Calculator.composite
new file mode 100644
index 0000000000..f9016219a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/java/ContributionResolveException/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="impl.java.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="impl.java.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="impl.java.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="impl.java.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="impl.java.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/OSGiTestService.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/OSGiTestService.componentType
new file mode 100644
index 0000000000..634c13b3cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/OSGiTestService.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="OSGiTestService">
+ <interface.java interface="impl.osgi.OSGiTestInterface"/>
+ </service>
+
+ <property name="currency" type="xsd:string">GBP</property>
+ <property name="exchangeRate" type="xsd:double">1.0</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/osgitest.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/osgitest.composite
new file mode 100644
index 0000000000..0d1861f2f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/osgitest.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="OSGiTestComposite">
+
+ <component name="OSGiTestServiceComponent">
+ <tuscany:implementation.osgi
+ bundle="OSGiTestService"
+ bundleSymbolicName="impl.osgi.OSGiTestInterface"/>
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/osgitest.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/osgitest.composite
new file mode 100644
index 0000000000..0d1861f2f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/MissingComponentTypeFile/osgitest.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="OSGiTestComposite">
+
+ <component name="OSGiTestServiceComponent">
+ <tuscany:implementation.osgi
+ bundle="OSGiTestService"
+ bundleSymbolicName="impl.osgi.OSGiTestInterface"/>
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.componentType
new file mode 100644
index 0000000000..634c13b3cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.componentType
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="OSGiTestService">
+ <interface.java interface="impl.osgi.OSGiTestInterface"/>
+ </service>
+
+ <property name="currency" type="xsd:string">GBP</property>
+ <property name="exchangeRate" type="xsd:double">1.0</property>
+
+</componentType>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/osgitest.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/osgitest.composite
new file mode 100644
index 0000000000..881c24854b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/osgi/PropertyShouldSpecifySR/osgitest.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"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="OSGiTestComposite">
+
+ <component name="OSGiTestServiceComponent">
+ <tuscany:implementation.osgi
+ bundle="OSGiTestService"
+ bundleSymbolicName="impl.osgi.OSGiTestInterface">
+ <tuscany:properties name="osgiProperties"/>
+ </tuscany:implementation.osgi>
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/resource/CouldNotResolveLocation/resource.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/resource/CouldNotResolveLocation/resource.composite
new file mode 100644
index 0000000000..4e680f1200
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/resource/CouldNotResolveLocation/resource.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/resource"
+ xmlns:sr="http://sample/resource"
+ name="resource">
+
+ <component name="ResourceServiceComponent">
+ <tuscany:implementation.resource location="contents"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/resource/LocationAttributeMissing/resource.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/resource/LocationAttributeMissing/resource.composite
new file mode 100644
index 0000000000..e01643ed8f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/resource/LocationAttributeMissing/resource.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/resource"
+ xmlns:sr="http://sample/resource"
+ name="resource">
+
+ <component name="ResourceServiceComponent">
+ <tuscany:implementation.resource/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/ContributionResolveException/SpringHelloWorld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/ContributionResolveException/SpringHelloWorld.composite
new file mode 100644
index 0000000000..d776882ed0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/ContributionResolveException/SpringHelloWorld.composite
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="SpringHelloWorld">
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="SpringHelloWorld-context.xml"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/LocationAttributeMissing/SpringHelloWorld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/LocationAttributeMissing/SpringHelloWorld.composite
new file mode 100644
index 0000000000..0d1ffc97e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/LocationAttributeMissing/SpringHelloWorld.composite
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="SpringHelloWorld">
+
+ <component name="HelloWorldComponent">
+ <implementation.spring/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld-context.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld-context.xml
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld-context.xml
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld.composite
new file mode 100644
index 0000000000..99c529d77f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld.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://sample"
+ xmlns:sample="http://sample"
+ name="SpringHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="impl.spring.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="META-INF/sca/SpringHelloWorld-context.xml"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/TestHelloWorldBean.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/TestHelloWorldBean.componentType
new file mode 100644
index 0000000000..c75f209b6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/spring/UnableToResolveComponentType/TestHelloWorldBean.componentType
@@ -0,0 +1,27 @@
+<?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="impl.spring.HelloWorld" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/widget/CouldNotResolveLocation/widget.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/widget/CouldNotResolveLocation/widget.composite
new file mode 100644
index 0000000000..a5874707da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/widget/CouldNotResolveLocation/widget.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/resource"
+ xmlns:sr="http://sample/resource"
+ name="resource">
+
+ <component name="store">
+ <tuscany:implementation.widget location="content/store.html"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/widget/LocationAttributeMissing/widget.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/widget/LocationAttributeMissing/widget.composite
new file mode 100644
index 0000000000..393b9fe674
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/widget/LocationAttributeMissing/widget.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/resource"
+ xmlns:sr="http://sample/resource"
+ name="resource">
+
+ <component name="store">
+ <tuscany:implementation.widget/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/xquery/CouldNotLocateFile/HelloWorld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/xquery/CouldNotLocateFile/HelloWorld.composite
new file mode 100644
index 0000000000..1dca444938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/xquery/CouldNotLocateFile/HelloWorld.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="HelloWorld">
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.xquery location="content/test.xquery"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/xquery/LocationAttributeMissing/HelloWorld.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/xquery/LocationAttributeMissing/HelloWorld.composite
new file mode 100644
index 0000000000..9a60183c5c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/impl/xquery/LocationAttributeMissing/HelloWorld.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="HelloWorld">
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.xquery/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ClassNotFoundException/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ClassNotFoundException/Calculator.composite
new file mode 100644
index 0000000000..70f91d1a7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ClassNotFoundException/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.warning.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ClassNotFoundException/CalculatorServiceImpl.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ClassNotFoundException/CalculatorServiceImpl.componentType
new file mode 100644
index 0000000000..bc7bf3f250
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ClassNotFoundException/CalculatorServiceImpl.componentType
@@ -0,0 +1,27 @@
+<?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.warning.CalculatorService_one" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ContributionResolveException/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ContributionResolveException/Calculator.composite
new file mode 100644
index 0000000000..a1a699fc75
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ContributionResolveException/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="interfacejava.xml.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="interfacejava.xml.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ContributionResolveException/CalculatorServiceImpl.componentType b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ContributionResolveException/CalculatorServiceImpl.componentType
new file mode 100644
index 0000000000..7446e4f06a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacejava/xml/ContributionResolveException/CalculatorServiceImpl.componentType
@@ -0,0 +1,27 @@
+<?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="interfacejava.xml.CalculatorService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/Calculator.composite
new file mode 100644
index 0000000000..0bbb10706e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/Calculator.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: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" wsdli:wsdlLocation="http://tempuri.org"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/helloworld-interface.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/helloworld-interface.wsdl
new file mode 100644
index 0000000000..9d9376ad6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/helloworld-interface.wsdl
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<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" xmlns:g="http://greeting">
+
+ <!--
+ <import namespace="http://greeting" schemaLocation="../xsd/greeting.xsd" />
+ -->
+ <include schemaLocation="../xsd/helloworld.xsd" />
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="g:Name" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="g:Greeting" />
+ </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-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/helloworld-service.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/helloworld-service.wsdl
new file mode 100644
index 0000000000..3885357625
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/helloworld-service.wsdl
@@ -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.
+-->
+<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="helloworld-interface.wsdl" namespace="http://helloworld"></wsdl:import>
+ <!--
+ <wsdl:import 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:8085/sample-helloworldws-1.0-SNAPSHOT/services/HelloWorldWebService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworld.wsdl
new file mode 100644
index 0000000000..013a55b61e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworld.wsdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<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:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+ <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:HelloWorldSoapJmsBinding" name="HelloWorldSoapJmsPort">
+ <wsdlsoap:address location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworldwsjms.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworldwsjms.composite
new file mode 100644
index 0000000000..d9252ba54f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworldwsjms.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="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="binding.jms.HelloWorldServiceImpl" />
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld2)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapJmsBinding)"
+ uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/ClassNotFoundException/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/ClassNotFoundException/Calculator.composite
new file mode 100644
index 0000000000..48c3c5ffc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/ClassNotFoundException/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl">
+ </implementation.java>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/ClassNotFoundException/definitions.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/ClassNotFoundException/definitions.xml
new file mode 100644
index 0000000000..53d1a581f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/ClassNotFoundException/definitions.xml
@@ -0,0 +1,78 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <!-- POLICY SETS -->
+ <policySet name="ps1" provides="authorization" appliesTo="sca:implementation">
+ <authorization>
+ <permitAll />
+ </authorization>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps2" provides="authorization" appliesTo="sca:implementation">
+ <authorization>
+ <allow roles="r1 r2" />
+ </authorization>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps3" provides="authorization" appliesTo="sca:implementation">
+ <authorization>
+ <denyAll />
+ </authorization>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps4" provides="securityIdentity" appliesTo="sca:implementation">
+ <securityIdentity>
+ <runAs role="admin" />
+ </securityIdentity>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps5" provides="securityIdentity" appliesTo="sca:implementation">
+ <securityIdentity>
+ <useCallerIdentity />
+ </securityIdentity>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps6" provides="authorization" appliesTo="sca:implementation">
+ <permitAll />
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps7" provides="authorization" appliesTo="sca:implementation">
+ <allow roles="r1 r2" />
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps8" provides="authorization" appliesTo="sca:implementation">
+ <denyAll />
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps9" provides="securityIdentity" appliesTo="sca:implementation">
+ <runAs role="admin" />
+ </policySet>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/RequiredAttributeRolesMissing/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/RequiredAttributeRolesMissing/Calculator.composite
new file mode 100644
index 0000000000..48c3c5ffc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/RequiredAttributeRolesMissing/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl">
+ </implementation.java>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/RequiredAttributeRolesMissing/definitions.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/RequiredAttributeRolesMissing/definitions.xml
new file mode 100644
index 0000000000..ac45d95ce8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/security/RequiredAttributeRolesMissing/definitions.xml
@@ -0,0 +1,78 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <!-- POLICY SETS -->
+ <policySet name="ps1" provides="authorization" appliesTo="sca:implementation">
+ <authorization>
+ <permitAll />
+ </authorization>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps2" provides="authorization" appliesTo="sca:implementation">
+ <authorization>
+ <allow/>
+ </authorization>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps3" provides="authorization" appliesTo="sca:implementation">
+ <authorization>
+ <denyAll />
+ </authorization>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps4" provides="securityIdentity" appliesTo="sca:implementation">
+ <securityIdentity>
+ <runAs role="admin" />
+ </securityIdentity>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps5" provides="securityIdentity" appliesTo="sca:implementation">
+ <securityIdentity>
+ <useCallerIdentity />
+ </securityIdentity>
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps6" provides="authorization" appliesTo="sca:implementation">
+ <permitAll />
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps7" provides="authorization" appliesTo="sca:implementation">
+ <allow roles="r1 r2" />
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps8" provides="authorization" appliesTo="sca:implementation">
+ <denyAll />
+ </policySet>
+
+ <!-- POLICY SETS -->
+ <policySet name="ps9" provides="securityIdentity" appliesTo="sca:implementation">
+ <runAs role="admin" />
+ </policySet>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/Calculator.composite
new file mode 100644
index 0000000000..48c3c5ffc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl">
+ </implementation.java>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/definitions.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/definitions.xml
new file mode 100644
index 0000000000..5cf6963a96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/definitions.xml
@@ -0,0 +1,63 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- Extension Types Metadata -->
+<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
+ mayProvide="test:integrity"/>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/Calculator.composite
new file mode 100644
index 0000000000..48c3c5ffc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl">
+ </implementation.java>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/definitions.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/definitions.xml
new file mode 100644
index 0000000000..d31c705fb5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/definitions.xml
@@ -0,0 +1,76 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- Extension Types Metadata -->
+<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
+ mayProvide="test:integrity"/>
+
+<!-- qualified intents -->
+ <intent name="confidentiality.transport" constrains="sca:binding"/>
+ <intent name="confidentiality.message" />
+ <intent name="confidentiality.message.whole" />
+ <intent name="confidentiality.message.body" />
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/IntentNotSpecified/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/IntentNotSpecified/Calculator.composite
new file mode 100644
index 0000000000..48c3c5ffc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/IntentNotSpecified/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl">
+ </implementation.java>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/IntentNotSpecified/definitions.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/IntentNotSpecified/definitions.xml
new file mode 100644
index 0000000000..d214a7f40a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/IntentNotSpecified/definitions.xml
@@ -0,0 +1,175 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <!-- qualified intents -->
+ <sca:intent name="confidentiality.transport" />
+ <sca:intent name="confidentiality.message" />
+ <sca:intent name="confidentiality.message.whole" />
+ <sca:intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <sca:policySet name="SecureReliablePolicy"
+ provides="confidentiality.transport integrity"
+ appliesTo="//sca:binding.ws | //sca:binding.sca"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </sca:policySet>
+
+ <sca:policySet name="SecureMessagingPolicies"
+ provides="confidentiality"
+ appliesTo="//sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality_one" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "transport" alternative -->
+ </wsp:Policy>
+ <wsp:Policy>...</wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "message" alternative" -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="SecurityPolicy" provides="confidentiality"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <sca:intentMap provides="confidentiality" default="message">
+ <sca:qualifier name="message">
+ <sca:intentMap provides="message" default="whole">
+ <sca:qualifier name="body">
+ <wsp:Policy>
+ <!-- policy attachment for body encryption -->
+ </wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="whole">
+ <wsp:Policy>
+ <!-- policy attachment for whole message encryption -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:qualifier>
+ <sca:qualifier name="transport">
+ <wsp:Policy>
+ <!-- policy attachment for transport encryption -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="BasicAuthMsgProtSecurity"
+ provides="authentication confidentiality"
+ appliesTo="//sca:binding.ws"
+ xmlns="http://test">
+ <sca:policySetReference name="AuthenticationPolicies"/>
+ <sca:policySetReference name="ConfidentialityPolicies"/>
+</sca:policySet>
+
+<sca:policySet name="AuthenticationPolicies"
+ provides="authentication"
+ appliesTo="//sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</sca:policySet>
+
+<sca:policySet name="ConfidentialityPolicies"
+ provides="confidentiality"
+ bindings="binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:Policy>
+ <wsp:Policy>...</wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<!-- profile intent -->
+ <sca:intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="messageProtection">
+ <sca:description>
+ Protect messages from unauthorized reading or modification
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="messageProtection"
+ constrains="sca:binding"
+ requires="confidentiality integrity">
+ <sca:description>
+ Protect messages from unauthorized reading or modification
+ </sca:description>
+ </sca:intent>
+
+<!-- simple intent -->
+ <sca:intent name="confidentiality"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="integrity"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="authentication"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding required
+ Authentication.
+ </sca:description>
+ </sca:intent>
+
+</sca:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/MayProvideIntentNotFound/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/MayProvideIntentNotFound/Calculator.composite
new file mode 100644
index 0000000000..48c3c5ffc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/MayProvideIntentNotFound/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl">
+ </implementation.java>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/MayProvideIntentNotFound/definitions.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/MayProvideIntentNotFound/definitions.xml
new file mode 100644
index 0000000000..ede1786942
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/MayProvideIntentNotFound/definitions.xml
@@ -0,0 +1,63 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- Extension Types Metadata -->
+<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
+ mayProvide="test:integrity"/>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/RequiredAttributeMissing/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/RequiredAttributeMissing/Calculator.composite
new file mode 100644
index 0000000000..48c3c5ffc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/RequiredAttributeMissing/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl">
+ </implementation.java>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/RequiredAttributeMissing/definitions.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/RequiredAttributeMissing/definitions.xml
new file mode 100644
index 0000000000..fcb43c949b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/RequiredAttributeMissing/definitions.xml
@@ -0,0 +1,70 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- Extension Types Metadata -->
+<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+<bindingType alwaysProvides="test:confidentiality"
+ mayProvide="test:integrity"/>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/Calculator.composite
new file mode 100644
index 0000000000..48c3c5ffc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl">
+ </implementation.java>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/definitions.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/definitions.xml
new file mode 100644
index 0000000000..8346dcc01a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/definitions.xml
@@ -0,0 +1,242 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:test="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:calc="http://calculator">
+
+ <!-- Extension Types Metadata -->
+<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
+ mayProvide="test:integrity"/>
+
+ <!-- PolicySets -->
+ <policySet name="JDKLoggingPolicy" provides="tuscany:logging" appliesTo="sca:implementation.java"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <tuscany:jdkLogger name="calculator">
+ <logLevel>FINER</logLevel>
+ </tuscany:jdkLogger>
+ </policySet>
+
+ <!-- Intents and Policysets to assume targetnamespace -->
+<intent name="TestIntentOne"
+ constrains="sca:binding"
+ >
+ <description>
+ Test Intent
+ </description>
+ </intent>
+
+ <intent name="TestIntentTwo"
+ constrains="sca:binding"
+ requires="test:TestIntentOne">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <policySet name="TestPolicySetOne"
+ provides="test:TestIntentOne"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+
+ <!-- qualified intents -->
+ <intent name="confidentiality.transport" />
+ <intent name="confidentiality.message" />
+ <intent name="confidentiality.message.whole" />
+ <intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <policySet name="SecureReliablePolicy"
+ provides="test:confidentiality.transport test:integrity"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+<policySet name="SecurityPolicy" provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <intentMap provides="test:confidentiality" default="message">
+ <qualifier name="message">
+ <intentMap provides="message" default="whole">
+ <qualifier name="body">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for body encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="whole">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for whole message encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+ </qualifier>
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for transport encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="BasicAuthMsgProtSecurity"
+ provides="test:authentication test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <policySetReference name="test:AuthenticationPolicies"/>
+ <policySetReference name="test:ConfidentialityPolicies"/>
+</policySet>
+
+<policySet name="AuthenticationPolicies"
+ provides="test:authentication"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</policySet>
+
+<policySet name="ConfidentialityPolicies"
+ provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="test:confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="SecureWSPolicy"
+ provides="test:confidentiality"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SecurityToken>
+ <sp:TokenType>sp:X509v3</sp:TokenType>
+ </sp:SecurityToken>
+ <sp:UsernameToken />
+ <sp:SignedParts />
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:TransportBinding>
+ <sp:IncludeTimeStamp />
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </policySet>
+
+<!-- profile intent -->
+ <intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="test:messageProtection">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <intent name="messageProtection"
+ constrains="sca:binding"
+ requires="test:confidentiality test:integrity">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/Calculator.composite b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/Calculator.composite
new file mode 100644
index 0000000000..48c3c5ffc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.warning.CalculatorServiceImpl">
+ </implementation.java>
+ <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.warning.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.warning.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.warning.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.warning.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/definitions.xml b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/definitions.xml
new file mode 100644
index 0000000000..60f4de5cd3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/definitions.xml
@@ -0,0 +1,68 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- Extension Types Metadata -->
+<implementationType type="sca:interface.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/ContributionReadException.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/ContributionReadException.java
new file mode 100644
index 0000000000..9b0d51eb59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/ContributionReadException.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 assembly.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ContributionReadException extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/assemblyxml/ContributionReadException/Calculator.composite",
+ "TestContribution", "src/main/resources/assemblyxml/ContributionReadException/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ContributionReadException", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/PolicyImplValidationException.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/PolicyImplValidationException.java
new file mode 100644
index 0000000000..e8476991a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/PolicyImplValidationException.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 assembly.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PolicyImplValidationException extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/assemblyxml/PolicyImplValidationException/Calculator.composite",
+ "TestContribution", "src/main/resources/assemblyxml/PolicyImplValidationException/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PolicyImplValidationException", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/PolicyServiceValidationException.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/PolicyServiceValidationException.java
new file mode 100644
index 0000000000..8ae156d63e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/PolicyServiceValidationException.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 assembly.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PolicyServiceValidationException extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/assemblyxml/PolicyServiceValidationException/Calculator.composite",
+ "TestContribution", "src/main/resources/assemblyxml/PolicyServiceValidationException/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PolicyServiceValidationException", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedBindingElement.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedBindingElement.java
new file mode 100644
index 0000000000..d757ff98dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedBindingElement.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 assembly.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnexpectedBindingElement extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/assemblyxml/UnexpectedBindingElement/Calculator.composite",
+ "TestContribution", "src/main/resources/assemblyxml/UnexpectedBindingElement/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnexpectedBindingElement", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedImplementationElement.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedImplementationElement.java
new file mode 100644
index 0000000000..9a231a18c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedImplementationElement.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 assembly.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnexpectedImplementationElement extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/assemblyxml/UnexpectedImplementationElement/Calculator.composite",
+ "TestContribution", "src/main/resources/assemblyxml/UnexpectedImplementationElement/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnexpectedImplementationElement", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedInterfaceElement.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedInterfaceElement.java
new file mode 100644
index 0000000000..4ae88b9ba3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/assembly/xml/UnexpectedInterfaceElement.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 assembly.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnexpectedInterfaceElement extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/assemblyxml/UnexpectedInterfaceElement/Calculator.composite",
+ "TestContribution", "src/main/resources/assemblyxml/UnexpectedInterfaceElement/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnexpectedInterfaceElement", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.java
new file mode 100644
index 0000000000..ff94ad7b93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/ejb/UnknownEJBSessionTypeTestCase.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 binding.ejb;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnknownEJBSessionTypeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ System.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
+ System.setProperty("java.naming.provider.url", "ejbd://localhost:8085");
+ System.setProperty("managed", "false");
+
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingejb/UnknownEJBSessionType/account.composite",
+ "TestContribution",
+ "src/main/resources/bindingejb/UnknownEJBSessionType/");
+ } catch (Exception ex) {
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ System.clearProperty("java.naming.factory.initial");
+ System.clearProperty("java.naming.provider.url");
+ System.clearProperty("managed");
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnknownEJBSessionType", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.java
new file mode 100644
index 0000000000..a192674aeb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/ejb/UnknownEJBVersionTestCase.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 binding.ejb;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnknownEJBVersionTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ System.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
+ System.setProperty("java.naming.provider.url", "ejbd://localhost:8085");
+ System.setProperty("managed", "false");
+
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingejb/UnknownEJBVersion/account.composite",
+ "TestContribution", "src/main/resources/bindingejb/UnknownEJBVersion/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ System.clearProperty("java.naming.factory.initial");
+ System.clearProperty("java.naming.provider.url");
+ System.clearProperty("managed");
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnknownEJBVersion", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessActivationSpecTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessActivationSpecTestCase.java
new file mode 100644
index 0000000000..e0e5347d96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessActivationSpecTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DoesntProcessActivationSpecTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessActivationSpec/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/DoesntProcessActivationSpec/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DoesntProcessActivationSpec", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessDestinationTypeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessDestinationTypeTestCase.java
new file mode 100644
index 0000000000..9e08afec09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessDestinationTypeTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DoesntProcessDestinationTypeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessDestinationType/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/DoesntProcessDestinationType/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DoesntProcessDestinationType", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessHeadersTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessHeadersTestCase.java
new file mode 100644
index 0000000000..ed96072780
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessHeadersTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.junit.Ignore;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DoesntProcessHeadersTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessHeaders/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/DoesntProcessHeaders/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ @Ignore("TUSCANY-2532")
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+// assertEquals("DoesntProcessHeaders", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResourceAdapterTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResourceAdapterTestCase.java
new file mode 100644
index 0000000000..a2a5b0b872
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResourceAdapterTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DoesntProcessResourceAdapterTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessResourceAdapter/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/DoesntProcessResourceAdapter/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DoesntProcessResourceAdapter", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseActivationSpecTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseActivationSpecTestCase.java
new file mode 100644
index 0000000000..64b41623de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseActivationSpecTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DoesntProcessResponseActivationSpecTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessResponseActivationSpec/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/DoesntProcessResponseActivationSpec/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DoesntProcessResponseActivationSpec", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseConnectionFactoryTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseConnectionFactoryTestCase.java
new file mode 100644
index 0000000000..86fbe51dad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseConnectionFactoryTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DoesntProcessResponseConnectionFactoryTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessResponseConnectionFactory/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/DoesntProcessResponseConnectionFactory/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DoesntProcessResponseConnectionFactory", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseDestinationTypeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseDestinationTypeTestCase.java
new file mode 100644
index 0000000000..6e884c41cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/DoesntProcessResponseDestinationTypeTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DoesntProcessResponseDestinationTypeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/DoesntProcessResponseDestinationType/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/DoesntProcessResponseDestinationType/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DoesntProcessResponseDestinationType", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidCorrelationSchemeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidCorrelationSchemeTestCase.java
new file mode 100644
index 0000000000..c237f8af18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidCorrelationSchemeTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class InvalidCorrelationSchemeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/InvalidCorrelationScheme/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/InvalidCorrelationScheme/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("InvalidCorrelationScheme", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidJMSDeliveryModeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidJMSDeliveryModeTestCase.java
new file mode 100644
index 0000000000..52dc7e5795
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidJMSDeliveryModeTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class InvalidJMSDeliveryModeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/InvalidJMSDeliveryMode/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/InvalidJMSDeliveryMode/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("InvalidJMSDeliveryMode", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidJMSPriorityTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidJMSPriorityTestCase.java
new file mode 100644
index 0000000000..a93df290c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidJMSPriorityTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class InvalidJMSPriorityTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/InvalidJMSPriority/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/InvalidJMSPriority/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("InvalidJMSPriority", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidResponseDestinationTypeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidResponseDestinationTypeTestCase.java
new file mode 100644
index 0000000000..949ec02134
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/InvalidResponseDestinationTypeTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class InvalidResponseDestinationTypeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/InvalidResponseDestinationType/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/InvalidResponseDestinationType/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("InvalidResponseDestinationType", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingActivationSpecNameTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingActivationSpecNameTestCase.java
new file mode 100644
index 0000000000..a974ef0db4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingActivationSpecNameTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MissingActivationSpecNameTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/MissingActivationSpecName/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/MissingActivationSpecName/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MissingActivationSpecName", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingConnectionFactoryNameTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingConnectionFactoryNameTestCase.java
new file mode 100644
index 0000000000..adbaa50dc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingConnectionFactoryNameTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MissingConnectionFactoryNameTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/MissingConnectionFactoryName/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/MissingConnectionFactoryName/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MissingConnectionFactoryName", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingResponseActivationSpecTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingResponseActivationSpecTestCase.java
new file mode 100644
index 0000000000..4bba6b74de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingResponseActivationSpecTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MissingResponseActivationSpecTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/MissingResponseActivationSpec/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/MissingResponseActivationSpec/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MissingResponseActivationSpec", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingResponseConnectionFactoryTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingResponseConnectionFactoryTestCase.java
new file mode 100644
index 0000000000..8f4fc1a739
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MissingResponseConnectionFactoryTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MissingResponseConnectionFactoryTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/MissingResponseConnectionFactory/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/MissingResponseConnectionFactory/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MissingResponseConnectionFactory", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MustStartWithSchemaTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MustStartWithSchemaTestCase.java
new file mode 100644
index 0000000000..d9e1c782a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/MustStartWithSchemaTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MustStartWithSchemaTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/MustStartWithSchema/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/MustStartWithSchema/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MustStartWithSchema", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.java
new file mode 100644
index 0000000000..3e4e36d839
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnexpectedElementTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnexpectedElementTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/UnexpectedElement/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/UnexpectedElement/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnexpectedElement", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.java
new file mode 100644
index 0000000000..60ea47a85f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnexpectedResponseElementTestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnexpectedResponseElementTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/UnexpectedResponseElement/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/UnexpectedResponseElement/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnexpectedResponseElement", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnknownTokenInURITestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnknownTokenInURITestCase.java
new file mode 100644
index 0000000000..6a75a35f99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/jms/UnknownTokenInURITestCase.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 binding.jms;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnknownTokenInURITestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/bindingjms/UnknownTokenInURI/service.composite",
+ "TestContribution", "src/main/resources/bindingjms/UnknownTokenInURI/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnknownTokenInURI", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/InvalidWsdlElementAttrTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/InvalidWsdlElementAttrTestCase.java
new file mode 100644
index 0000000000..c0f60a848f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/InvalidWsdlElementAttrTestCase.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 binding.wsxml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class InvalidWsdlElementAttrTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/binding/wsxml/InvalidWsdlElementAttr/Calculator.composite",
+ "TestContribution", "src/main/resources/binding/wsxml/InvalidWsdlElementAttr/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("InvalidWsdlElementAttr", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/MustUseWsdlBindingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/MustUseWsdlBindingTestCase.java
new file mode 100644
index 0000000000..5a74194796
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/MustUseWsdlBindingTestCase.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 binding.wsxml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MustUseWsdlBindingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/binding/wsxml/MustUseWsdlBinding/Calculator.composite",
+ "TestContribution", "src/main/resources/binding/wsxml/MustUseWsdlBinding/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MustUseWsdlBinding", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlBindingDoesNotMatchTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlBindingDoesNotMatchTestCase.java
new file mode 100644
index 0000000000..7991de7176
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlBindingDoesNotMatchTestCase.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 binding.wsxml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class WsdlBindingDoesNotMatchTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/helloworldwsjms.composite",
+ "TestContribution", "src/main/resources/binding/wsxml/WsdlBindingDoesNotMatch/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("WsdlBindingDoesNotMatch", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlPortTypeDoesNotMatchTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlPortTypeDoesNotMatchTestCase.java
new file mode 100644
index 0000000000..1ef5f7b00a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlPortTypeDoesNotMatchTestCase.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 binding.wsxml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class WsdlPortTypeDoesNotMatchTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/helloworldwsclient.composite",
+ "TestContribution", "src/main/resources/binding/wsxml/WsdlPortTypeDoesNotMatch/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("WsdlPortTypeDoesNotMatch", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlServiceDoesNotMatchTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlServiceDoesNotMatchTestCase.java
new file mode 100644
index 0000000000..a0a7d12b9f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/binding/wsxml/WsdlServiceDoesNotMatchTestCase.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 binding.wsxml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class WsdlServiceDoesNotMatchTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/helloworldwsjms.composite",
+ "TestContribution", "src/main/resources/binding/wsxml/WsdlServiceDoesNotMatch/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("WsdlServiceDoesNotMatch", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java
new file mode 100644
index 0000000000..555810f453
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.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 calculator.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ComponentReferenceTargetNotFoundTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/ComponentReferenceTargetNotFound/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/ComponentReferenceTargetNotFound").toURL().toString()));
+
+ try {
+ node.start();
+ } catch (Exception ex){
+ // do nothing - the SCA binding throws and exception here
+ // because the interface for the reference is not remotable
+ }
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ComponentReferenceTargetNotFound", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java
new file mode 100644
index 0000000000..4d70df1102
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.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 calculator.warning;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DuplicateComponentNameTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/DuplicateComponentName/Calculator.composite",
+ "TestContribution", "src/main/resources/DuplicateComponentName/");
+ customDomain.buildContribution();
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DuplicateComponentName", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java
new file mode 100644
index 0000000000..7593f39991
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.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 calculator.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DuplicateImplementationPropertyNameTestCase extends TestCase {
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/DuplicateImplementationPropertyName/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/DuplicateImplementationPropertyName").toURL().toString()));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DuplicateImplementationPropertyName", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java
new file mode 100644
index 0000000000..0a711175dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.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 calculator.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DuplicateImplementationReferenceNameTestCase extends TestCase {
+
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/DuplicateImplementationReferenceName/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/DuplicateImplementationReferenceName").toURL().toString()));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DuplicateImplementationReferenceName", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java
new file mode 100644
index 0000000000..10660795a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DuplicatePropertyNameTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/DuplicatePropertyName/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/DuplicatePropertyName").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DuplicateComponentPropertyName", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java
new file mode 100644
index 0000000000..15b4b15989
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class DuplicateReferenceNameTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/DuplicateReferenceName/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/DuplicateReferenceName").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("DuplicateComponentReferenceName", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java
new file mode 100644
index 0000000000..55741ec2ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MultipleBindingsForServiceTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/MultipleBindingsForService/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/MultipleBindingsForService").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MultipleBindingsForService", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java
new file mode 100644
index 0000000000..7f8bd68e5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.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 calculator.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class NoComponentImplementationTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/NoComponentImplementation/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/NoComponentImplementation").toURL().toString()));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("NoComponentImplementation", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java
new file mode 100644
index 0000000000..1f26d3a7d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class NoCompositeNamespaceTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/NoCompositeNamespace/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/NoCompositeNamespace").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("NoCompositeNamespace", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java
new file mode 100644
index 0000000000..d398efc9ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.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 calculator.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class NoMatchingBindingTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node =
+ nodeFactory.createSCANode("Calculator.composite", new SCAContribution("TestContribution", new File("src/main/resources/NoMatchingBinding")
+ .toURL().toString()));
+
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("NoMatchingBinding", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java
new file mode 100644
index 0000000000..9d2f028dea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PromotedReferenceNotFoundTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/PromotedReferenceNotFound/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/PromotedReferenceNotFound").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PromotedReferenceNotFound", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java
new file mode 100644
index 0000000000..7f836e4b01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PromotedServiceNotFoundTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/PromotedServiceNotFound/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/PromotedServiceNotFound").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PromotedServiceNotFound", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java
new file mode 100644
index 0000000000..04c2594cd3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PropertyAttributeMustSupplyNullTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/PropertyAttribute/CalculatorNullMustSupply.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/PropertyAttribute").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PropertyMustSupplyNull", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java
new file mode 100644
index 0000000000..3dabfecbb6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PropertyAttributeTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/PropertyAttribute/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/PropertyAttribute").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PropertyMustSupplyIncompatible", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java
new file mode 100644
index 0000000000..0dca8ed1df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PropertyNotFoundTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/PropertyNotFound/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/PropertyNotFound").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PropertyNotFound", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java
new file mode 100644
index 0000000000..37f7ef352e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PropertyOverrideManyAttributeTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/PropertyAttribute/CalculatorOverrideManyAttribute.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/PropertyAttribute").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PropertyOverrideManyAttribute", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java
new file mode 100644
index 0000000000..ab57283a9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ReferenceIncompatibleComponentInterfaceTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceIncompatibleComponentInterface/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/ReferenceIncompatibleComponentInterface").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ReferenceIncompatibleComponentInterface", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java
new file mode 100644
index 0000000000..4c3cc3856a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ReferenceIncompatibleInterfaceTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceIncompatibleInterface/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/ReferenceIncompatibleInterface").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ReferenceIncompatibleInterface", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java
new file mode 100644
index 0000000000..06fb06f6ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ReferenceIncompatibleMultiplicityTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceIncompatibleMultiplicity/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/ReferenceIncompatibleMultiplicity").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ReferenceIncompatibleMultiplicity", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java
new file mode 100644
index 0000000000..6bacc8b05e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.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 calculator.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ReferenceNotFoundTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/ReferenceNotFound/Calculator.composite",
+ "TestContribution",
+ "src/main/resources/ReferenceNotFound/");
+ customDomain.buildContribution();
+ } catch (Exception ex){
+ throw ex;
+ }
+
+
+ /*
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceNotFound/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/ReferenceNotFound").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ */
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ReferenceNotFound", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java
new file mode 100644
index 0000000000..d615857105
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ReferenceWithoutTargetsTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceWithoutTargets/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/ReferenceWithoutTargets").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ReferenceWithoutTargets", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java
new file mode 100644
index 0000000000..e9b920119a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.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.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ServiceNotFoundForComponentServiceTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/ServiceNotFoundForComponentService/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/ServiceNotFoundForComponentService").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ServiceNotFoundForComponentService", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java
new file mode 100644
index 0000000000..4d950e30ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.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 calculator.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnresolvedComponentImplementationTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(new File("src/main/resources/UnresolvedComponentImplementation/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/UnresolvedComponentImplementation").toURL().toString()));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ }
+
+ public void testCalculator() throws Exception {
+ ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnresolvedComponentImplementation", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java
new file mode 100644
index 0000000000..60b08764c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.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 calculator.warning;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class XSDValidationTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+ private Exception startUpException;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ try {
+ node = nodeFactory.createSCANode(new File("src/main/resources/XsdValidation/Calculator.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/XsdValidation").toURL().toString()));
+ node.start();
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ } catch (Exception ex){
+ startUpException = ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (node != null){
+ node.stop();
+ }
+ }
+
+
+ public void testCalculator() throws Exception {
+
+ assertEquals("org.osoa.sca.ServiceRuntimeException: Unexpected <binding> element found. It should appear inside a <service> or <reference> element.", startUpException.getMessage());
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/java/AttributePackageMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/java/AttributePackageMissingTestCase.java
new file mode 100644
index 0000000000..04135ab2cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/java/AttributePackageMissingTestCase.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 contribution.java;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class AttributePackageMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/contribution/java/AttributePackageMissing/Calculator.composite",
+ "TestContribution", "src/main/resources/contribution/java/AttributePackageMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("AttributePackageMissing", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/namespace/AttributeNameSpaceMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/namespace/AttributeNameSpaceMissingTestCase.java
new file mode 100644
index 0000000000..ab0afc6f65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/namespace/AttributeNameSpaceMissingTestCase.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 contribution.namespace;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class AttributeNameSpaceMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/contribution/namespace/AttributeNameSpaceMissing/Calculator.composite",
+ "TestContribution", "src/main/resources/contribution/namespace/AttributeNameSpaceMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("AttributeNameSpaceMissing", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/resource/AttributeURIMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/resource/AttributeURIMissingTestCase.java
new file mode 100644
index 0000000000..69c4d40bc7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/resource/AttributeURIMissingTestCase.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 contribution.resource;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class AttributeURIMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/contribution/resource/AttributeURIMissing/Calculator.composite",
+ "TestContribution", "src/main/resources/contribution/resource/AttributeURIMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getProblems().get(0);
+
+ assertNotNull(problem);
+ assertEquals("AttributeURIMissing", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/xml/AttributeCompositeMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/xml/AttributeCompositeMissingTestCase.java
new file mode 100644
index 0000000000..32c1a8b3a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/contribution/xml/AttributeCompositeMissingTestCase.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 contribution.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class AttributeCompositeMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/contribution/xml/AttributeCompositeMissing/Calculator.composite",
+ "TestContribution", "src/main/resources/contribution/xml/AttributeCompositeMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("AttributeCompositeMissing", problem.getMessageId());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/domain/CustomCompositeBuilder.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/domain/CustomCompositeBuilder.java
new file mode 100644
index 0000000000..8665bfd535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/domain/CustomCompositeBuilder.java
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package domain;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+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.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+import org.apache.tuscany.sca.implementation.node.builder.impl.NodeCompositeBuilderImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
+import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
+
+public class CustomCompositeBuilder {
+ private URLArtifactProcessor<Contribution> contributionProcessor;
+ private ModelResolverExtensionPoint modelResolvers;
+ private ModelFactoryExtensionPoint modelFactories;
+ private WorkspaceFactory workspaceFactory;
+ private AssemblyFactory assemblyFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessor<Object> xmlProcessor;
+ private ContributionDependencyBuilder contributionDependencyBuilder;
+ private CompositeBuilder domainCompositeBuilder;
+ private CompositeBuilder nodeCompositeBuilder;
+ private NodeImplementationFactory nodeFactory;
+ //private AtomBindingFactory atomBindingFactory;
+ private static Workspace workspace;
+ private List<SCADefinitions> policyDefinitions;
+ private Monitor monitor;
+
+ private CustomCompositeBuilder() {
+ // no code req'd
+ }
+
+ public static CustomCompositeBuilder getInstance()
+ {
+ if (ref == null)
+ ref = new CustomCompositeBuilder();
+ return ref;
+ }
+
+ private static CustomCompositeBuilder ref;
+
+ private void init() {
+
+ // Create extension point registry
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ monitor = monitorFactory.createMonitor();
+
+ // Initialize the Tuscany module activators
+ ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
+ for (ModuleActivator activator: moduleActivators.getModuleActivators()) {
+ activator.start(extensionPoints);
+ }
+
+ // Get XML input/output factories
+ modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+
+ // Get contribution workspace and assembly model factories
+ workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ nodeFactory = modelFactories.getFactory(NodeImplementationFactory.class);
+ //atomBindingFactory = modelFactories.getFactory(AtomBindingFactory.class);
+
+ // Create XML artifact processors
+ StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor);
+
+ // Create contribution content processor
+ URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class);
+
+ // Get the model resolvers
+ modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
+
+ // Create a contribution dependency builder
+ contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor);
+
+ // Create a composite builder
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
+ domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
+
+ // Create a node composite builder
+ nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, contractMapper, null, monitor);
+ }
+
+ public void loadContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {
+ init();
+
+ // Create workspace model
+ workspace = workspaceFactory.createWorkspace();
+ workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories));
+
+ // Read the sample store contribution
+ URI artifactURI = URI.create(sourceURI);
+ //URL contributionURL = FileHelper.toFile(new URL(sourceURL)).toURI().toURL();
+ URL artifactURL = new File(sourceURL).toURI().toURL();
+ URL contributionURL = new File(compositeURL).toURI().toURL();
+ Contribution storeContribution = contributionProcessor.read(contributionURL, artifactURI, artifactURL);
+ workspace.getContributions().add(storeContribution);
+
+ // Build the contribution dependencies
+ Map<Contribution, List<Contribution>> contributionDependencies = new HashMap<Contribution, List<Contribution>>();
+ Set<Contribution> resolved = new HashSet<Contribution>();
+ for (Contribution contribution: workspace.getContributions()) {
+ List<Contribution> dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace);
+
+ // Resolve contributions
+ for (Contribution dependency: dependencies) {
+ if (!resolved.contains(dependency)) {
+ resolved.add(dependency);
+ contributionProcessor.resolve(dependency, workspace.getModelResolver());
+ }
+ }
+
+ contributionDependencies.put(contribution, dependencies);
+ }
+
+ // Create a composite model for the domain
+ /*Composite domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA10_NS, "domain"));
+
+ // Add all deployables to it, normally the domain administrator would select
+ // the deployables to include
+ domainComposite.getIncludes().addAll(workspace.getDeployables());
+
+ // Build the domain composite and wire the components included in it
+ domainCompositeBuilder.build(domainComposite);*/
+ }
+
+ public Monitor getMonitorInstance() {
+ return monitor;
+ }
+
+ public void buildContribution() throws Exception {
+ // Create a composite model for the domain
+ Composite domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName("http://customdomain", "domain"));
+
+ // Add all deployables to it, normally the domain administrator would select
+ // the deployables to include
+ domainComposite.getIncludes().addAll(workspace.getDeployables());
+
+ // Build the domain composite and wire the components included in it
+ domainCompositeBuilder.build(domainComposite);
+ }
+
+ public void readContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {
+ init();
+
+ // Create workspace model
+ workspace = workspaceFactory.createWorkspace();
+ workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories));
+
+ // Read the sample store contribution
+ URI artifactURI = URI.create(sourceURI);
+ //URL contributionURL = FileHelper.toFile(new URL(sourceURL)).toURI().toURL();
+ URL artifactURL = new File(sourceURL).toURI().toURL();
+ URL contributionURL = new File(compositeURL).toURI().toURL();
+ Contribution storeContribution = contributionProcessor.read(contributionURL, artifactURI, artifactURL);
+ workspace.getContributions().add(storeContribution);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.java
new file mode 100644
index 0000000000..9d97e3611a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/AttributeUnrecognizedNamespaceTestCase.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 impl.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class AttributeUnrecognizedNamespaceTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/bpel/AttributeUnrecognizedNamespace/helloworld.composite",
+ "TestContribution", "src/main/resources/impl/bpel/AttributeUnrecognizedNamespace/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("AttributeUnrecognizedNamespace", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.java
new file mode 100644
index 0000000000..80c15dc444
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/AttributeWithoutNamespaceTestCase.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 impl.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class AttributeWithoutNamespaceTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/bpel/AttributeWithoutNamespace/helloworld.composite",
+ "TestContribution", "src/main/resources/impl/bpel/AttributeWithoutNamespace/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("AttributeWithoutNamespace", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.java
new file mode 100644
index 0000000000..81e8aecfeb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/BPELProcessNotFoundTestCase.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 impl.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class BPELProcessNotFoundTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/bpel/BPELProcessNotFound/helloworld.composite",
+ "TestContribution", "src/main/resources/impl/bpel/BPELProcessNotFound/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("BPELProcessNotFound", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.java
new file mode 100644
index 0000000000..fb0c525aea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/CannotResolveWSDLReferenceTestCase.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 impl.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CannotResolveWSDLReferenceTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/bpel/CannotResolveWSDLReference/helloworld.composite",
+ "TestContribution", "src/main/resources/impl/bpel/CannotResolveWSDLReference/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("CannotResolveWSDLReference", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.java
new file mode 100644
index 0000000000..445629457e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/MyRolePartnerRoleNullTestCase.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 impl.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MyRolePartnerRoleNullTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/bpel/MyRolePartnerRoleNull/helloworld.composite",
+ "TestContribution", "src/main/resources/impl/bpel/MyRolePartnerRoleNull/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MyRolePartnerRoleNull", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.java
new file mode 100644
index 0000000000..00b904ae65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkHasBothAttrTestCase.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 impl.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PartnerLinkHasBothAttrTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/bpel/PartnerLinkHasBothAttr/helloworld.composite",
+ "TestContribution", "src/main/resources/impl/bpel/PartnerLinkHasBothAttr/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("PartnerLinkHasBothAttr"));
+ /*Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+ assertNotNull(problem);
+ assertEquals("PartnerLinkHasBothAttr", problem.getMessageId());*/
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.java
new file mode 100644
index 0000000000..b7a4ee6fef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkNoMatchingTypeTestCase.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 impl.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PartnerLinkNoMatchingTypeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/bpel/PartnerLinkNoMatchingType/helloworld.composite",
+ "TestContribution", "src/main/resources/impl/bpel/PartnerLinkNoMatchingType/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PartnerLinkNoMatchingType", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.java
new file mode 100644
index 0000000000..32d3211f36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/bpel/PartnerLinkTypeNoRolesTestCase.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 impl.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PartnerLinkTypeNoRolesTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/helloworld.composite",
+ "TestContribution", "src/main/resources/impl/bpel/PartnerLinkTypeNoRoles/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("PartnerLinkTypeNoRoles"));
+ /*Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+ assertNotNull(problem);
+ assertEquals("PartnerLinkTypeNoRoles", problem.getMessageId());*/
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.java
new file mode 100644
index 0000000000..b31451c433
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/ejb/EJBLinkAttributeMissingTestCase.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 impl.ejb;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class EJBLinkAttributeMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/ejb/EJBLinkAttributeMissing/ejb.composite",
+ "TestContribution", "src/main/resources/impl/ejb/EJBLinkAttributeMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("EJBLinkAttributeMissing", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.java
new file mode 100644
index 0000000000..3a7745722a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/java/ClassNotFoundExceptionTestCase.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 impl.java;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ClassNotFoundExceptionTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/java/ClassNotFoundException/Calculator.composite",
+ "TestContribution", "src/main/resources/impl/java/ClassNotFoundException/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ClassNotFoundException", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.java
new file mode 100644
index 0000000000..59fc3ce79c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/java/ContributionResolveExceptionTestCase.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 impl.java;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ContributionResolveExceptionTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/java/ContributionResolveException/Calculator.composite",
+ "TestContribution", "src/main/resources/impl/java/ContributionResolveException/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+
+ assertNotNull(problem);
+ assertEquals("ContributionResolveException", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.java
new file mode 100644
index 0000000000..6f54ad140c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/CouldNotLocateOSGiBundleTestCase.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 impl.osgi;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CouldNotLocateOSGiBundleTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ //OSGiTestBundles.createBundle("src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
+
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/osgitest.composite",
+ "TestContribution", "src/main/resources/impl/osgi/CouldNotLocateOSGiBundle/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ OSGiRuntime.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("CouldNotLocateOSGiBundle", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.java
new file mode 100644
index 0000000000..3d75fa8ccc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/MissingComponentTypeFileTestCase.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 impl.osgi;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MissingComponentTypeFileTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ OSGiTestBundles.createBundle("src/main/resources/impl/osgi/MissingComponentTypeFile/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
+
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/osgi/MissingComponentTypeFile/osgitest.composite",
+ "TestContribution", "src/main/resources/impl/osgi/MissingComponentTypeFile/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ OSGiRuntime.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MissingComponentTypeFile", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.java
new file mode 100644
index 0000000000..398c028dd8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/OSGiTestBundles.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 impl.osgi;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.net.URL;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+
+
+/**
+ *
+ * Utility class to create OSGi bundles
+ *
+ * @version $Rev$ $Date$
+ */
+public class OSGiTestBundles {
+
+ public static void createBundle(String jarName,
+ Class<?> interfaceClass, Class<?> implClass) throws Exception {
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ String EOL = System.getProperty("line.separator");
+
+ String packageName = interfaceClass.getPackage().getName();
+ String bundleName = interfaceClass.getName();
+
+ String manifestStr = "Manifest-Version: 1.0" + EOL
+ + "Bundle-ManifestVersion: 2" + EOL + "Bundle-Name: "
+ + bundleName + EOL + "Bundle-SymbolicName: " + bundleName + EOL
+ + "Bundle-Version: " + "1.0.0" + EOL
+ + "Bundle-Localization: plugin" + EOL;
+
+ StringBuilder manifestBuf = new StringBuilder();
+ manifestBuf.append(manifestStr);
+ manifestBuf.append("Export-Package: " + packageName + EOL);
+ manifestBuf.append("Import-Package: org.osgi.framework" + EOL);
+ manifestBuf.append("Bundle-Activator: " + implClass.getName() + EOL);
+
+ ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
+ Manifest manifest = new Manifest();
+ manifest.read(manifestStream);
+
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ String interfaceClassName = interfaceClass.getName().replaceAll("\\.",
+ "/")
+ + ".class";
+
+ URL url = interfaceClass.getClassLoader().getResource(
+ interfaceClassName);
+ String path = url.getPath();
+
+ ZipEntry ze = new ZipEntry(interfaceClassName);
+
+ jarOut.putNextEntry(ze);
+ FileInputStream file = new FileInputStream(path);
+ byte[] fileContents = new byte[file.available()];
+ file.read(fileContents);
+ jarOut.write(fileContents);
+
+ String implClassName = implClass.getName().replaceAll("\\.",
+ "/")
+ + ".class";
+
+ url = implClass.getClassLoader().getResource(implClassName);
+ path = url.getPath();
+
+ ze = new ZipEntry(implClassName);
+
+ jarOut.putNextEntry(ze);
+ file = new FileInputStream(path);
+ fileContents = new byte[file.available()];
+ file.read(fileContents);
+ jarOut.write(fileContents);
+
+ file.close();
+
+ jarOut.close();
+ out.close();
+
+ FileOutputStream fileOut = new FileOutputStream(jarName);
+ fileOut.write(out.toByteArray());
+ fileOut.close();
+
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.java
new file mode 100644
index 0000000000..117a94337a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/osgi/PropertyShouldSpecifySRTestCase.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 impl.osgi;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class PropertyShouldSpecifySRTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ OSGiTestBundles.createBundle("src/main/resources/impl/osgi/PropertyShouldSpecifySR/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
+
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/osgi/PropertyShouldSpecifySR/osgitest.composite",
+ "TestContribution", "src/main/resources/impl/osgi/PropertyShouldSpecifySR/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ OSGiRuntime.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("PropertyShouldSpecifySR", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.java
new file mode 100644
index 0000000000..14ba8e992e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/resource/CouldNotResolveLocationTestCase.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 impl.resource;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CouldNotResolveLocationTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/resource/CouldNotResolveLocation/resource.composite",
+ "TestContribution", "src/main/resources/impl/resource/CouldNotResolveLocation/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ Assert.assertNotNull(problem);
+ Assert.assertEquals("CouldNotResolveLocation", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.java
new file mode 100644
index 0000000000..461895f824
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/resource/LocationAttributeMissingTestCase.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 impl.resource;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class LocationAttributeMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/resource/LocationAttributeMissing/resource.composite",
+ "TestContribution", "src/main/resources/impl/resource/LocationAttributeMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("LocationAttributeMissing", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.java
new file mode 100644
index 0000000000..9b7dbef3dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/ContributionResolveExceptionTestCase.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 impl.spring;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ContributionResolveExceptionTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/spring/ContributionResolveException/SpringHelloWorld.composite",
+ "TestContribution", "src/main/resources/impl/spring/ContributionResolveException/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("ContributionResolveException"));
+ //assertEquals("ContributionResolveException", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.java
new file mode 100644
index 0000000000..cd38b53f66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/LocationAttributeMissingTestCase.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 impl.spring;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class LocationAttributeMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/spring/LocationAttributeMissing/SpringHelloWorld.composite",
+ "TestContribution", "src/main/resources/impl/spring/LocationAttributeMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("LocationAttributeMissing", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.java
new file mode 100644
index 0000000000..83550ae58d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/spring/UnableToResolveComponentTypeTestCase.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 impl.spring;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnableToResolveComponentTypeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/spring/UnableToResolveComponentType/SpringHelloWorld.composite",
+ "TestContribution", "src/main/resources/impl/spring/UnableToResolveComponentType/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ //assertNotNull(problem);
+ //assertEquals("UnableToResolveComponentType", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.java
new file mode 100644
index 0000000000..d098bb4bf8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/widget/CouldNotResolveLocationTestCase.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 impl.widget;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CouldNotResolveLocationTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/widget/CouldNotResolveLocation/widget.composite",
+ "TestContribution", "src/main/resources/impl/widget/CouldNotResolveLocation/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ Assert.assertNotNull(problem);
+ Assert.assertEquals("CouldNotResolveLocation", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.java
new file mode 100644
index 0000000000..2f85d8ed4a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/widget/LocationAttributeMissingTestCase.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 impl.widget;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class LocationAttributeMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/widget/LocationAttributeMissing/widget.composite",
+ "TestContribution", "src/main/resources/impl/widget/LocationAttributeMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //nothing to do
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("LocationAttributeMissing", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.java
new file mode 100644
index 0000000000..f90fc3b83f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/xquery/CouldNotLocateFileTestCase.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 impl.xquery;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CouldNotLocateFileTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/xquery/CouldNotLocateFile/HelloWorld.composite",
+ "TestContribution", "src/main/resources/impl/xquery/CouldNotLocateFile/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("CouldNotLocateFile", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.java
new file mode 100644
index 0000000000..01450a8836
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/impl/xquery/LocationAttributeMissingTestCase.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 impl.xquery;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class LocationAttributeMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/impl/xquery/LocationAttributeMissing/HelloWorld.composite",
+ "TestContribution", "src/main/resources/impl/xquery/LocationAttributeMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("LocationAttributeMissing", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacejava/xml/ClassNotFoundTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacejava/xml/ClassNotFoundTestCase.java
new file mode 100644
index 0000000000..a03e056298
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacejava/xml/ClassNotFoundTestCase.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 interfacejava.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ClassNotFoundTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/interfacejava/xml/ClassNotFoundException/Calculator.composite",
+ "TestContribution", "src/main/resources/interfacejava/xml/ClassNotFoundException/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ClassNotFoundException", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacejava/xml/ContributionResolveExceptionTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacejava/xml/ContributionResolveExceptionTestCase.java
new file mode 100644
index 0000000000..e0524f57b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacejava/xml/ContributionResolveExceptionTestCase.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 interfacejava.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ContributionResolveExceptionTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/interfacejava/xml/ContributionResolveException/Calculator.composite",
+ "TestContribution", "src/main/resources/interfacejava/xml/ContributionResolveException/");
+ } catch (Exception ex){
+ throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ //assertNotNull(problem);
+ //assertEquals("ContributionResolveException", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java
new file mode 100644
index 0000000000..e212477c61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.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 interfacewsdl.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class InvalidWSDLInterfaceAttrTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/Calculator.composite",
+ "TestContribution", "src/main/resources/interfacewsdl/xml/InvalidWSDLInterfaceAttr/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("InvalidWSDLInterfaceAttr", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacewsdl/xml/WsdlInterfaceDoesNotMatchTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacewsdl/xml/WsdlInterfaceDoesNotMatchTestCase.java
new file mode 100644
index 0000000000..df2a2671df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/interfacewsdl/xml/WsdlInterfaceDoesNotMatchTestCase.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 interfacewsdl.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class WsdlInterfaceDoesNotMatchTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/helloworldwsjms.composite",
+ "TestContribution", "src/main/resources/interfacewsdl/xml/WsdlInterfaceDoesNotMatch/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("WsdlInterfaceDoesNotMatch", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.java
new file mode 100644
index 0000000000..361e2f2bfb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/AlwaysProvidedIntentNotFoundTestCase.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 policy.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class AlwaysProvidedIntentNotFoundTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/AlwaysProvidedIntentNotFound/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("AlwaysProvidedIntentNotFound", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.java
new file mode 100644
index 0000000000..a85dc334f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/ErrorInPolicyIntentDefinitionTestCase.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 policy.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class ErrorInPolicyIntentDefinitionTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/ErrorInPolicyIntentDefinition/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("ErrorInPolicyIntentDefinition", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.java
new file mode 100644
index 0000000000..3f98757ce5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/IntentNotSpecifiedTestCase.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 policy.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class IntentNotSpecifiedTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/IntentNotSpecified/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/IntentNotSpecified/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("IntentNotSpecified"));
+ /*Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+ assertNotNull(problem);
+ assertEquals("IntentNotSpecified", problem.getMessageId());*/
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.java
new file mode 100644
index 0000000000..3b8d075165
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/MayProvideIntentNotFoundTestCase.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 policy.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MayProvideIntentNotFoundTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/MayProvideIntentNotFound/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/MayProvideIntentNotFound/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("MayProvideIntentNotFound", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.java
new file mode 100644
index 0000000000..bcf1f82392
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/RequiredAttributeMissingTestCase.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 policy.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class RequiredAttributeMissingTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/RequiredAttributeMissing/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/RequiredAttributeMissing/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("RequiredAttributeMissing", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.java
new file mode 100644
index 0000000000..5683d54e64
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/UnableToMapPoliciesTestCase.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 policy.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+import org.junit.Ignore;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnableToMapPoliciesTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/UnableToMapPolicies/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/UnableToMapPolicies/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ @Ignore("TUSCANY-2538")
+ public void testCalculator() {
+ //FIXME This needs to be fixed, as it was working based on processor ignoring
+ //elements...
+ /*
+ Monitor monitor = customDomain.getMonitorInstance();
+ assertTrue(((DefaultLoggingMonitorImpl)monitor).isMessageLogged("UnableToMapPolicies"));
+ */
+ /*Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+ assertNotNull(problem);
+ assertEquals("UnableToMapPolicies", problem.getMessageId());*/
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.java
new file mode 100644
index 0000000000..eec39d711e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/validation/src/test/java/policy/xml/UnrecognizedIntentAttachPointTypeTestCase.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 policy.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
+
+import domain.CustomCompositeBuilder;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class UnrecognizedIntentAttachPointTypeTestCase extends TestCase {
+
+ private CustomCompositeBuilder customDomain;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/Calculator.composite",
+ "TestContribution", "src/main/resources/policy/xml/UnrecognizedIntentAttachPointType/");
+ } catch (Exception ex){
+ //throw ex;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //node.stop();
+ }
+
+ public void testCalculator() {
+ Monitor monitor = customDomain.getMonitorInstance();
+ Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
+
+ assertNotNull(problem);
+ assertEquals("UnrecognizedIntentAttachPointType", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wires/pom.xml b/sca-java-1.x/branches/sca-android/itest/wires/pom.xml
new file mode 100644
index 0000000000..08a97d8414
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wires/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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wires</artifactId>
+ <name>Apache Tuscany SCA Wires Basic Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java b/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java
new file mode 100644
index 0000000000..09d5b0278e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.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.itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the client interface for the wires tests
+ */
+@Remotable
+public interface WireClient {
+
+ /**
+ * This tests the wires.
+ */
+ void runTests();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java b/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java
new file mode 100644
index 0000000000..f0964ebb93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.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;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is the client implementation for the wires tests
+ */
+@Service(WireClient.class)
+public class WireClientImpl implements WireClient {
+ /**
+ * This is our injected reference to the WireService
+ */
+ @Reference
+ protected WireService aWireService;
+
+ /**
+ * This tests the wire reference
+ */
+ public void runTests() {
+ // Make sure the wire has injected a reference
+ Assert.assertNotNull(aWireService);
+
+ // Test the injected reference
+ String msg = aWireService.sayHello("MCC");
+
+ // Validate the response
+ Assert.assertNotNull(msg);
+ Assert.assertEquals("Hello MCC", msg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java b/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java
new file mode 100644
index 0000000000..c19a0b4f74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Sample Wire Service
+ */
+@Remotable
+public interface WireService {
+ /**
+ * Returns "Hello " + aName
+ *
+ * @param aName The name to say hello
+ * @return "Hello " + aName
+ */
+ String sayHello(String aName);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java
new file mode 100644
index 0000000000..b7ccdbf8d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.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.Service;
+
+/**
+ * Sample WireService Implementation
+ */
+@Service(WireService.class)
+public class WireServiceImpl implements WireService {
+
+ /**
+ * Returns "Hello " + aName
+ *
+ * @param aName The name to say hello
+ * @return "Hello " + aName
+ */
+ public String sayHello(String aName) {
+ return "Hello " + aName;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wires/src/main/resources/WireTest.composite b/sca-java-1.x/branches/sca-android/itest/wires/src/main/resources/WireTest.composite
new file mode 100644
index 0000000000..8b764d0e7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wires/src/main/resources/WireTest.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://wires" name="WireTest">
+
+ <component name="WireClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.WireClientImpl"/>
+<!-- We are not using a reference - we are using a wire - see below -->
+<!-- The equivalent reference for the wire would be as follows -->
+<!-- <reference name="aWireService" target="WireService"/>-->
+ </component>
+
+ <component name="AnotherWireClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.WireClientImpl"/>
+ </component>
+
+ <component name="WireServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.WireServiceImpl"/>
+ </component>
+
+ <wire source="WireClient/aWireService" target="WireServiceComponent"/>
+ <wire source="AnotherWireClient/aWireService" target="WireServiceComponent/WireService"/>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java b/sca-java-1.x/branches/sca-android/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java
new file mode 100644
index 0000000000..95f721cd8e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.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.itest;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This test case will attempt to use a wire
+ */
+public class WireTestCase extends TestCase {
+
+ /**
+ * The SCADomain we are using
+ */
+ private SCADomain domain;
+
+ /**
+ * The client the tests should use
+ */
+ private WireClient aWireClient;
+
+ /**
+ * Run the wire tests
+ */
+ public void testWire() {
+ aWireClient.runTests();
+ }
+
+ /**
+ * Load the Wire composite and look up the client.
+ */
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("WireTest.composite");
+ aWireClient = domain.getService(WireClient.class, "WireClient");
+ Assert.assertNotNull(aWireClient);
+
+ aWireClient = domain.getService(WireClient.class, "AnotherWireClient");
+ Assert.assertNotNull(aWireClient);
+ }
+
+ /**
+ * Shutdown the SCA domain
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/pom.xml b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/pom.xml
new file mode 100644
index 0000000000..673a887758
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/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-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-ws-void-args-return</artifactId>
+ <name>Apache Tuscany SCA Web Services Void Args and Return Test</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/Bean.java b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/Bean.java
new file mode 100644
index 0000000000..43e251369d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/Bean.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 voidtest;
+
+public class Bean {
+
+ private String first;
+ private String last;
+
+ public String getLast() {
+ return last;
+ }
+ public void setLast(String last) {
+ this.last = last;
+ }
+ public String getFirst() {
+ return first;
+ }
+ public void setFirst(String first) {
+ this.first = first;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.java
new file mode 100644
index 0000000000..dc949b5191
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.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 voidtest;
+
+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;
+ }
+
+ public void giveGreetings(String name) {
+ System.out.println("Hello " + name);
+ }
+
+ public void giveGreetingsOneWay(String name) {
+ System.out.println("Hi " + name);
+ }
+
+ public String takeGreetings() {
+ return "Hello Stranger";
+ }
+
+ public void noGreetings() {
+ System.out.println("Hello, who's there?");
+ }
+
+ public Bean getBean(){
+ Bean bean = new Bean();
+ bean.setFirst("wang");
+ bean.setLast("feng");
+ return bean;
+ }
+
+ public Bean getNullBean(){
+ return null;
+ }
+
+ public String getNullString(){
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.java
new file mode 100644
index 0000000000..4777f793e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.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 voidtest;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ String getGreetings(String name);
+
+ void giveGreetings(String name);
+
+ @OneWay
+ void giveGreetingsOneWay(String name);
+
+ String takeGreetings();
+
+ void noGreetings();
+
+ Bean getBean();
+
+ String getNullString();
+
+ Bean getNullBean();
+}
+
diff --git a/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/TestClient.java b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/TestClient.java
new file mode 100644
index 0000000000..d549bccaf0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/TestClient.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 voidtest;
+
+public interface TestClient {
+ void runTest();
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.java b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.java
new file mode 100644
index 0000000000..1cdd094c50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.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 voidtest;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(TestClient.class)
+@Scope("COMPOSITE")
+public class TestClientImpl implements TestClient {
+
+ private HelloWorldService helloService;
+
+ @Reference
+ public void setHelloService(HelloWorldService helloService) {
+ this.helloService = helloService;
+ }
+
+ public void runTest() {
+ assertEquals("Hello Smith", helloService.getGreetings(" Smith"));
+ helloService.giveGreetings("Jones");
+ helloService.giveGreetingsOneWay("Brown");
+ assertEquals("Hello Stranger", helloService.takeGreetings());
+ helloService.noGreetings();
+
+ assertEquals("wang",helloService.getBean().getFirst());
+ assertEquals("feng",helloService.getBean().getLast());
+
+ assertNull(helloService.getNullString());
+
+ assertNull(helloService.getNullBean());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/resources/voidtest.composite b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/resources/voidtest.composite
new file mode 100644
index 0000000000..0f31c4cd2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/main/resources/voidtest.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://voidtest"
+ xmlns:hw="http://voidtest"
+ name="voidtest">
+
+ <component name="TestClientComponent">
+ <implementation.java class="voidtest.TestClientImpl" />
+ <reference name="helloService">
+ <interface.java interface="voidtest.HelloWorldService"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent/HelloWorldService"/>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="voidtest.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.java interface="voidtest.HelloWorldService"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent/HelloWorldService"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.java b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.java
new file mode 100644
index 0000000000..eaaa67c22c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.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 voidtest;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that methods with no args and/or void return type work over Web services
+ */
+public class VoidArgsReturnTestCase {
+
+ private SCADomain scaDomain;
+ private TestClient client;
+
+ @Before
+ public void startServer() throws Exception {
+ scaDomain = SCADomain.newInstance("voidtest.composite");
+ client = scaDomain.getService(TestClient.class, "TestClientComponent");
+ }
+
+ @Test
+ public void testVoidCases() throws Exception {
+ client.runTest();
+ System.out.println("Sleeping...");
+ Thread.sleep(2000);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/pom.xml b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/pom.xml
new file mode 100644
index 0000000000..4d65aaf25c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wsdl-multiple</artifactId>
+ <name>Apache Tuscany SCA Multiple WSDL File Support Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</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.1.1</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-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldCallback.java b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldCallback.java
new file mode 100644
index 0000000000..842ae0a692
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldCallback.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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldCallback {
+
+ public void getGreetingsCallback(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldClientImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldClientImpl.java
new file mode 100644
index 0000000000..d2d898e9c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldClientImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Reference;
+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 HelloWorldClientImpl implements HelloWorldService, HelloWorldCallback {
+
+ @Reference
+ protected HelloWorldService helloWorldService;
+
+ public void getGreetings(String name) {
+ helloWorldService.getGreetings(name);
+ }
+
+ public void getGreetingsCallback(String name) {
+ System.out.println("Callback " + name);
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..d4fbd434fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldService.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 helloworld;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+@Callback(HelloWorldCallback.class)
+public interface HelloWorldService {
+
+ public void getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..a46f763960
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldServiceImpl.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.Callback;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ @Callback
+ protected HelloWorldCallback helloWorldCallback;
+
+ public void getGreetings(String name) {
+ helloWorldCallback.getGreetingsCallback(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/auto-wsdl.composite b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/auto-wsdl.composite
new file mode 100644
index 0000000000..9d9ed57cc7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/auto-wsdl.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:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="autohelloworldws">
+
+ <component name="HelloWorldClientComponent">
+ <implementation.java class="helloworld.HelloWorldClientImpl"/>
+ <reference name="helloWorldService">
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent"/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/HelloWorldClientComponent/helloWorldService"/>
+ </callback>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" callbackInterface="helloworld.HelloWorldCallback"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent"/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/HelloWorldClientComponent/helloWorldService"/>
+ </callback>
+ </service>
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/manual-wsdl.composite b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/manual-wsdl.composite
new file mode 100644
index 0000000000..0c1dc5d353
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/manual-wsdl.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="manualhelloworldws">
+
+ <component name="HelloWorldClientComponent">
+ <implementation.java class="helloworld.HelloWorldClientImpl"/>
+ <reference name="helloWorldService">
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldServiceSOAP11port)"/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/HelloWorldClientComponent/helloWorldService"
+ wsdlElement="http://helloworld#wsdl.binding(HelloWorldCallbackSOAP11Binding)"/>
+ </callback>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" callbackInterface="helloworld.HelloWorldCallback"/>
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldServiceSOAP11port)"/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/HelloWorldClientComponent/helloWorldService"
+ wsdlElement="http://helloworld#wsdl.binding(HelloWorldCallbackSOAP11Binding)"/>
+ </callback>
+ </service>
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldCallback.wsdl b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldCallback.wsdl
new file mode 100644
index 0000000000..ea2f93c3e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldCallback.wsdl
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns="http://helloworld/xsd"
+ xmlns:axis2="http://helloworld">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://helloworld/xsd"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetingsCallback">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param0" nillable="true"
+ type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsCallbackResponse">
+ <xs:complexType/>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getGreetingsCallbackMessage">
+ <wsdl:part name="part1" element="ns:getGreetingsCallback">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsCallbackResponseMessage">
+ <wsdl:part name="part1" element="ns:getGreetingsCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloWorldCallbackPortType">
+ <wsdl:operation name="getGreetingsCallback">
+ <wsdl:input message="axis2:getGreetingsCallbackMessage">
+ </wsdl:input>
+ <wsdl:output message="axis2:getGreetingsCallbackResponseMessage">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloWorldCallbackSOAP11Binding"
+ type="axis2:HelloWorldCallbackPortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetingsCallback">
+ <soap:operation soapAction="urn:getGreetingsCallback"
+ style="document" />
+ <wsdl:input>
+ <soap:body use="literal" namespace="http://helloworld" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="HelloWorldCallbackSOAP12Binding"
+ type="axis2:HelloWorldCallbackPortType">
+ <soap12:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetingsCallback">
+ <soap12:operation soapAction="urn:getGreetingsCallback"
+ style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" namespace="http://helloworld" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloWorldCallback">
+ <wsdl:port name="HelloWorldCallbackSOAP11port"
+ binding="axis2:HelloWorldCallbackSOAP11Binding">
+ <soap:address
+ location="http://localhost:8085/axis2/services/HelloWorldCallback" />
+ </wsdl:port>
+ <wsdl:port name="HelloWorldCallbackSOAP12port"
+ binding="axis2:HelloWorldCallbackSOAP12Binding">
+ <soap12:address
+ location="http://localhost:8085/axis2/services/HelloWorldCallback" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldService.wsdl b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldService.wsdl
new file mode 100644
index 0000000000..1e50e146f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldService.wsdl
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns="http://helloworld/xsd"
+ xmlns:axis2="http://helloworld">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://helloworld/xsd"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param0" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsResponse">
+ <xs:complexType/>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getGreetingsMessage">
+ <wsdl:part name="part1" element="ns:getGreetings"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsResponseMessage">
+ <wsdl:part name="part1" element="ns:getGreetingsResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloWorldServicePortType">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="axis2:getGreetingsMessage">
+ </wsdl:input>
+ <wsdl:output message="axis2:getGreetingsResponseMessage">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloWorldServiceSOAP12Binding"
+ type="axis2:HelloWorldServicePortType">
+ <soap12:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetings">
+ <soap12:operation soapAction="urn:getGreetings"
+ style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" namespace="http://helloworld" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="HelloWorldServiceSOAP11Binding"
+ type="axis2:HelloWorldServicePortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetings">
+ <soap:operation soapAction="urn:getGreetings"
+ style="document" />
+ <wsdl:input>
+ <soap:body use="literal" namespace="http://helloworld" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port name="HelloWorldServiceSOAP11port"
+ binding="axis2:HelloWorldServiceSOAP11Binding">
+ <soap:address
+ location="http://localhost:8085/axis2/services/HelloWorldService" />
+ </wsdl:port>
+ <wsdl:port name="HelloWorldServiceSOAP12port"
+ binding="axis2:HelloWorldServiceSOAP12Binding">
+ <soap12:address
+ location="http://localhost:8085/axis2/services/HelloWorldService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/AutoWSDLTestCase.java b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/AutoWSDLTestCase.java
new file mode 100644
index 0000000000..6a872faa17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/AutoWSDLTestCase.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.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 the behaviour of the system when multiple WSDLs appear in the contribution
+ * with the same namespace
+ */
+public class AutoWSDLTestCase {
+
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Throwable {
+ try {
+ domain = SCADomain.newInstance("auto-wsdl.composite");
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ if ( domain != null){
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testLoadWSDL() {
+ try {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "HelloWorldClientComponent/HelloWorldService");
+ client.getGreetings("petra");
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+ //assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/ManualWSDLTestCase.java b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/ManualWSDLTestCase.java
new file mode 100644
index 0000000000..5852f8d802
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/ManualWSDLTestCase.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.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 the behaviour of the system when multiple WSDLs appear in the contribution
+ * with the same namespace
+ */
+public class ManualWSDLTestCase {
+
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Throwable {
+ try {
+ domain = SCADomain.newInstance("manual-wsdl.composite");
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ if (domain != null){
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testLoadWSDL() {
+ try {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "HelloWorldClientComponent/HelloWorldService");
+ client.getGreetings("petra");
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+ //assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl/pom.xml b/sca-java-1.x/branches/sca-android/itest/wsdl/pom.xml
new file mode 100644
index 0000000000..9c48a604b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wsdl</artifactId>
+ <name>Apache Tuscany SCA WSDL Support Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</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.1.1</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-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..f8c9c28f26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.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 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.AccountSummary;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+@Service(AccountDataService.class)
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int customerID) {
+
+ AccountReport report =AccountFactory.INSTANCE.createAccountReport();
+ AccountSummary summary1 = AccountFactory.INSTANCE.createAccountSummary();
+ summary1.setAccountNumber("123");
+ summary1.setAccountType("checking");
+ summary1.setBalance(1000.0f);
+ report.getAccountSummaries().add(summary1);
+ AccountSummary summary2 = AccountFactory.INSTANCE.createAccountSummary();
+ summary2.setAccountNumber("456");
+ summary2.setAccountType("savings");
+ summary2.setBalance(2000.0f);
+ report.getAccountSummaries().add(summary2);
+
+ return report;
+ }
+
+ 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-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java
new file mode 100644
index 0000000000..f16d20689d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 accountService.getAccountReport(param19);
+ }
+
+ 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-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java
new file mode 100644
index 0000000000..cba6f2ee6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 accountService.getAccountReport(param19);
+ }
+
+ 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-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java
new file mode 100644
index 0000000000..9f15be0236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 accountService.getAccountReport(param19);
+ }
+
+ 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-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java
new file mode 100644
index 0000000000..f174e1af07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 accountService.getAccountReport(param19);
+ }
+
+ 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-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java
new file mode 100644
index 0000000000..4a5b7bceef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 accountService.getAccountReport(param19);
+ }
+
+ 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-android/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..c9076ebba6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/wsdl/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..268d90e910
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/helloworld/HelloWorldService.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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..d706517b76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/wsdl/src/main/resources/SDOWSDLTest.composite b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/SDOWSDLTest.composite
new file mode 100644
index 0000000000..62596ee62a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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:8085/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:8085/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:8085/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:8085/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="http://localhost:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/AccountService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/WSDLTest.composite b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/WSDLTest.composite
new file mode 100644
index 0000000000..2024578dae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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="http://localhost:8085/HelloWorldService1a2a3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3a4b" promote="Component2a3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4a" promote="Component2a3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4b" promote="Component2a3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3b4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4a" promote="Component2b3a4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4b" promote="Component2b3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4a" promote="Component2b3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4b" promote="Component2b3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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="http://localhost:8085/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:8085/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:8085/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:8085/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:8085/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="http://localhost:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/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:8085/HelloWorldService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..73f9ed4bfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl
@@ -0,0 +1,453 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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">
+
+ <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:8085/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/Hello.xsd b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/Hello.xsd
new file mode 100644
index 0000000000..4fc5b10e7c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/Hello.xsd
@@ -0,0 +1,20 @@
+
+ <schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..1966acc957
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl
@@ -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.
+-->
+<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 xmlns="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://helloworld" schemaLocation="Hello.xsd"/>
+ </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-android/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java b/sca-java-1.x/branches/sca-android/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java
new file mode 100644
index 0000000000..12441753fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.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.itest;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import bigbank.account.services.accountdata.AccountDataService;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.AccountSummary;
+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 {
+
+ private static SCADomain domain;
+
+ @Test
+ public void testClient1a2a3a4a() throws RemoteException {
+ doit("Client1a2a3a4a");
+ }
+
+ @Test
+ public void testClient1a2a3a4b() throws RemoteException {
+ doit("Client1a2a3a4b");
+ }
+
+ @Test
+ public void testClient1a2a3b4a() throws RemoteException {
+ doit("Client1a2a3b4a");
+ }
+
+ @Test
+ public void testClient1a2a3b4b() throws RemoteException {
+ doit("Client1a2a3b4b");
+ }
+
+ @Test
+ public void testClient1a2b3a4a() throws RemoteException {
+ doit("Client1a2b3a4a");
+ }
+
+ @Test
+ public void testClient1a2b3a4b() throws RemoteException {
+ doit("Client1a2b3a4b");
+ }
+
+ @Test
+ public void testClient1a2b3b4a() throws RemoteException {
+ doit("Client1a2b3b4a");
+ }
+
+ @Test
+ public void testClient1a2b3b4b() throws RemoteException {
+ doit("Client1a2b3b4b");
+ }
+
+ @Test
+ public void testClient1b2a3a4a() throws RemoteException {
+ doit("Client1b2a3a4a");
+ }
+
+ @Test
+ public void testClient1b2a3a4b() throws RemoteException {
+ doit("Client1b2a3a4b");
+ }
+
+ @Test
+ public void testClient1b2a3b4a() throws RemoteException {
+ doit("Client1b2a3b4a");
+ }
+
+ @Test
+ public void testClient1b2a3b4b() throws RemoteException {
+ doit("Client1b2a3b4b");
+ }
+
+ @Test
+ public void testClient1b2b3a4a() throws RemoteException {
+ doit("Client1b2b3a4a");
+ }
+
+ @Test
+ public void testClient1b2b3a4b() throws RemoteException {
+ doit("Client1b2b3a4b");
+ }
+
+ @Test
+ public void testClient1b2b3b4a() throws RemoteException {
+ doit("Client1b2b3b4a");
+ }
+
+ @Test
+ public void testClient1b2b3b4b() throws RemoteException {
+ 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());
+
+ AccountReport report = client.getAccountReport(12345);
+ AccountSummary summary1 = (AccountSummary)report.getAccountSummaries().get(0);
+ assertEquals(summary1.getAccountType(), "checking");
+ AccountSummary summary2 = (AccountSummary)report.getAccountSummaries().get(1);
+ assertEquals(summary2.getBalance(), 2000.f);
+ }
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ domain = SCADomain.newInstance("SDOWSDLTest.composite");
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java b/sca-java-1.x/branches/sca-android/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-android/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-android/itest/wsdl2java/pom.xml b/sca-java-1.x/branches/sca-android/itest/wsdl2java/pom.xml
new file mode 100644
index 0000000000..4691ce1ace
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl2java/pom.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wsdl2java</artifactId>
+ <name>Apache Tuscany SCA WSDL2Java Integration Tests</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</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.1.1</version>
+ <executions>
+ <execution>
+ <id>generate-sdo-account-service</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>
+ ${basedir}/src/test/resources/AccountService.wsdl</schemaFile>
+ <targetDirectory>
+ ${basedir}/target/sdo-source</targetDirectory>
+ <javaPackage>com.bigbank.account</javaPackage>
+ <prefix>Account</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-sdo-stock-exception</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>
+ ${basedir}/src/test/resources/StockExceptionTest.wsdl</schemaFile>
+ <targetDirectory>
+ ${basedir}/target/sdo-source</targetDirectory>
+ <prefix>Stock</prefix>
+ <noInterfaces>true</noInterfaces>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <!--execution>
+ <id>generate-sdo-echo-service-xsd</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/EchoService.xsd</schemaFile>
+ <targetDirectory>${basedir}/target/sdo-source</targetDirectory>
+ <prefix>Stock</prefix>
+ <noInterfaces>true</noInterfaces>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution-->
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>
+ ${basedir}/src/test/resources/AccountService.wsdl</fileName>
+ </wsdlFile>
+ <wsdlFile>
+ <fileName>
+ ${basedir}/src/test/resources/StockExceptionTest.wsdl</fileName>
+ </wsdlFile>
+ <!--wsdlFile>
+ <fileName>${basedir}/src/test/resources/EchoService.wsdl</fileName>
+ </wsdlFile-->
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/AccountService.wsdl b/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/AccountService.wsdl
new file mode 100644
index 0000000000..9e5650e7dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/AccountService.wsdl
@@ -0,0 +1,479 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="AccountServiceWithFault">
+
+ <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">
+
+ <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>
+ <!-- @start added fault -->
+ <xsd:element name="insufficientFundsFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="message" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <!-- @end added fault -->
+
+ <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>
+
+ <!-- @start added fault -->
+ <wsdl:message name="insufficientFundsException">
+ <wsdl:part element="account:insufficientFundsFault"
+ name="insufficientFundsFault" />
+ </wsdl:message>
+ <!-- @end added fault -->
+
+ <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="AccountServiceWithFault">
+ <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" />
+ <!-- @start added fault -->
+ <wsdl:fault message="account:insufficientFundsException"
+ name="insufficientFundsException" />
+ <!-- @end added fault -->
+ </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="AccountServiceWithFaultSOAP"
+ type="account:AccountServiceWithFault">
+ <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>
+ <!-- @start added fault -->
+ <wsdl:fault name="insufficientFundsException">
+ <soap:fault name="insufficientFundsException" use="literal" />
+ </wsdl:fault>
+ <!-- @end added fault -->
+ </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="AccountServiceWithFault">
+ <wsdl:port binding="account:AccountServiceWithFaultSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/sample-bigbank-account/services/AccountServiceWithFault" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/EchoService.wsdl b/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/EchoService.wsdl
new file mode 100644
index 0000000000..50d580f299
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/EchoService.wsdl
@@ -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.
+-->
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://test/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="EchoService"
+ targetNamespace="http://test/">
+
+ <types>
+ <xsd:schema>
+ <xsd:import namespace="http://test/"
+ schemaLocation="EchoService.xsd" />
+ </xsd:schema>
+ </types>
+ <message name="echo">
+ <part element="tns:echo" name="parameters" />
+ </message>
+ <message name="echoResponse">
+ <part element="tns:echoResponse" name="parameters" />
+ </message>
+ <portType name="Echo">
+ <operation name="echo">
+ <input message="tns:echo" />
+ <output message="tns:echoResponse" />
+ </operation>
+ </portType>
+ <binding name="EchoPortBinding" type="tns:Echo">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="echo">
+ <soap:operation soapAction="" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+ <service name="EchoService">
+ <port binding="tns:EchoPortBinding" name="EchoPort">
+ <soap:address
+ location="http://localhost:8085/w1/EchoService" />
+ </port>
+ </service>
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/EchoService.xsd b/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/EchoService.xsd
new file mode 100644
index 0000000000..8069d4861f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/EchoService.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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://test/"
+ targetNamespace="http://test/" version="1.0">
+
+ <xs:complexType name="echoType">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="echoResponseType">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="echo" type="tns:echoType"/>
+
+ <xs:element name="echoResponse" type="tns:echoResponseType"/>
+
+</xs:schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..c44229c162
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="invalidSymbolException">
+ <wsdl:part element="tns:invalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="marketClosedException">
+ <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:invalidSymbolException"
+ name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:marketClosedException"
+ 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-android/itest/wsdlless/pom.xml b/sca-java-1.x/branches/sca-android/itest/wsdlless/pom.xml
new file mode 100644
index 0000000000..08c84589ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/pom.xml
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wsdlless</artifactId>
+ <name>Apache Tuscany SCA WSDLless Support Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <!--
+ <artifactItem>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.4</version>
+ <type>jar</type>
+ </artifactItem>
+ -->
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <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.1.1</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> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..5886ebc6ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.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 bigbank.account.services.accountdata;
+
+import javax.jws.WebService;
+import javax.xml.ws.ResponseWrapper;
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@AllowsPassByReference
+@WebService(targetNamespace="http://www.bigbank.com/account")
+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);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param4
+ */
+ public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param6*
+ * @param param7
+ */
+ public float deposit(java.lang.String param6, float param7);
+
+ /**
+ * 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);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param13*
+ * @param param14
+ */
+ @ResponseWrapper(localName="purchaseStockResponse")
+ public com.bigbank.account.StockSummary sellStock(int param13, int param14);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param16*
+ * @param param17
+ */
+ public float withdraw(java.lang.String param16, float param17);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param19
+ */
+ public com.bigbank.account.AccountReport getAccountReport(int param19);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ public com.bigbank.account.AccountLog getAccountLog(int param0);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..df658428fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.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 bigbank.account.services.accountdata;
+
+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.AccountSummary;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+@Service(AccountDataService.class)
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CustomerProfileData getCustomerProfile(String logonID) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int customerID) {
+
+ AccountReport report =AccountFactory.INSTANCE.createAccountReport();
+ AccountSummary summary1 = AccountFactory.INSTANCE.createAccountSummary();
+ summary1.setAccountNumber("123");
+ summary1.setAccountType("checking");
+ summary1.setBalance(1000.0f);
+ report.getAccountSummaries().add(summary1);
+ AccountSummary summary2 = AccountFactory.INSTANCE.createAccountSummary();
+ summary2.setAccountNumber("456");
+ summary2.setAccountType("savings");
+ summary2.setBalance(2000.0f);
+ report.getAccountSummaries().add(summary2);
+
+ return report;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
+ {
+ 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) {
+
+ return 0;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary stock) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(final int customerID) {
+ throw new IllegalStateException("This method should not be called");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java
new file mode 100644
index 0000000000..d39df8c00e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java
new file mode 100644
index 0000000000..d4a06780c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java
new file mode 100644
index 0000000000..6dc46c60b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java
new file mode 100644
index 0000000000..8471000152
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java
new file mode 100644
index 0000000000..859c61a724
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/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-android/itest/wsdlless/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-android/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..ca7c25f3fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.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 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;
+ }
+
+ public String[] getMultipleGreetings(String[] names) {
+ if(names==null) {
+ return null;
+ }
+ String[] greetings = new String[names.length];
+ for(int i=0; i<names.length;i++) {
+ greetings[i] = "Hi "+names[i];
+ }
+ return greetings;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..8b234599aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/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;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+ public String[] getMultipleGreetings(String[] names);
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..03984f7252
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.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;
+ }
+
+ public String[] getMultipleGreetings(String[] names) {
+ return helloWorldService.getMultipleGreetings(names);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java
new file mode 100644
index 0000000000..45bb697437
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+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);
+ }
+
+ public String[] getMultipleGreetings(String[] names) {
+ return comp.getMultipleGreetings(names);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java
new file mode 100644
index 0000000000..9342c8e6ee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.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.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);
+ }
+ public String[] getMultipleGreetings(String[] names) {
+ return comp.getMultipleGreetings(names);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java
new file mode 100644
index 0000000000..6c5ac96b67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.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.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);
+ }
+ public String[] getMultipleGreetings(String[] names) {
+ return comp.getMultipleGreetings(names);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java
new file mode 100644
index 0000000000..ebaf33f568
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+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);
+ }
+
+ public String[] getMultipleGreetings(String[] names) {
+ return comp.getMultipleGreetings(names);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/AnObject.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/AnObject.java
new file mode 100644
index 0000000000..65ba52f356
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/AnObject.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 service;
+
+public class AnObject {
+
+ private String someRetValue;
+ private Integer someOtherRetValue;
+
+ public AnObject() {
+ }
+
+ public AnObject(String someRetValue, Integer someOtherRetValue) {
+ this.someRetValue = someRetValue;
+ this.someOtherRetValue = someOtherRetValue;
+ }
+
+ /**
+ * @return the someOtherRetValue
+ */
+ public Integer getSomeOtherRetValue() {
+ return someOtherRetValue;
+ }
+
+ /**
+ * @param someOtherRetValue the someOtherRetValue to set
+ */
+ public void setSomeOtherRetValue(Integer someOtherRetValue) {
+ this.someOtherRetValue = someOtherRetValue;
+ }
+
+ /**
+ * @return the someRetValue
+ */
+ public String getSomeRetValue() {
+ return someRetValue;
+ }
+
+ /**
+ * @param someRetValue the someRetValue to set
+ */
+ public void setSomeRetValue(String someRetValue) {
+ this.someRetValue = someRetValue;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/MoreComplexObject.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/MoreComplexObject.java
new file mode 100644
index 0000000000..69eba6701d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/MoreComplexObject.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 service;
+
+import java.io.Serializable;
+
+public class MoreComplexObject implements Serializable {
+ private static final long serialVersionUID = 43242314234123L;
+ private String stringParam;
+ private Integer intParam;
+ private String stringParam2;
+
+ public String getStringParam() {
+ return stringParam;
+ }
+
+ public void setStringParam(String stringParam) {
+ this.stringParam = stringParam;
+ }
+
+ public Integer getIntParam() {
+ return intParam;
+ }
+
+ public void setIntParam(Integer intParam) {
+ this.intParam = intParam;
+ }
+
+ public String getStringParam2() {
+ return stringParam2;
+ }
+
+ public void setStringParam2(String stringParam2) {
+ this.stringParam2 = stringParam2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/SomeService.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/SomeService.java
new file mode 100644
index 0000000000..f6aaacb23a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/SomeService.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 service;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface SomeService {
+
+ public AnObject getUsingString(String stringParam);
+
+ public AnObject getUsingMoreComplexObject(MoreComplexObject moreComplexParam);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/SomeServiceImpl.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/SomeServiceImpl.java
new file mode 100644
index 0000000000..39a2131024
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/java/service/SomeServiceImpl.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 service;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(SomeService.class)
+public class SomeServiceImpl implements SomeService {
+
+ public AnObject getUsingString(String stringParam) {
+ System.out.println("Param value:" + stringParam);
+
+ return getAnObject(stringParam);
+ }
+
+ private AnObject getAnObject(String stringParam) {
+ return new AnObject(stringParam + "123", 123);
+ }
+
+ public AnObject getUsingMoreComplexObject(MoreComplexObject moreComplexParam) {
+ System.out.println("Param value:" + moreComplexParam.getStringParam());
+
+ return getAnObject(moreComplexParam.getStringParam());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/SDOWSDLTest.composite b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/SDOWSDLTest.composite
new file mode 100644
index 0000000000..16d3806318
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/SDOWSDLTest.composite
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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">
+
+ <service name="AccountService1a2a3a4a" promote="Component2a3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3a4a"/>
+ </service>
+ <service name="AccountService1a2a3a4b" promote="Component2a3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3a4b"/>
+ </service>
+ <service name="AccountService1a2a3b4a" promote="Component2a3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3b4a"/>
+ </service>
+ <service name="AccountService1a2a3b4b" promote="Component2a3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3b4b"/>
+ </service>
+ <service name="AccountService1a2b3a4a" promote="Component2b3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3a4a"/>
+ </service>
+ <service name="AccountService1a2b3a4b" promote="Component2b3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3a4b"/>
+ </service>
+ <service name="AccountService1a2b3b4a" promote="Component2b3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3b4a"/>
+ </service>
+ <service name="AccountService1a2b3b4b" promote="Component2b3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3b4b"/>
+ </service>
+ <service name="AccountService1b2a3a4a" promote="Component2a3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3a4a"/>
+ </service>
+ <service name="AccountService1b2a3a4b" promote="Component2a3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3a4b"/>
+ </service>
+ <service name="AccountService1b2a3b4a" promote="Component2a3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3b4a"/>
+ </service>
+ <service name="AccountService1b2a3b4b" promote="Component2a3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3b4b"/>
+ </service>
+ <service name="AccountService1b2b3a4a" promote="Component2b3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3a4a"/>
+ </service>
+ <service name="AccountService1b2b3a4b" promote="Component2b3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3a4b"/>
+ </service>
+ <service name="AccountService1b2b3b4a" promote="Component2b3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3b4a"/>
+ </service>
+ <service name="AccountService1b2b3b4b" promote="Component2b3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/AccountService" />
+ </reference>
+
+ <!-- target service -->
+
+ <service name="AccountService" promote="AccountServiceComponent">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/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 uri="http://localhost:8085/services/AccountService"/>
+ </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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/AccountService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/WSDLTest.composite b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/WSDLTest.composite
new file mode 100644
index 0000000000..e69cdbc282
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/WSDLTest.composite
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 uri="http://localhost:8085/HelloWorldService1a2a3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3a4b" promote="Component2a3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4a" promote="Component2a3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4b" promote="Component2a3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4a" promote="Component2b3a4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4b" promote="Component2b3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4a" promote="Component2b3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4b" promote="Component2b3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4b"/>
+ </service>
+
+ <service name="HelloWorldService1b2a3a4a" promote="Component2a3a4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4a"/>
+ </service>
+ <service name="HelloWorldService1b2a3a4b" promote="Component2a3a4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4b"/>
+ </service>
+ <service name="HelloWorldService1b2a3b4a" promote="Component2a3b4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4a"/>
+ </service>
+ <service name="HelloWorldService1b2a3b4b" promote="Component2a3b4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4b"/>
+ </service>
+ <service name="HelloWorldService1b2b3a4a" promote="Component2b3a4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4a"/>
+ </service>
+ <service name="HelloWorldService1b2b3a4b" promote="Component2b3a4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4b"/>
+ </service>
+ <service name="HelloWorldService1b2b3b4a" promote="Component2b3b4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3b4a"/>
+ </service>
+ <service name="HelloWorldService1b2b3b4b" promote="Component2b3b4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/HelloWorldWebService" />
+ </reference>
+
+
+<!-- the servive -->
+
+ <service name="HelloWorldWebService" promote="HelloWorldServiceComponent" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/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 uri="http://localhost:8085/HelloWorldService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/some.composite b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/some.composite
new file mode 100644
index 0000000000..1b099239d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/some.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://test" xmlns:test="http://test"
+ name="some">
+ <service name="SomeServices" promote="SomeServicesComponent">
+ <binding.ws uri="http://localhost:8085/SomeServices" />
+ </service>
+
+ <component name="SomeServicesComponent">
+ <implementation.java class="service.SomeServiceImpl" />
+ <service name="SomeService">
+ <interface.java interface="service.SomeService" />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..73f9ed4bfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl
@@ -0,0 +1,453 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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">
+
+ <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:8085/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..bc6fe0e89a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://helloworld"
+ xmlns:tns="http://helloworld"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://helloworld"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn"
+ type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getMultipleGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"
+ maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getMultipleGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn"
+ type="xsd:string" maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="getMultipleGreetingsRequest">
+ <wsdl:part element="tns:getMultipleGreetings" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="getMultipleGreetingsResponse">
+ <wsdl:part element="tns:getMultipleGreetingsResponse"
+ 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:operation name="getMultipleGreetings">
+ <wsdl:input message="tns:getMultipleGreetingsRequest"
+ name="getMultipleGreetingsRequest" />
+ <wsdl:output message="tns:getMultipleGreetingsResponse"
+ name="getMultipleGreetingsResponse" />
+ </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:operation name="getMultipleGreetings">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="getMultipleGreetingsRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="getMultipleGreetingsResponse">
+ <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-android/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java
new file mode 100644
index 0000000000..33f541b21b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.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.itest;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import bigbank.account.services.accountdata.AccountDataService;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.AccountSummary;
+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 {
+
+ private static SCADomain domain;
+
+ @Test
+ public void testClient1a2a3a4a() throws RemoteException {
+ doit("Client1a2a3a4a");
+ }
+
+ @Test
+ public void testClient1a2a3a4b() throws RemoteException {
+ doit("Client1a2a3a4b");
+ }
+
+ @Test
+ public void testClient1a2a3b4a() throws RemoteException {
+ doit("Client1a2a3b4a");
+ }
+
+ @Test
+ public void testClient1a2a3b4b() throws RemoteException {
+ doit("Client1a2a3b4b");
+ }
+
+ @Test
+ public void testClient1a2b3a4a() throws RemoteException {
+ doit("Client1a2b3a4a");
+ }
+
+ @Test
+ public void testClient1a2b3a4b() throws RemoteException {
+ doit("Client1a2b3a4b");
+ }
+
+ @Test
+ public void testClient1a2b3b4a() throws RemoteException {
+ doit("Client1a2b3b4a");
+ }
+
+ @Test
+ public void testClient1a2b3b4b() throws RemoteException {
+ doit("Client1a2b3b4b");
+ }
+
+ @Test
+ public void testClient1b2a3a4a() throws RemoteException {
+ doit("Client1b2a3a4a");
+ }
+
+ @Test
+ public void testClient1b2a3a4b() throws RemoteException {
+ doit("Client1b2a3a4b");
+ }
+
+ @Test
+ public void testClient1b2a3b4a() throws RemoteException {
+ doit("Client1b2a3b4a");
+ }
+
+ @Test
+ public void testClient1b2a3b4b() throws RemoteException {
+ doit("Client1b2a3b4b");
+ }
+
+ @Test
+ public void testClient1b2b3a4a() throws RemoteException {
+ doit("Client1b2b3a4a");
+ }
+
+ @Test
+ public void testClient1b2b3a4b() throws RemoteException {
+ doit("Client1b2b3a4b");
+ }
+
+ @Test
+ public void testClient1b2b3b4a() throws RemoteException {
+ doit("Client1b2b3b4a");
+ }
+
+ @Test
+ public void testClient1b2b3b4b() throws RemoteException {
+ 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());
+
+ AccountReport report = client.getAccountReport(12345);
+ AccountSummary summary1 = (AccountSummary)report.getAccountSummaries().get(0);
+ assertEquals(summary1.getAccountType(), "checking");
+ AccountSummary summary2 = (AccountSummary)report.getAccountSummaries().get(1);
+ assertEquals(summary2.getBalance(), 2000.f);
+ }
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("SDOWSDLTest.composite");
+ }catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java
new file mode 100644
index 0000000000..82bf7ce650
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.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.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"));
+ String[] greetings = client.getMultipleGreetings(new String[] {"John", "Smith"});
+ assertEquals(2, greetings.length);
+ assertEquals("Hi John", greetings[0]);
+ assertEquals("Hi Smith", greetings[1]);
+ }
+
+ @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-android/itest/wsdlless/src/test/java/service/SomeComponentTestCase.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/SomeComponentTestCase.java
new file mode 100644
index 0000000000..7c62287c57
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/SomeComponentTestCase.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 service;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import service.generated.SomeServiceService;
+
+/**
+ * @author pxk3
+ *
+ */
+public class SomeComponentTestCase {
+ private static SCADomain scaDomain;
+ private static SomeService someService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("some.composite");
+ someService = scaDomain.getService(SomeService.class, "SomeServicesComponent");
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ @Test
+ public void testGetUsingMoreComplexObject() throws Exception {
+ String stringParam = "ABC";
+ URL url = new URL("http://localhost:8085/SomeServices?wsdl");
+ QName serviceQName = new QName("http://service/", "SomeServiceService");
+ SomeServiceService service = new SomeServiceService(url, serviceQName);
+ service.generated.SomeService proxy = service.getSomeServicePort();
+ service.generated.AnObject obj = proxy.getUsingString(stringParam);
+ assertEquals(stringParam + "123", obj.getSomeRetValue());
+
+ service.generated.MoreComplexObject obj2 = new service.generated.MoreComplexObject();
+ obj2.setStringParam(stringParam);
+ obj2.setStringParam2("2");
+ obj2.setIntParam(new Integer(0));
+
+ obj = proxy.getUsingMoreComplexObject(obj2);
+ assertEquals(stringParam + "123", obj.getSomeRetValue());
+ }
+
+ @Test
+ public void testLocal() {
+ String stringParam = "1234";
+ MoreComplexObject moreComplexParam = new MoreComplexObject();
+ moreComplexParam.setStringParam(stringParam);
+
+ AnObject anObject = someService.getUsingMoreComplexObject(moreComplexParam);
+
+ assertEquals(stringParam + "123", anObject.getSomeRetValue());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/AnObject.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/AnObject.java
new file mode 100644
index 0000000000..effeb3c701
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/AnObject.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 service.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>Java class for anObject complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="anObject">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="someOtherRetValue" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="someRetValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "anObject", namespace = "", propOrder = {"someOtherRetValue", "someRetValue"})
+public class AnObject {
+
+ protected Integer someOtherRetValue;
+ protected String someRetValue;
+
+ /**
+ * Gets the value of the someOtherRetValue property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getSomeOtherRetValue() {
+ return someOtherRetValue;
+ }
+
+ /**
+ * Sets the value of the someOtherRetValue property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setSomeOtherRetValue(Integer value) {
+ this.someOtherRetValue = value;
+ }
+
+ /**
+ * Gets the value of the someRetValue property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSomeRetValue() {
+ return someRetValue;
+ }
+
+ /**
+ * Sets the value of the someRetValue property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSomeRetValue(String value) {
+ this.someRetValue = value;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingMoreComplexObject.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingMoreComplexObject.java
new file mode 100644
index 0000000000..284e961788
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingMoreComplexObject.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 service.generated;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="arg0" type="{}moreComplexObject" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {"arg0"})
+@XmlRootElement(name = "getUsingMoreComplexObject", namespace = "http://service/")
+public class GetUsingMoreComplexObject {
+
+ @XmlElementRef(name = "arg0", type = JAXBElement.class)
+ protected JAXBElement<MoreComplexObject> arg0;
+
+ /**
+ * Gets the value of the arg0 property.
+ *
+ * @return
+ * possible object is
+ * {@link JAXBElement }{@code <}{@link MoreComplexObject }{@code >}
+ *
+ */
+ public JAXBElement<MoreComplexObject> getArg0() {
+ return arg0;
+ }
+
+ /**
+ * Sets the value of the arg0 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JAXBElement }{@code <}{@link MoreComplexObject }{@code >}
+ *
+ */
+ public void setArg0(JAXBElement<MoreComplexObject> value) {
+ this.arg0 = ((JAXBElement<MoreComplexObject>)value);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingMoreComplexObjectResponse.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingMoreComplexObjectResponse.java
new file mode 100644
index 0000000000..4113aa1a0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingMoreComplexObjectResponse.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 service.generated;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="return" type="{}anObject" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {"_return"})
+@XmlRootElement(name = "getUsingMoreComplexObjectResponse", namespace = "http://service/")
+public class GetUsingMoreComplexObjectResponse {
+
+ @XmlElementRef(name = "return", type = JAXBElement.class)
+ protected JAXBElement<AnObject> _return;
+
+ /**
+ * Gets the value of the return property.
+ *
+ * @return
+ * possible object is
+ * {@link JAXBElement }{@code <}{@link AnObject }{@code >}
+ *
+ */
+ public JAXBElement<AnObject> getReturn() {
+ return _return;
+ }
+
+ /**
+ * Sets the value of the return property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JAXBElement }{@code <}{@link AnObject }{@code >}
+ *
+ */
+ public void setReturn(JAXBElement<AnObject> value) {
+ this._return = ((JAXBElement<AnObject>)value);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingString.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingString.java
new file mode 100644
index 0000000000..532b948b47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingString.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 service.generated;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="arg0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {"arg0"})
+@XmlRootElement(name = "getUsingString", namespace = "http://service/")
+public class GetUsingString {
+
+ @XmlElementRef(name = "arg0", type = JAXBElement.class)
+ protected JAXBElement<String> arg0;
+
+ /**
+ * Gets the value of the arg0 property.
+ *
+ * @return
+ * possible object is
+ * {@link JAXBElement }{@code <}{@link String }{@code >}
+ *
+ */
+ public JAXBElement<String> getArg0() {
+ return arg0;
+ }
+
+ /**
+ * Sets the value of the arg0 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JAXBElement }{@code <}{@link String }{@code >}
+ *
+ */
+ public void setArg0(JAXBElement<String> value) {
+ this.arg0 = ((JAXBElement<String>)value);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingStringResponse.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingStringResponse.java
new file mode 100644
index 0000000000..82bfb2d2aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/GetUsingStringResponse.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 service.generated;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="return" type="{}anObject" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {"_return"})
+@XmlRootElement(name = "getUsingStringResponse", namespace = "http://service/")
+public class GetUsingStringResponse {
+
+ @XmlElementRef(name = "return", type = JAXBElement.class)
+ protected JAXBElement<AnObject> _return;
+
+ /**
+ * Gets the value of the return property.
+ *
+ * @return
+ * possible object is
+ * {@link JAXBElement }{@code <}{@link AnObject }{@code >}
+ *
+ */
+ public JAXBElement<AnObject> getReturn() {
+ return _return;
+ }
+
+ /**
+ * Sets the value of the return property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JAXBElement }{@code <}{@link AnObject }{@code >}
+ *
+ */
+ public void setReturn(JAXBElement<AnObject> value) {
+ this._return = ((JAXBElement<AnObject>)value);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/MoreComplexObject.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/MoreComplexObject.java
new file mode 100644
index 0000000000..61c7c6cb19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/MoreComplexObject.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 service.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>Java class for moreComplexObject complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="moreComplexObject">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="intParam" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="stringParam" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="stringParam2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "moreComplexObject", namespace = "", propOrder = {"intParam", "stringParam", "stringParam2"})
+public class MoreComplexObject {
+
+ protected Integer intParam;
+ protected String stringParam;
+ protected String stringParam2;
+
+ /**
+ * Gets the value of the intParam property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getIntParam() {
+ return intParam;
+ }
+
+ /**
+ * Sets the value of the intParam property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setIntParam(Integer value) {
+ this.intParam = value;
+ }
+
+ /**
+ * Gets the value of the stringParam property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStringParam() {
+ return stringParam;
+ }
+
+ /**
+ * Sets the value of the stringParam property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStringParam(String value) {
+ this.stringParam = value;
+ }
+
+ /**
+ * Gets the value of the stringParam2 property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStringParam2() {
+ return stringParam2;
+ }
+
+ /**
+ * Sets the value of the stringParam2 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStringParam2(String value) {
+ this.stringParam2 = value;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/ObjectFactory.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/ObjectFactory.java
new file mode 100644
index 0000000000..1ba0c497d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/ObjectFactory.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package service.generated;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the service.jaxws package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _GetUsingMoreComplexObjectArg0_QNAME = new QName("", "arg0");
+ private final static QName _GetUsingStringResponseReturn_QNAME = new QName("", "return");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: service.jaxws
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link AnObject }
+ *
+ */
+ public AnObject createAnObject() {
+ return new AnObject();
+ }
+
+ /**
+ * Create an instance of {@link GetUsingStringResponse }
+ *
+ */
+ public GetUsingStringResponse createGetUsingStringResponse() {
+ return new GetUsingStringResponse();
+ }
+
+ /**
+ * Create an instance of {@link GetUsingMoreComplexObjectResponse }
+ *
+ */
+ public GetUsingMoreComplexObjectResponse createGetUsingMoreComplexObjectResponse() {
+ return new GetUsingMoreComplexObjectResponse();
+ }
+
+ /**
+ * Create an instance of {@link GetUsingString }
+ *
+ */
+ public GetUsingString createGetUsingString() {
+ return new GetUsingString();
+ }
+
+ /**
+ * Create an instance of {@link GetUsingMoreComplexObject }
+ *
+ */
+ public GetUsingMoreComplexObject createGetUsingMoreComplexObject() {
+ return new GetUsingMoreComplexObject();
+ }
+
+ /**
+ * Create an instance of {@link MoreComplexObject }
+ *
+ */
+ public MoreComplexObject createMoreComplexObject() {
+ return new MoreComplexObject();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link MoreComplexObject }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "arg0", scope = GetUsingMoreComplexObject.class)
+ public JAXBElement<MoreComplexObject> createGetUsingMoreComplexObjectArg0(MoreComplexObject value) {
+ return new JAXBElement<MoreComplexObject>(_GetUsingMoreComplexObjectArg0_QNAME, MoreComplexObject.class,
+ GetUsingMoreComplexObject.class, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link AnObject }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "return", scope = GetUsingStringResponse.class)
+ public JAXBElement<AnObject> createGetUsingStringResponseReturn(AnObject value) {
+ return new JAXBElement<AnObject>(_GetUsingStringResponseReturn_QNAME, AnObject.class,
+ GetUsingStringResponse.class, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link AnObject }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "return", scope = GetUsingMoreComplexObjectResponse.class)
+ public JAXBElement<AnObject> createGetUsingMoreComplexObjectResponseReturn(AnObject value) {
+ return new JAXBElement<AnObject>(_GetUsingStringResponseReturn_QNAME, AnObject.class,
+ GetUsingMoreComplexObjectResponse.class, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "arg0", scope = GetUsingString.class)
+ public JAXBElement<String> createGetUsingStringArg0(String value) {
+ return new JAXBElement<String>(_GetUsingMoreComplexObjectArg0_QNAME, String.class, GetUsingString.class, value);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/SomeService.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/SomeService.java
new file mode 100644
index 0000000000..4a584a8da2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/SomeService.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 service.generated;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.1 in JDK 6
+ * Generated source version: 2.1
+ *
+ */
+@WebService(name = "SomeService", targetNamespace = "http://service/")
+@XmlSeeAlso( {ObjectFactory.class})
+public interface SomeService {
+
+ /**
+ *
+ * @param arg0
+ * @return
+ * returns service.generated.AnObject
+ */
+ @WebMethod
+ @WebResult(targetNamespace = "")
+ @RequestWrapper(localName = "getUsingMoreComplexObject", targetNamespace = "http://service/", className = "service.generated.GetUsingMoreComplexObject")
+ @ResponseWrapper(localName = "getUsingMoreComplexObjectResponse", targetNamespace = "http://service/", className = "service.generated.GetUsingMoreComplexObjectResponse")
+ public AnObject getUsingMoreComplexObject(@WebParam(name = "arg0", targetNamespace = "")
+ MoreComplexObject arg0);
+
+ /**
+ *
+ * @param arg0
+ * @return
+ * returns service.generated.AnObject
+ */
+ @WebMethod
+ @WebResult(targetNamespace = "")
+ @RequestWrapper(localName = "getUsingString", targetNamespace = "http://service/", className = "service.generated.GetUsingString")
+ @ResponseWrapper(localName = "getUsingStringResponse", targetNamespace = "http://service/", className = "service.generated.GetUsingStringResponse")
+ public AnObject getUsingString(@WebParam(name = "arg0", targetNamespace = "")
+ String arg0);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/SomeServiceService.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/SomeServiceService.java
new file mode 100644
index 0000000000..44c2b67256
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/SomeServiceService.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 service.generated;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceFeature;
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.1 in JDK 6
+ * Generated source version: 2.1
+ *
+ */
+@WebServiceClient(name = "SomeServiceService", targetNamespace = "http://service/", wsdlLocation = "file:/C:/Tuscany/java/sca/itest/wsdlless/src/main/resources/some.wsdl")
+public class SomeServiceService extends Service {
+
+ private final static URL SOMESERVICESERVICE_WSDL_LOCATION;
+
+ static {
+ URL url = null;
+ try {
+ url = new URL("file:/C:/Tuscany/java/sca/itest/wsdlless/src/main/resources/some.wsdl");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ SOMESERVICESERVICE_WSDL_LOCATION = url;
+ }
+
+ public SomeServiceService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public SomeServiceService() {
+ super(SOMESERVICESERVICE_WSDL_LOCATION, new QName("http://service/", "SomeServiceService"));
+ }
+
+ /**
+ *
+ * @return
+ * returns SomeService
+ */
+ @WebEndpoint(name = "SomeServicePort")
+ public SomeService getSomeServicePort() {
+ return (SomeService)super.getPort(new QName("http://service/", "SomeServicePort"), SomeService.class);
+ }
+
+ /**
+ *
+ * @param features
+ * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
+ * @return
+ * returns SomeService
+ */
+ @WebEndpoint(name = "SomeServicePort")
+ public SomeService getSomeServicePort(WebServiceFeature... features) {
+ return (SomeService)super.getPort(new QName("http://service/", "SomeServicePort"), SomeService.class, features);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/package-info.java b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/package-info.java
new file mode 100644
index 0000000000..d7b3fef82e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/itest/wsdlless/src/test/java/service/generated/package-info.java
@@ -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.
+ */
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://service/")
+package service.generated;
+
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/LICENSE b/sca-java-1.x/branches/sca-android/modules/assembly-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/assembly-xml/META-INF/README b/sca-java-1.x/branches/sca-android/modules/assembly-xml/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/NOTICE b/sca-java-1.x/branches/sca-android/modules/assembly-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/assembly-xml/pom.xml b/sca-java-1.x/branches/sca-android/modules/assembly-xml/pom.xml
new file mode 100644
index 0000000000..cd439d3216
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/pom.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <name>Apache Tuscany SCA XML Assembly Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0-2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml-ws</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.assembly.xml</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.assembly.xml*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
new file mode 100644
index 0000000000..06b208540a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
@@ -0,0 +1,905 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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 java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.dom.DOMSource;
+
+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.Base;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+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.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
+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.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
+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;
+
+/**
+ * A base class with utility methods for the other artifact processors in this module.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implements Constants {
+
+ protected ContributionFactory contributionFactory;
+ protected AssemblyFactory assemblyFactory;
+ protected PolicyFactory policyFactory;
+ protected StAXArtifactProcessor<Object> extensionProcessor;
+ protected PolicyAttachPointProcessor policyProcessor;
+ private DocumentBuilderFactory documentBuilderFactory;
+ protected IntentAttachPointTypeFactory intentAttachPointTypeFactory;
+ private Monitor monitor;
+
+ /**
+ * Constructs a new BaseArtifactProcessor.
+ * @param contribFactory
+ * @param factory
+ * @param policyFactory
+ */
+ @SuppressWarnings("unchecked")
+ public BaseAssemblyProcessor(ContributionFactory contribFactory,
+ AssemblyFactory factory,
+ PolicyFactory policyFactory,
+ StAXArtifactProcessor extensionProcessor,
+ Monitor monitor) {
+ this.assemblyFactory = factory;
+ this.policyFactory = policyFactory;
+ this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
+ this.contributionFactory = contribFactory;
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.intentAttachPointTypeFactory = new IntentAttachPointTypeFactoryImpl();
+ this.monitor = monitor;
+ }
+
+ /**
+ * Constructs a new BaseArtifactProcessor.
+ * @param factory
+ * @param policyFactory
+ */
+ @SuppressWarnings("unchecked")
+ public BaseAssemblyProcessor(AssemblyFactory factory,
+ PolicyFactory policyFactory,
+ StAXArtifactProcessor extensionProcessor,
+ Monitor monitor) {
+ this.assemblyFactory = factory;
+ this.policyFactory = policyFactory;
+ this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.monitor = monitor;
+
+ //TODO - this constructor should take a monitor too.
+ }
+
+ /**
+ * Marshals warnings into the monitor
+ *
+ * @param message
+ * @param model
+ * @param messageParameters
+ */
+ protected void warning(String message, Object model, String... messageParameters) {
+ if (monitor != null){
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-xml-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Marshals errors into the monitor
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ protected void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Marshals exceptions into the monitor
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ protected void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-xml-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Start an element.
+ * @param writer
+ * @param name
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStart(XMLStreamWriter writer, String name, XAttr... attrs) throws XMLStreamException {
+ writeStart(writer, SCA10_NS, name, attrs);
+ }
+
+ /**
+ * 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, SCA10_NS, name, attrs);
+ writer.writeDefaultNamespace(SCA10_NS);
+ }
+
+ /**
+ * Read list of reference targets
+ * @param reference
+ * @param reader
+ */
+ protected void readTargets(Reference reference, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, 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);
+ }
+ }
+ }
+
+ /**
+ * Write a list of targets into an attribute
+ * @param reference
+ * @return
+ */
+ protected XAttr writeTargets(Reference reference) {
+ List<String> targets = new ArrayList<String>();
+ for (Service target : reference.getTargets()) {
+ targets.add(target.getName());
+ }
+ return new XAttr(TARGET, targets);
+ }
+
+ /**
+ * 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 readConstrainingType(XMLStreamReader reader) {
+ QName constrainingTypeName = getQName(reader, Constants.CONSTRAINING_TYPE);
+ if (constrainingTypeName != null) {
+ ConstrainingType constrainingType = assemblyFactory.createConstrainingType();
+ constrainingType.setName(constrainingTypeName);
+ constrainingType.setUnresolved(true);
+ return constrainingType;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Reads an abstract property element.
+ * @param property
+ * @param reader
+ * @throws XMLStreamException
+ * @throws ContributionReadException
+ */
+ protected void readAbstractProperty(AbstractProperty property, XMLStreamReader reader) throws XMLStreamException,
+ ContributionReadException {
+
+ property.setName(getString(reader, NAME));
+ property.setMany(getBoolean(reader, MANY));
+ property.setMustSupply(getBoolean(reader, MUST_SUPPLY));
+ property.setXSDElement(getQName(reader, ELEMENT));
+ property.setXSDType(getQName(reader, TYPE));
+ }
+
+ /**
+ * Resolve an implementation.
+ * @param implementation
+ * @param resolver
+ * @return
+ * @throws ContributionResolveException
+ */
+ protected Implementation resolveImplementation(Implementation implementation, ModelResolver resolver)
+ throws ContributionResolveException, PolicyValidationException {
+ 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()) {
+ //resolve policies
+ if ( implementation instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
+ resolveIntents(policiedImpl.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(policiedImpl, policiedImpl.getType());
+
+ resolvePolicySets(policiedImpl.getPolicySets(), resolver);
+ PolicyValidationUtils.validatePolicySets(policiedImpl);
+
+ if ( implementation instanceof OperationsConfigurator ) {
+ OperationsConfigurator opsConfigurator = (OperationsConfigurator)implementation;
+ for ( ConfiguredOperation implOp : opsConfigurator.getConfiguredOperations() ) {
+ resolveIntents(implOp.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(implOp, policiedImpl.getType());
+
+ resolvePolicySets(implOp.getPolicySets(), resolver);
+ PolicyValidationUtils.validatePolicySets(implOp,
+ policiedImpl.getType(),
+ policiedImpl.getApplicablePolicySets());
+ }
+ }
+
+ for ( Service service : implementation.getServices() ) {
+ resolveIntents(service.getRequiredIntents(), resolver);
+ resolvePolicySets(service.getPolicySets(), resolver);
+
+ for ( ConfiguredOperation svcOp : service.getConfiguredOperations() ) {
+ resolveIntents(svcOp.getRequiredIntents(), resolver);
+ resolvePolicySets(svcOp.getPolicySets(), resolver);
+ }
+ }
+
+ for ( Reference reference : implementation.getReferences() ) {
+ resolveIntents(reference.getRequiredIntents(), resolver);
+ resolvePolicySets(reference.getPolicySets(), resolver);
+ }
+ }
+
+ resolver.addModel(implementation);
+ }
+ }
+ }
+
+ if ( implementation instanceof IntentAttachPoint &&
+ ((IntentAttachPoint)implementation).getType() != null &&
+ ((IntentAttachPoint)implementation).getType().isUnresolved() ) {
+ ((IntentAttachPoint)implementation).setType(
+ resolver.resolveModel(IntentAttachPointType.class,
+ ((IntentAttachPoint)implementation).getType()));
+ }
+ }
+ 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 {
+ resolveContracts(null, contracts, resolver);
+ }
+
+
+ /**
+ * Resolve interface, callback interface and bindings on a list of contracts.
+ * @param parent element for the contracts
+ * @param contracts the list of contracts
+ * @param resolver the resolver to use to resolve models
+ */
+ protected <C extends Contract> void resolveContracts(Base parent, List<C> contracts, ModelResolver resolver)
+ throws ContributionResolveException {
+
+ String parentName = (parent instanceof Composite) ? ((Composite)parent).getName().toString() :
+ (parent instanceof Component) ? ((Component)parent).getName() : "UNKNOWN";
+
+ for (Contract contract : contracts) {
+ try {
+ //resolve the intents and policysets as they need to be copied over into the
+ //child binding elements
+ resolveIntents(contract.getRequiredIntents(), resolver);
+ resolvePolicySets(contract.getPolicySets(), resolver);
+ resolvePolicySets(contract.getApplicablePolicySets(), resolver);
+
+ // Inherit the composite / component level applicable policy sets.
+ if ( parent != null && parent instanceof PolicySetAttachPoint ) {
+ addInheritedPolicySets(((PolicySetAttachPoint)parent).getApplicablePolicySets(), contract.getApplicablePolicySets());
+ }
+
+ for ( ConfiguredOperation confOp : contract.getConfiguredOperations() ) {
+ resolveIntents(confOp.getRequiredIntents(), resolver);
+ resolvePolicySets(confOp.getPolicySets(), resolver);
+ resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
+
+ //inherit applicable policy sets from parent contract
+ addInheritedPolicySets(contract.getApplicablePolicySets(), confOp.getApplicablePolicySets());
+ }
+
+ // 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);
+
+ if (binding instanceof IntentAttachPoint) {
+ IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
+
+ if ( policiedBinding.getType() != null && policiedBinding.getType().isUnresolved() ) {
+ IntentAttachPointType resolved =
+ resolver.resolveModel(IntentAttachPointType.class,
+ policiedBinding.getType());
+ policiedBinding.setType(resolved);
+ }
+
+ resolveIntents(policiedBinding.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(policiedBinding, policiedBinding.getType());
+ }
+
+ if (binding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
+ resolvePolicySets(policiedBinding.getPolicySets(), resolver);
+ //validate if attached policysets apply to the binding
+ resolvePolicySets(policiedBinding.getApplicablePolicySets(), resolver);
+ //inherit the applicable policysets from parent contract as whatever applies to that
+ //applies to the binding as well
+ addInheritedPolicySets(contract.getApplicablePolicySets(), policiedBinding.getApplicablePolicySets());
+ PolicyValidationUtils.validatePolicySets(policiedBinding);
+ }
+
+ if (binding instanceof OperationsConfigurator) {
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
+ for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
+ resolveIntents(confOp.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(confOp, ((PolicySetAttachPoint)binding).getType());
+
+ resolvePolicySets(confOp.getPolicySets(), resolver);
+ resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
+ //inherit the applicable policysets from parent binding as whatever applies to that
+ //applies to the binding as well
+ addInheritedPolicySets(((PolicySetAttachPoint)binding).getApplicablePolicySets(),
+ confOp.getApplicablePolicySets());
+ PolicyValidationUtils.validatePolicySets(confOp, ((PolicySetAttachPoint)binding).getType());
+ }
+ }
+ }
+
+ // Resolve callback bindings
+ if (contract.getCallback() != null) {
+ resolveIntents(contract.getCallback().getRequiredIntents(), resolver);
+ resolvePolicySets(contract.getCallback().getPolicySets(), resolver);
+ resolvePolicySets(contract.getCallback().getApplicablePolicySets(), resolver);
+ //inherit the contract's policy intents and policysets
+ addInheritedPolicySets(contract.getApplicablePolicySets(), contract.getCallback().getApplicablePolicySets());
+
+ for (int i = 0, n = contract.getCallback().getBindings().size(); i < n; i++) {
+ Binding binding = contract.getCallback().getBindings().get(i);
+ extensionProcessor.resolve(binding, resolver);
+
+ if (binding instanceof IntentAttachPoint) {
+ IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
+
+ if ( policiedBinding.getType().isUnresolved() ) {
+ IntentAttachPointType resolved =
+ resolver.resolveModel(IntentAttachPointType.class,
+ policiedBinding.getType());
+ policiedBinding.setType(resolved);
+ }
+
+ resolveIntents(policiedBinding.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(policiedBinding, policiedBinding.getType());
+ }
+
+ if (binding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
+ resolvePolicySets(policiedBinding.getPolicySets(), resolver);
+ //validate if attached policysets apply to the binding
+ resolvePolicySets(policiedBinding.getApplicablePolicySets(), resolver);
+ //inherit the applicable policysets from parent contract as whatever applies to that
+ //applies to the binding as well
+ addInheritedPolicySets(contract.getApplicablePolicySets(), policiedBinding.getApplicablePolicySets());
+ PolicyValidationUtils.validatePolicySets(policiedBinding);
+ }
+
+ if (binding instanceof OperationsConfigurator) {
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
+ for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
+ resolveIntents(confOp.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(confOp, ((PolicySetAttachPoint)binding).getType());
+
+ resolvePolicySets(confOp.getPolicySets(), resolver);
+ resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
+ //inherit the applicable policysets from parent binding as whatever applies to that
+ //applies to the binding as well
+ addInheritedPolicySets(((PolicySetAttachPoint)binding).getApplicablePolicySets(),
+ confOp.getApplicablePolicySets());
+ PolicyValidationUtils.validatePolicySets(confOp, ((PolicySetAttachPoint)binding).getType());
+ }
+ }
+ }
+ }
+ } catch ( PolicyValidationException e ) {
+ error("PolicyServiceValidationException", contract, contract.getName(), parentName, e.getMessage());
+ //throw new ContributionResolveException("PolicyValidation exceptions when processing service/reference '"
+ //+ contract.getName() + "' in '" + parentName + "'");
+ }
+ }
+ }
+
+ /**
+ * 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);
+ }
+ }
+ }
+
+ /**
+ * Returns a constrainingType attribute.
+ * @param componentType
+ * @return
+ */
+ protected XAttr writeConstrainingType(ComponentType componentType) {
+ ConstrainingType constrainingType = componentType.getConstrainingType();
+ if (constrainingType != null)
+ return new XAttr(Constants.CONSTRAINING_TYPE, constrainingType.getName());
+ else
+ return null;
+ }
+
+ /**
+ * Read a property value into a DOM document.
+ * @param element
+ * @param type
+ * @param reader
+ * @return
+ * @throws XMLStreamException
+ * @throws ContributionReadException
+ * @throws ParserConfigurationException
+ */
+ protected Document readPropertyValue(QName element, QName type, XMLStreamReader reader) throws XMLStreamException,
+ ContributionReadException {
+
+ Document document;
+ try {
+ if (documentBuilderFactory == null) {
+ documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ documentBuilderFactory.setNamespaceAware(true);
+ }
+ document = documentBuilderFactory.newDocumentBuilder().newDocument();
+ } catch (ParserConfigurationException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", documentBuilderFactory, ce);
+ throw ce;
+ }
+
+ // root element has no namespace and local name "value"
+ Element root = document.createElementNS(null, "value");
+ if (type != null) {
+ org.w3c.dom.Attr xsi = document.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 = document.createAttributeNS(W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type");
+ xsiType.setValue(prefix + ":" + type.getLocalPart());
+ root.setAttributeNodeNS(xsiType);
+ }
+ document.appendChild(root);
+
+ loadElement(reader, root);
+ return document;
+ }
+
+ /**
+ * 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) {
+ if (ns == null) {
+ ns = "";
+ }
+ if (prefix == null) {
+ prefix = "";
+ }
+ 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;
+
+ 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);
+ }
+
+ if (!"".equals(name.getNamespaceURI())) {
+ declareNamespace(child, name.getPrefix(), name.getNamespaceURI());
+ }
+
+ // 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 qname = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+ if (prefix != null && prefix.length() != 0) {
+ qname = prefix + ":" + qname;
+ }
+ child.setAttributeNS(ns, qname, value);
+ if (ns != null) {
+ 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();
+ }
+ }
+ }
+
+ /**
+ * Resolve policy intents attached to a specific SCA Artifact
+ * @param policyIntents list of policy intents
+ * @param resolver
+ */
+ protected void resolveIntents(List<Intent> policyIntents, ModelResolver resolver) {
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ Intent resolvedIntent = null;
+ for (Intent intent : policyIntents) {
+ resolvedIntent = resolver.resolveModel(Intent.class, intent);
+ requiredIntents.add(resolvedIntent);
+ }
+ policyIntents.clear();
+ policyIntents.addAll(requiredIntents);
+ }
+
+ /**
+ * Resolve policy sets attached to a specific SCA Construct
+ * @param policySets list of attached policy sets
+ * @param resolver
+ */
+ protected void resolvePolicySets(List<PolicySet> policySets, ModelResolver resolver) {
+ List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
+ PolicySet resolvedPolicySet = null;
+ for (PolicySet policySet : policySets) {
+ if (policySet.isUnresolved()) {
+ resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
+ resolvedPolicySets.add(resolvedPolicySet);
+ } else {
+ resolvedPolicySets.add(policySet);
+ }
+ }
+ policySets.clear();
+ policySets.addAll(resolvedPolicySets);
+ }
+
+ /**
+ * Write the value of a property
+ * @param document
+ * @param element
+ * @param type
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writePropertyValue(Object propertyValue, QName element, QName type, XMLStreamWriter writer)
+ throws XMLStreamException {
+
+ if (propertyValue instanceof Document) {
+ Document document = (Document)propertyValue;
+ NodeList nodeList = document.getDocumentElement().getChildNodes();
+
+ for (int item = 0; item < nodeList.getLength(); ++item) {
+ Node node = nodeList.item(item);
+ int nodeType = node.getNodeType();
+ if (nodeType == Node.ELEMENT_NODE) {
+ XMLStreamReader reader =
+ XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(node));
+
+ while (reader.hasNext()) {
+ switch (reader.next()) {
+ case XMLStreamConstants.START_ELEMENT:
+ QName name = reader.getName();
+ writer.writeStartElement(name.getPrefix(), name.getLocalPart(), name.getNamespaceURI());
+
+ int namespaces = reader.getNamespaceCount();
+ for (int i = 0; i < namespaces; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String ns = reader.getNamespaceURI(i);
+ writer.writeNamespace(prefix, ns);
+ }
+
+ if (!"".equals(name.getNamespaceURI())) {
+ writer.writeNamespace(name.getPrefix(), name.getNamespaceURI());
+ }
+
+ // add the attributes for this element
+ namespaces = reader.getAttributeCount();
+ for (int i = 0; i < namespaces; i++) {
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+
+ writer.writeAttribute(prefix, ns, qname, value);
+ }
+
+ break;
+ case XMLStreamConstants.CDATA:
+ writer.writeCData(reader.getText());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ writer.writeCharacters(reader.getText());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ writer.writeEndElement();
+ break;
+ }
+ }
+ } else {
+ writer.writeCharacters(node.getTextContent());
+ }
+ }
+ }
+ }
+
+ protected void addInheritedIntents(List<Intent> sourceList, List<Intent> targetList) {
+ if (sourceList != null) {
+ targetList.addAll(sourceList);
+ }
+ }
+
+ protected void addInheritedPolicySets(List<PolicySet> sourceList, List<PolicySet> targetList) {
+ if (sourceList != null) {
+ targetList.addAll(sourceList);
+ }
+ }
+
+ /**
+ *
+ * @param reader
+ * @param elementName
+ * @param estensibleElement
+ * @param extensionAttributeProcessor
+ * @throws ContributionReadException
+ * @throws XMLStreamException
+ */
+ protected void readExtendedAttributes(XMLStreamReader reader, QName elementName, Extensible estensibleElement, StAXAttributeProcessor extensionAttributeProcessor) throws ContributionReadException, XMLStreamException {
+ for (int a = 0; a < reader.getAttributeCount(); a++) {
+ QName attributeName = reader.getAttributeName(a);
+ if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
+ if( ! elementName.getNamespaceURI().equals(attributeName.getNamespaceURI()) ) {
+ String attributeExtension = (String) extensionAttributeProcessor.read(attributeName, reader);
+ estensibleElement.getExtensions().add(attributeExtension);
+ }
+ }
+ }
+ }
+
+
+ /**
+ *
+ * @param attributeModel
+ * @param writer
+ * @param extensibleElement
+ * @param extensionAttributeProcessor
+ * @throws ContributionWriteException
+ * @throws XMLStreamException
+ */
+ protected void writeExtendedAttributes(XMLStreamWriter writer, Extensible extensibleElement, StAXAttributeProcessor extensionAttributeProcessor) throws ContributionWriteException, XMLStreamException {
+ for(Object o : extensibleElement.getExtensions()) {
+ //FIXME How to identify it's a extended attribute ?
+ if(o instanceof String) {
+ extensionAttributeProcessor.write(o, writer);
+ }
+ }
+ }
+
+ /*protected void validatePolicySets(PolicySetAttachPoint policySetAttachPoint)
+ throws ContributionResolveException {
+ validatePolicySets(policySetAttachPoint, policySetAttachPoint.getApplicablePolicySets());
+ }
+
+
+ protected void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
+ List<PolicySet> applicablePolicySets) throws ContributionResolveException {
+ //Since the applicablePolicySets in a policySetAttachPoint will already have the
+ //list of policysets that might ever be applicable to this attachPoint, just check
+ //if the defined policysets feature in the list of applicable policysets
+ IntentAttachPointType attachPointType = policySetAttachPoint.getType();
+ for ( PolicySet definedPolicySet : policySetAttachPoint.getPolicySets() ) {
+ if ( !definedPolicySet.isUnresolved() ) {
+ if ( !applicablePolicySets.contains(definedPolicySet)) {
+ throw new ContributionResolveException("Policy Set '" + definedPolicySet.getName()
+ + "' does not apply to binding type "
+ + attachPointType.getName());
+ }
+ } else {
+ throw new ContributionResolveException("Policy Set '" + definedPolicySet.getName()
+ + "' is not defined in this domain ");
+
+
+ }
+ }
+ }*/
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
new file mode 100644
index 0000000000..b07c91d1b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.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.sca.assembly.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+
+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.monitor.Monitor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
+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 BaseAssemblyProcessor implements URLArtifactProcessor<ComponentType> {
+ private XMLInputFactory inputFactory;
+
+ /**
+ * Constructs a new componentType processor.
+ * @param factory
+ * @param policyFactory
+ * @param registry
+ */
+ public ComponentTypeDocumentProcessor(StAXArtifactProcessor staxProcessor,
+ XMLInputFactory inputFactory,
+ Monitor monitor) {
+ super(null, null, staxProcessor, monitor);
+ this.inputFactory = inputFactory;
+ }
+
+ /**
+ * Constructs a new componentType processor.
+ * @param modelFactories
+ * @param staxProcessor
+ */
+ public ComponentTypeDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor staxProcessor,
+ Monitor monitor) {
+ super(null, null, staxProcessor, monitor);
+ this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
+ }
+
+ public ComponentType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+
+ // Create a stream reader
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ urlStream = connection.getInputStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+ reader.nextTag();
+
+ // Reader the componentType model
+ ComponentType componentType = (ComponentType)extensionProcessor.read(reader);
+ if (componentType != null) {
+ componentType.setURI(uri.toString());
+ }
+
+ // For debugging purposes, write it back to XML
+// if (componentType != null) {
+// try {
+// ByteArrayOutputStream bos = new ByteArrayOutputStream();
+// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+// extensionProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
+// Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
+// OutputFormat format = new OutputFormat();
+// format.setIndenting(true);
+// format.setIndent(2);
+// XMLSerializer serializer = new XMLSerializer(System.out, format);
+// serializer.serialize(document);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+
+ return componentType;
+
+ } catch (XMLStreamException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", inputFactory, ce);
+ throw ce;
+ } catch (IOException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", inputFactory, ce);
+ throw ce;
+ } 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-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java
new file mode 100644
index 0000000000..d0d11cd02b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.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.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for ComponentType models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeModelResolver implements ModelResolver {
+ private Contribution contribution;
+ private Map<String, ComponentType> map = new HashMap<String, ComponentType>();
+
+ public ComponentTypeModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ }
+
+ public void addModel(Object resolved) {
+ ComponentType componentType = (ComponentType)resolved;
+ map.put(componentType.getURI(), componentType);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((ComponentType)resolved).getURI());
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ //get componentType artifact URI
+ String uri = ((ComponentType)unresolved).getURI();
+ if (uri == null) {
+ return (T)unresolved;
+ }
+
+ //lookup the componentType
+ ComponentType resolved = (ComponentType) map.get(uri);
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+
+ //If not found, delegate the resolution to the imports (in this case based on the java imports)
+ //compute the package name from the componentType URI
+ if (unresolved instanceof ComponentType) {
+ //FIXME The core assembly model now depends on java imports to
+ // resolve componentTypes of all kinds, this is not right at all!!!
+ int s = uri.lastIndexOf('/');
+ if (s != -1) {
+ String packageName = uri.substring(0, uri.lastIndexOf("/"));
+ for (Import import_ : this.contribution.getImports()) {
+ if (import_ instanceof JavaImport) {
+ JavaImport javaImport = (JavaImport)import_;
+ //check the import location against the computed package name from the componentType URI
+ if (javaImport.getPackage().equals(packageName)) {
+ // Delegate the resolution to the import resolver
+ resolved = javaImport.getModelResolver().resolveModel(ComponentType.class, (ComponentType)unresolved);
+ if (!resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return (T)unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
new file mode 100644
index 0000000000..9727b89aab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.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.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.AssemblyFactory;
+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.Extensible;
+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.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
+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.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.w3c.dom.Document;
+
+/**
+ * A componentType processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<ComponentType> {
+
+ /**
+ * Constructs a new componentType processor.
+ * @param factory
+ * @param policyFactory
+ * @param registry
+ */
+ public ComponentTypeProcessor(AssemblyFactory factory, PolicyFactory policyFactory,
+ StAXArtifactProcessor extensionProcessor, StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor) {
+ super(factory, policyFactory, extensionProcessor, monitor);
+ }
+
+ /**
+ * Constructs a new componentType processor.
+ *
+ * @param modelFactories
+ * @param extensionProcessor
+ */
+ public ComponentTypeProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor extensionProcessor,
+ StAXAttributeProcessor extensionAttributeProcessor,
+ Monitor monitor) {
+ super(modelFactories.getFactory(AssemblyFactory.class),
+ modelFactories.getFactory(PolicyFactory.class), extensionProcessor, monitor);
+ }
+
+ public ComponentType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ComponentType componentType = null;
+ Service service = null;
+ Reference reference = null;
+ Contract contract = null;
+ Property property = null;
+ Callback callback = null;
+ QName name = null;
+
+ // 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(readConstrainingType(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);
+ policyProcessor.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);
+ policyProcessor.readPolicies(reference, reader);
+
+ } else if (Constants.PROPERTY_QNAME.equals(name)) {
+
+ // Read a <property>
+ property = assemblyFactory.createProperty();
+ readAbstractProperty(property, reader);
+ policyProcessor.readPolicies(property, reader);
+
+ // Read the property value
+ Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
+ property.setValue(value);
+
+ componentType.getProperties().add(property);
+
+ } else if (Constants.IMPLEMENTATION_QNAME.equals(name)) {
+
+ // Read an <implementation> element
+ policyProcessor.readPolicies(componentType, reader);
+
+ } else if (Constants.CALLBACK_QNAME.equals(name)) {
+
+ // Read a <callback>
+ callback = assemblyFactory.createCallback();
+ contract.setCallback(callback);
+ policyProcessor.readPolicies(callback, reader);
+
+ } else if (OPERATION_QNAME.equals(name)) {
+
+ // Read an <operation>
+ Operation operation = new OperationImpl();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ if (callback != null) {
+ policyProcessor.readPolicies(callback, operation, reader);
+ } else {
+ policyProcessor.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>
+ if (callback != null) {
+ callback.getBindings().add((Binding)extension);
+ } else {
+ contract.getBindings().add((Binding)extension);
+ }
+ } else {
+
+ // Add the extension element to the current element
+ if (callback != null) {
+ callback.getExtensions().add(extension);
+ } else if (contract != null) {
+ contract.getExtensions().add(extension);
+ } else if (property != null) {
+ property.getExtensions().add(extension);
+ } else {
+ if (componentType instanceof Extensible) {
+ ((Extensible)componentType).getExtensions().add(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();
+ }
+ }
+ return componentType;
+ }
+
+ public void write(ComponentType componentType, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <componentType> element
+ writeStartDocument(writer, COMPONENT_TYPE,
+ writeConstrainingType(componentType));
+
+ // Write <service> elements
+ for (Service service : componentType.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
+ policyProcessor.writePolicies(service));
+
+ if (service.getInterfaceContract() != null) {
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+ }
+
+ for (Binding binding: service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (service.getCallback() != null) {
+ Callback callback = service.getCallback();
+ writeStart(writer, CALLBACK, policyProcessor.writePolicies(callback));
+
+ for (Binding binding: callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+ for (Object extension: callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ for (Object extension: service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (Reference reference : componentType.getReferences()) {
+
+ writeStart(writer, REFERENCE,
+ new XAttr(NAME, reference.getName()),
+ writeTargets(reference),
+ policyProcessor.writePolicies(reference));
+
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ for (Binding binding: reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (reference.getCallback() != null) {
+ Callback callback = reference.getCallback();
+ writeStart(writer, CALLBACK,
+ policyProcessor.writePolicies(callback));
+
+ for (Binding binding: callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+ for (Object extension: callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ for (Object extension: reference.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (Property property : componentType.getProperties()) {
+ writeStart(writer,
+ PROPERTY,
+ new XAttr(NAME, property.getName()),
+ new XAttr(MUST_SUPPLY, property.isMustSupply()),
+ new XAttr(MANY, property.isMany()),
+ new XAttr(TYPE, property.getXSDType()),
+ new XAttr(ELEMENT, property.getXSDElement()),
+ policyProcessor.writePolicies(property));
+
+ // Write property value
+ writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : property.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extension elements
+ if (componentType instanceof Extensible) {
+ for (Object extension: ((Extensible)componentType).getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+ }
+
+ // Write <implementation> elements if the componentType has
+ // any intents or policySets
+ boolean writeImplementation = false;
+ if (componentType instanceof IntentAttachPoint) {
+ if (!((IntentAttachPoint)componentType).getRequiredIntents().isEmpty()) {
+ writeImplementation = true;
+ }
+ }
+ if (componentType instanceof PolicySetAttachPoint) {
+ if (!((PolicySetAttachPoint)componentType).getPolicySets().isEmpty()) {
+ writeImplementation = true;
+ }
+ }
+ if (writeImplementation) {
+ writeStart(writer, IMPLEMENTATION,
+ policyProcessor.writePolicies(componentType));
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(ComponentType componentType, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve component type services and references
+ resolveContracts(componentType.getServices(), resolver);
+ resolveContracts(componentType.getReferences(), resolver);
+ if ( componentType instanceof PolicySetAttachPoint ) {
+ resolveIntents(((PolicySetAttachPoint)componentType).getRequiredIntents(), resolver);
+ resolvePolicySets(((PolicySetAttachPoint)componentType).getPolicySets(), resolver);
+ }
+ }
+
+ public QName getArtifactType() {
+ return COMPONENT_TYPE_QNAME;
+ }
+
+ public Class<ComponentType> getModelType() {
+ return ComponentType.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
new file mode 100644
index 0000000000..bc74773d85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.assembly.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+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.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
+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.definitions.SCADefinitions;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
+
+/**
+ * A composite processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<Composite> {
+ private XMLInputFactory inputFactory;
+ private DocumentBuilderFactory documentBuilderFactory;
+ private List scaDefnSink;
+ private Collection<PolicySet> domainPolicySets = null;
+ private int scaDefnsCount = 0;
+
+ /**
+ * Construct a new composite processor
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ @Deprecated
+ public CompositeDocumentProcessor(StAXArtifactProcessor staxProcessor,
+ XMLInputFactory inputFactory,
+ List scaDefnsSink, Monitor monitor) {
+ super(null, null, staxProcessor, monitor);
+ this.inputFactory = inputFactory;
+ this.scaDefnSink = scaDefnsSink;
+ }
+
+ /**
+ * Construct a new composite processor
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ public CompositeDocumentProcessor(StAXArtifactProcessor staxProcessor,
+ XMLInputFactory inputFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ List scaDefnsSink, Monitor monitor) {
+ super(null, null, staxProcessor, monitor);
+ this.documentBuilderFactory = documentBuilderFactory;
+ this.inputFactory = inputFactory;
+ this.scaDefnSink = scaDefnsSink;
+ }
+
+ /**
+ * Constructs a new composite processor.
+ * @param modelFactories
+ * @param staxProcessor
+ */
+ public CompositeDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor staxProcessor, Monitor monitor) {
+ super(null, null, staxProcessor, monitor);
+ this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
+ this.documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
+ }
+
+ public Composite read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream scdlStream = null;
+ try {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ scdlStream = connection.getInputStream();
+ } catch (IOException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", url, ce);
+ throw ce;
+ }
+ return read(uri, scdlStream);
+ }
+
+ public Composite read(URI uri, InputStream scdlStream) throws ContributionReadException {
+ try {
+ if (scaDefnSink != null ) {
+ fillDomainPolicySets(scaDefnSink);
+ }
+
+ Composite composite = null;
+
+ byte[] transformedArtifactContent;
+ try {
+ if ( domainPolicySets != null ) {
+ transformedArtifactContent =
+ PolicyComputationUtils.addApplicablePolicySets(scdlStream, domainPolicySets, documentBuilderFactory);
+ scdlStream = new ByteArrayInputStream(transformedArtifactContent);
+ }
+ } catch ( IOException e ) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", scdlStream, ce);
+ throw ce;
+ } catch ( Exception e ) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", scdlStream, ce);
+ //throw ce;
+ }
+
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(scdlStream);
+
+ reader.nextTag();
+
+ // Read the composite model
+ composite = (Composite)extensionProcessor.read(reader);
+ if (composite != null) {
+ composite.setURI(uri.toString());
+ }
+
+ // For debugging purposes, write it back to XML
+// if (composite != null) {
+// try {
+// ByteArrayOutputStream bos = new ByteArrayOutputStream();
+// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+// extensionProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
+// Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
+// OutputFormat format = new OutputFormat();
+// format.setIndenting(true);
+// format.setIndent(2);
+// XMLSerializer serializer = new XMLSerializer(System.out, format);
+// serializer.serialize(document);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+
+ return composite;
+
+ } catch (XMLStreamException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", inputFactory, ce);
+ throw ce;
+ } finally {
+ try {
+ if (scdlStream != null) {
+ scdlStream.close();
+ scdlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(Composite composite, ModelResolver resolver) throws ContributionResolveException {
+ if (composite != null)
+ extensionProcessor.resolve(composite, resolver);
+ }
+
+ public String getArtifactType() {
+ return ".composite";
+ }
+
+ public Class<Composite> getModelType() {
+ return Composite.class;
+ }
+
+ private void fillDomainPolicySets(List scaDefnsSink) {
+ Map<QName, PolicySet> domainPolicySetMap = null;
+ if ( scaDefnsSink.size() > scaDefnsCount ) {
+ //if ( !scaDefnsSink.isEmpty() ) {
+ domainPolicySetMap = new Hashtable<QName, PolicySet>();
+
+ if ( domainPolicySets != null ) {
+ for ( PolicySet policySet : domainPolicySets ) {
+ domainPolicySetMap.put(policySet.getName(), policySet);
+ }
+ }
+
+ for ( Object object : scaDefnsSink ) {
+ if ( object instanceof SCADefinitions ) {
+ for ( PolicySet policySet : ((SCADefinitions)object).getPolicySets() ) {
+ domainPolicySetMap.put( policySet.getName(), policySet);
+ }
+ }
+ }
+ domainPolicySets = domainPolicySetMap.values();
+ //scaDefnsSink.clear();
+ scaDefnsCount = scaDefnsSink.size();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java
new file mode 100644
index 0000000000..72744259f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.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.assembly.xml;
+
+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.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for Composite models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeModelResolver implements ModelResolver {
+
+ private Contribution contribution;
+ private Map<QName, Composite> map = new HashMap<QName, Composite>();
+
+ public CompositeModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ }
+
+ public void addModel(Object resolved) {
+ Composite composite = (Composite)resolved;
+ map.put(composite.getName(), composite);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((Composite)resolved).getName());
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ // Lookup a definition for the given namespace
+ QName qname = ((Composite)unresolved).getName();
+ Composite resolved = (Composite) map.get(qname);
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+
+ // No definition found, delegate the resolution to the imports
+ for (Import import_ : this.contribution.getImports()) {
+ if (import_ instanceof NamespaceImport) {
+ NamespaceImport namespaceImport = (NamespaceImport)import_;
+ if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
+
+ // Delegate the resolution to the import resolver
+ resolved = namespaceImport.getModelResolver().resolveModel(Composite.class, (Composite)unresolved);
+ if (!resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ return (T)unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
new file mode 100644
index 0000000000..09ec7664ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
@@ -0,0 +1,1219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.Iterator;
+import java.util.List;
+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 javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+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.ConfiguredOperation;
+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.OperationsConfigurator;
+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.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
+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.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
+import org.w3c.dom.Document;
+
+/**
+ * A composite processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<Composite> {
+ // FIXME: to be refactored
+ private XPathFactory xPathFactory = XPathFactory.newInstance();
+
+ protected StAXAttributeProcessor<Object> extensionAttributeProcessor;
+
+ /**
+ * Construct a new composite processor
+ *
+ * @param extensionPoints
+ * @param extensionProcessor
+ */
+ public CompositeProcessor(ExtensionPointRegistry extensionPoints,
+ StAXArtifactProcessor extensionProcessor,
+ StAXAttributeProcessor extensionAttributeProcessor,
+ Monitor monitor) {
+
+ this(modelFactories(extensionPoints),
+ extensionProcessor,
+ extensionAttributeProcessor,
+ monitor(extensionPoints));
+
+ this.extensionAttributeProcessor = extensionAttributeProcessor;
+ }
+
+ /**
+ * Constructs a new composite processor
+ *
+ * @param modelFactories
+ * @param extensionProcessor
+ * @param monitor
+ */
+ private CompositeProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor extensionProcessor,
+ StAXAttributeProcessor extensionAttributeProcessor,
+ Monitor monitor) {
+
+ super(modelFactories.getFactory(ContributionFactory.class),
+ modelFactories.getFactory(AssemblyFactory.class),
+ modelFactories.getFactory(PolicyFactory.class),
+ extensionProcessor,
+ monitor);
+
+ this.extensionAttributeProcessor = extensionAttributeProcessor;
+
+ }
+
+ /**
+ * Construct a new composite processor
+ *
+ * @param contributionFactory
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param extensionProcessor
+ */
+ public CompositeProcessor(ContributionFactory contributionFactory,
+ AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ StAXArtifactProcessor extensionProcessor,
+ StAXAttributeProcessor extensionAttributeProcessor,
+ Monitor monitor) {
+ super(contributionFactory, assemblyFactory, policyFactory, extensionProcessor, monitor);
+ }
+
+ public Composite read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ 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;
+
+ // 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)));
+
+ if(!isSet(reader, TARGET_NAMESPACE)){
+ // spec says that a composite must have a namespace
+ warning("NoCompositeNamespace", composite, composite.getName().toString());
+ }
+
+ if(isSet(reader, AUTOWIRE)) {
+ composite.setAutowire(getBoolean(reader, AUTOWIRE));
+ }
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, composite, extensionAttributeProcessor);
+
+ composite.setLocal(getBoolean(reader, LOCAL));
+ composite.setConstrainingType(readConstrainingType(reader));
+ policyProcessor.readPolicies(composite, reader);
+
+ } else if (INCLUDE_QNAME.equals(name)) {
+
+ // Read an <include>
+ include = assemblyFactory.createComposite();
+ include.setName(getQName(reader, NAME));
+ include.setURI(getString(reader, URI));
+ 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));
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, componentService, extensionAttributeProcessor);
+
+ component.getServices().add(componentService);
+ policyProcessor.readPolicies(contract, reader);
+ } else {
+
+ // Read a <composite><service>
+ compositeService = assemblyFactory.createCompositeService();
+ contract = compositeService;
+ compositeService.setName(getString(reader, NAME));
+
+ String promoted = getString(reader, PROMOTE);
+ if (promoted != null) {
+ String promotedComponentName;
+ String promotedServiceName;
+ int s = promoted.indexOf('/');
+ if (s == -1) {
+ promotedComponentName = promoted;
+ promotedServiceName = null;
+ } else {
+ promotedComponentName = promoted.substring(0, s);
+ promotedServiceName = promoted.substring(s + 1);
+ }
+
+ Component promotedComponent = assemblyFactory.createComponent();
+ promotedComponent.setUnresolved(true);
+ promotedComponent.setName(promotedComponentName);
+ compositeService.setPromotedComponent(promotedComponent);
+
+ ComponentService promotedService = assemblyFactory.createComponentService();
+ promotedService.setUnresolved(true);
+ promotedService.setName(promotedServiceName);
+ compositeService.setPromotedService(promotedService);
+ }
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, compositeService, extensionAttributeProcessor);
+
+ composite.getServices().add(compositeService);
+ policyProcessor.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);
+ if (isSet(reader, AUTOWIRE)) {
+ componentReference.setAutowire(getBoolean(reader, AUTOWIRE));
+ }
+ readTargets(componentReference, reader);
+ componentReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, componentReference, extensionAttributeProcessor);
+
+ component.getReferences().add(componentReference);
+ policyProcessor.readPolicies(contract, reader);
+ } else {
+ // Read a <composite><reference>
+ compositeReference = assemblyFactory.createCompositeReference();
+ contract = compositeReference;
+ compositeReference.setName(getString(reader, NAME));
+ readMultiplicity(compositeReference, reader);
+ readTargets(compositeReference, reader);
+ String promote = reader.getAttributeValue(null, Constants.PROMOTE);
+ if (promote != null) {
+ for (StringTokenizer tokens = new StringTokenizer(promote); tokens.hasMoreTokens();) {
+ ComponentReference promotedReference =
+ assemblyFactory.createComponentReference();
+ promotedReference.setUnresolved(true);
+ promotedReference.setName(tokens.nextToken());
+ compositeReference.getPromotedReferences().add(promotedReference);
+ }
+ }
+ compositeReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, compositeReference, extensionAttributeProcessor);
+
+ composite.getReferences().add(compositeReference);
+ policyProcessor.readPolicies(contract, reader);
+ }
+
+ } else if (PROPERTY_QNAME.equals(name)) {
+ if (component != null) {
+
+ // Read a <component><property>
+ componentProperty = assemblyFactory.createComponentProperty();
+ property = componentProperty;
+ String source = getString(reader, SOURCE);
+ if(source!=null) {
+ source = source.trim();
+ }
+ componentProperty.setSource(source);
+ if (source != null) {
+ // $<name>/...
+ if (source.charAt(0) == '$') {
+ int index = source.indexOf('/');
+ if (index == -1) {
+ // Tolerating $prop
+ source = source + "/";
+ index = source.length() - 1;
+ }
+ source = source.substring(index + 1);
+ if ("".equals(source)) {
+ source = ".";
+ }
+ }
+ XPath xpath = xPathFactory.newXPath();
+ xpath.setNamespaceContext(reader.getNamespaceContext());
+ try {
+ componentProperty.setSourceXPathExpression(xpath.compile(source));
+ } catch (XPathExpressionException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", xpath, ce);
+ //throw ce;
+ }
+ }
+ componentProperty.setFile(getString(reader, FILE));
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, componentProperty, extensionAttributeProcessor);
+
+ policyProcessor.readPolicies(property, reader);
+ readAbstractProperty(componentProperty, reader);
+
+ // Read the property value
+ Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
+ property.setValue(value);
+
+ component.getProperties().add(componentProperty);
+ } else {
+
+ // Read a <composite><property>
+ property = assemblyFactory.createProperty();
+ policyProcessor.readPolicies(property, reader);
+ readAbstractProperty(property, reader);
+
+ // Read the property value
+ Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
+ property.setValue(value);
+
+ composite.getProperties().add(property);
+ }
+
+ // TUSCANY-1949
+ // If the property doesn't have a value, the END_ELEMENT event is read by the readPropertyValue
+ if (reader.getEventType() == END_ELEMENT && PROPERTY_QNAME.equals(reader.getName())) {
+ property = null;
+ componentProperty = null;
+ }
+
+ } else if (COMPONENT_QNAME.equals(name)) {
+
+ // Read a <component>
+ component = assemblyFactory.createComponent();
+ component.setName(getString(reader, NAME));
+ if (isSet(reader, AUTOWIRE)) {
+ component.setAutowire(getBoolean(reader, AUTOWIRE));
+ }
+ if (isSet(reader, URI)) {
+ component.setURI(getString(reader, URI));
+ }
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, component, extensionAttributeProcessor);
+
+ component.setConstrainingType(readConstrainingType(reader));
+ composite.getComponents().add(component);
+ policyProcessor.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);
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, wire, extensionAttributeProcessor);
+
+ composite.getWires().add(wire);
+ policyProcessor.readPolicies(wire, reader);
+
+ } else if (CALLBACK_QNAME.equals(name)) {
+
+ // Read a <callback>
+ callback = assemblyFactory.createCallback();
+ contract.setCallback(callback);
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, callback, extensionAttributeProcessor);
+
+ policyProcessor.readPolicies(callback, reader);
+
+ } else if (OPERATION_QNAME.equals(name)) {
+
+ // Read an <operation>
+ ConfiguredOperation operation = assemblyFactory.createConfiguredOperation();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ if (callback != null) {
+ policyProcessor.readPolicies(operation, reader);
+ } else {
+ policyProcessor.readPolicies(operation, reader);
+ }
+
+ OperationsConfigurator opConfigurator = null;
+ if ( compositeService != null ) {
+ opConfigurator = compositeService;
+ } else if ( componentService != null ) {
+ opConfigurator = componentService;
+ } else if ( compositeReference != null ) {
+ opConfigurator = compositeReference;
+ } else if ( componentReference != null ) {
+ opConfigurator = componentReference;
+ }
+
+ opConfigurator.getConfiguredOperations().add(operation);
+ } else if (IMPLEMENTATION_COMPOSITE_QNAME.equals(name)) {
+
+ // Read an implementation.composite
+ Composite implementation = assemblyFactory.createComposite();
+ implementation.setName(getQName(reader, NAME));
+ implementation.setUnresolved(true);
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, implementation, extensionAttributeProcessor);
+
+ component.setImplementation(implementation);
+ policyProcessor.readPolicies(implementation, reader);
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null) {
+ if (extension instanceof InterfaceContract) {
+
+ // <service><interface> and
+ // <reference><interface>
+ if (contract != null) {
+ contract.setInterfaceContract((InterfaceContract)extension);
+ } else {
+ if (name.getNamespaceURI().equals(SCA10_NS)) {
+ error("UnexpectedInterfaceElement", extension);
+ //throw new ContributionReadException("Unexpected <interface> element found. It should appear inside a <service> or <reference> element");
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ } else if (extension instanceof Binding) {
+ if ( extension instanceof PolicySetAttachPoint ) {
+ IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
+ bindingType.setName(name);
+ bindingType.setUnresolved(true);
+ ((PolicySetAttachPoint)extension).setType(bindingType);
+ }
+ // <service><binding> and
+ // <reference><binding>
+ if (callback != null) {
+ callback.getBindings().add((Binding)extension);
+ } else {
+ if (contract != null) {
+ contract.getBindings().add((Binding)extension);
+ } else {
+ if (name.getNamespaceURI().equals(SCA10_NS)) {
+ error("UnexpectedBindingElement", extension);
+ //throw new ContributionReadException("Unexpected <binding> element found. It should appear inside a <service> or <reference> element");
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ }
+
+ } else if (extension instanceof Implementation) {
+ if ( extension instanceof PolicySetAttachPoint ) {
+ IntentAttachPointType implType = intentAttachPointTypeFactory.createImplementationType();
+ implType.setName(name);
+ implType.setUnresolved(true);
+ ((PolicySetAttachPoint)extension).setType(implType);
+ }
+ // <component><implementation>
+ if (component != null) {
+ component.setImplementation((Implementation)extension);
+ } else {
+ if (name.getNamespaceURI().equals(SCA10_NS)) {
+ error("UnexpectedImplementationElement", extension);
+ //throw new ContributionReadException("Unexpected <implementation> element found. It should appear inside a <component> element");
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ } else {
+
+ // Add the extension element to the current
+ // element
+ if (callback != null) {
+ callback.getExtensions().add(extension);
+ } else if (contract != null) {
+ contract.getExtensions().add(extension);
+ } else if (property != null) {
+ property.getExtensions().add(extension);
+ } else if (component != null) {
+ component.getExtensions().add(extension);
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ }
+ }
+ break;
+
+ case XMLStreamConstants.CHARACTERS:
+ 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;
+ }
+
+ public void write(Composite composite, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <composite> element
+ writeStartDocument(writer,
+ COMPOSITE,
+ writeConstrainingType(composite),
+ new XAttr(TARGET_NAMESPACE, composite.getName().getNamespaceURI()),
+ new XAttr(NAME, composite.getName().getLocalPart()),
+ new XAttr(AUTOWIRE, composite.getAutowire()),
+ policyProcessor.writePolicies(composite));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, composite, extensionAttributeProcessor);
+
+ // Write <include> elements
+ for (Composite include : composite.getIncludes()) {
+ String uri = include.isUnresolved()? include.getURI() : null;
+ writeStart(writer,
+ INCLUDE,
+ new XAttr(NAME, include.getName()),
+ new XAttr(URI, uri));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, include, extensionAttributeProcessor);
+
+ writeEnd(writer);
+ }
+
+ // Write <service> elements
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ Component promotedComponent = compositeService.getPromotedComponent();
+ ComponentService promotedService = compositeService.getPromotedService();
+ String promote;
+ if (promotedService != null) {
+ if (promotedService.getName() != null) {
+ promote = promotedComponent.getName() + '/' + promotedService.getName();
+ } else {
+ promote = promotedComponent.getName();
+ }
+ } else {
+ promote = null;
+ }
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()), new XAttr(PROMOTE, promote),
+ policyProcessor.writePolicies(service));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, service, extensionAttributeProcessor);
+
+
+ // Write service interface
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write <callback> element
+ if (service.getCallback() != null) {
+ Callback callback = service.getCallback();
+ writeStart(writer, CALLBACK,
+ policyProcessor.writePolicies(callback));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, callback, extensionAttributeProcessor);
+
+ // Write callback bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extension : callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extension : service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <component> elements
+ for (Component component : composite.getComponents()) {
+ writeStart(writer, COMPONENT, new XAttr(NAME, component.getName()),
+ new XAttr(URI, component.getURI()),
+ new XAttr(AUTOWIRE, component.getAutowire()),
+ policyProcessor.writePolicies(component));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, component, extensionAttributeProcessor);
+
+ // Write the component implementation
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ writeStart(writer, IMPLEMENTATION_COMPOSITE, new XAttr(NAME, ((Composite)implementation).getName()));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, (Composite)implementation, extensionAttributeProcessor);
+
+ writeEnd(writer);
+ } else {
+ extensionProcessor.write(component.getImplementation(), writer);
+ }
+
+ // Write <service> elements
+ for (ComponentService service : component.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
+ policyProcessor.writePolicies(service));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, service, extensionAttributeProcessor);
+
+ // Write service interface
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write <callback> element
+ if (service.getCallback() != null) {
+ Callback callback = service.getCallback();
+ writeStart(writer, CALLBACK, policyProcessor.writePolicies(callback));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, callback, extensionAttributeProcessor);
+
+ // Write bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extension : callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extension : service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (ComponentReference reference : component.getReferences()) {
+ writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
+ new XAttr(AUTOWIRE, reference.getAutowire()),
+ writeTargets(reference),
+ policyProcessor.writePolicies(reference));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, reference, extensionAttributeProcessor);
+
+ // Write reference interface
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write callback
+ if (reference.getCallback() != null) {
+ Callback callback = reference.getCallback();
+ writeStart(writer, CALLBACK, policyProcessor.writePolicies(callback));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, callback, extensionAttributeProcessor);
+
+ // Write callback bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extensions : callback.getExtensions()) {
+ extensionProcessor.write(extensions, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extensions : reference.getExtensions()) {
+ extensionProcessor.write(extensions, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (ComponentProperty property : component.getProperties()) {
+ writeStart(writer,
+ PROPERTY,
+ new XAttr(NAME, property.getName()),
+ new XAttr(MUST_SUPPLY, property.isMustSupply()),
+ new XAttr(MANY, property.isMany()),
+ new XAttr(TYPE, property.getXSDType()),
+ new XAttr(ELEMENT, property.getXSDElement()),
+ new XAttr(SOURCE, property.getSource()),
+ new XAttr(FILE, property.getFile()),
+ policyProcessor.writePolicies(property));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, property, extensionAttributeProcessor);
+
+ // Write property value
+ writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : property.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+
+ // Write list of promoted references
+ List<String> promote = new ArrayList<String>();
+ for (ComponentReference promoted: compositeReference.getPromotedReferences()) {
+ promote.add(promoted.getName());
+ }
+
+ // Write <reference> element
+ writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
+ new XAttr(PROMOTE, promote),
+ policyProcessor.writePolicies(reference));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, reference, extensionAttributeProcessor);
+
+ // Write reference interface
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write <callback> element
+ if (reference.getCallback() != null) {
+ Callback callback = reference.getCallback();
+ writeStart(writer, CALLBACK);
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, callback, extensionAttributeProcessor);
+
+ // Write callback bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extension : callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extension : reference.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (Property property : composite.getProperties()) {
+ writeStart(writer,
+ PROPERTY,
+ new XAttr(NAME, property.getName()),
+ new XAttr(MUST_SUPPLY, property.isMustSupply()),
+ new XAttr(MANY, property.isMany()),
+ new XAttr(TYPE, property.getXSDType()),
+ new XAttr(ELEMENT, property.getXSDElement()),
+ policyProcessor.writePolicies(property));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, property, extensionAttributeProcessor);
+
+ // Write property value
+ writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : property.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <wire> elements
+ for (Wire wire : composite.getWires()) {
+ writeStart(writer, WIRE, new XAttr(SOURCE, wire.getSource().getName()), new XAttr(TARGET, wire
+ .getTarget().getName()));
+
+ //write extended attributes
+ this.writeExtendedAttributes(writer, wire, extensionAttributeProcessor);
+
+ // Write extensions
+ for (Object extension : wire.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+ writeEnd(writer);
+ }
+
+ for (Object extension : composite.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(Composite composite, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve constraining type
+ ConstrainingType constrainingType = composite.getConstrainingType();
+ if (constrainingType != null) {
+ 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);
+ if (include != null) {
+ include = resolver.resolveModel(Composite.class, include);
+ composite.getIncludes().set(i, include);
+ }
+ }
+
+ // Resolve extensions
+ for (Object extension : composite.getExtensions()) {
+ if (extension != null) {
+ extensionProcessor.resolve(extension, resolver);
+ }
+ }
+
+ //resolve intents and policy sets
+ List<Intent> compositeIntents = null;
+ List<PolicySet> compositePolicySets = null;
+ List<PolicySet> compositeApplicablePolicySets = null;
+ resolveIntents(composite.getRequiredIntents(), resolver);
+ resolvePolicySets(composite.getPolicySets(), resolver);
+ resolvePolicySets(composite.getApplicablePolicySets(), resolver);
+ compositeIntents = composite.getRequiredIntents();
+ compositePolicySets = composite.getPolicySets();
+ compositeApplicablePolicySets = composite.getApplicablePolicySets();
+
+ //Resolve composite services and references
+ resolveContracts(composite, composite.getServices(), resolver);
+ resolveContracts(composite, composite.getReferences(), resolver);
+
+ // Resolve component implementations, services and references
+ for (Component component : composite.getComponents()) {
+ constrainingType = component.getConstrainingType();
+ if (constrainingType != null) {
+ constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
+ component.setConstrainingType(constrainingType);
+ }
+
+ //resolve intents and policy sets
+ resolveIntents(component.getRequiredIntents(), resolver);
+ resolvePolicySets(component.getPolicySets(), resolver);
+ resolvePolicySets(component.getApplicablePolicySets(), resolver);
+
+ //inherit composite intents and policysets
+ PolicyComputationUtils.addDefaultPolicies(compositeIntents,
+ compositePolicySets,
+ component.getRequiredIntents(),
+ component.getPolicySets());
+
+ addInheritedPolicySets(compositeApplicablePolicySets, component.getApplicablePolicySets());
+
+ //resolve component services and references
+ resolveContracts(component, component.getServices(), resolver);
+ resolveContracts(component, component.getReferences(), resolver);
+
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ if (componentProperty.getFile() != null) {
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(componentProperty.getFile());
+ artifact = resolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() != null) {
+ componentProperty.setFile(artifact.getLocation());
+ }
+ }
+ }
+
+ //resolve component implementation
+ Implementation implementation = component.getImplementation();
+ if (implementation != null) {
+ try {
+ //resolve intents and policysets specified on this implementation
+ //before copying them over to the component. Before that, from the component
+ //copy over the applicablePolicySets alone as it might have to be
+ //used to validate the policysets specified on the implementation
+
+ resolveImplIntentsAndPolicySets(implementation,
+ component.getApplicablePolicySets(),
+ resolver);
+
+ copyPoliciesToComponent(component, implementation, resolver, true);
+
+ //now resolve the implementation so that even if there is a shared instance
+ //for this that is resolved, the specified intents and policysets are safe in the
+ //component and not lost
+ implementation = resolveImplementation(implementation, resolver);
+
+ //resolved implementation may contain intents and policysets specified at
+ //componentType (either in the componentType side file or in annotations if its a
+ //java implementation). This has to be consolidated in to the component.
+ copyPoliciesToComponent(component, implementation, resolver, false);
+
+ component.setImplementation(implementation);
+ } catch ( PolicyValidationException e ) {
+ error("PolicyImplValidationException", resolver, component.getName(), e.getMessage());
+ //throw new ContributionResolveException("PolicyValidation exception when processing implementation of component '"
+ //+ component.getName() + "' due to " + e.getMessage(), e);
+ }
+
+ }
+
+ //add model resolver to component
+ if (component instanceof ResolverExtension) {
+ ((ResolverExtension)component).setModelResolver(resolver);
+ }
+ }
+
+ // Add model resolver to promoted components
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ Component promotedComponent = compositeService.getPromotedComponent();
+ if (promotedComponent instanceof ResolverExtension) {
+ ((ResolverExtension)promotedComponent).setModelResolver(resolver);
+ }
+ }
+ }
+
+ private void resolveImplIntentsAndPolicySets(Implementation implementation,
+ List<PolicySet> inheritedApplicablePolicySets,
+ ModelResolver resolver) throws ContributionResolveException,
+ PolicyValidationException
+ {
+ if ( implementation instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
+
+ policiedImpl.getApplicablePolicySets().addAll(inheritedApplicablePolicySets);
+
+ resolveIntents(policiedImpl.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(policiedImpl, policiedImpl.getType());
+
+ resolvePolicySets(policiedImpl.getPolicySets(), resolver);
+ resolvePolicySets(policiedImpl.getApplicablePolicySets(), resolver);
+
+ PolicyValidationUtils.validatePolicySets(policiedImpl);
+
+ if ( implementation instanceof OperationsConfigurator ) {
+ for ( ConfiguredOperation implConfOp : ((OperationsConfigurator)implementation).getConfiguredOperations() ) {
+ resolveIntents(implConfOp.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(implConfOp, policiedImpl.getType());
+
+ resolvePolicySets(implConfOp.getPolicySets(), resolver);
+ resolvePolicySets(implConfOp.getApplicablePolicySets(), resolver);
+ //add the inherited applicablePolicysets
+ addInheritedPolicySets(policiedImpl.getApplicablePolicySets(), implConfOp.getApplicablePolicySets());
+
+ PolicyValidationUtils.validatePolicySets(implConfOp, policiedImpl.getType());
+
+ PolicyComputationUtils.addDefaultPolicies(
+ ((PolicySetAttachPoint)implementation).getRequiredIntents(),
+ ((PolicySetAttachPoint)implementation).getPolicySets(),
+ implConfOp.getRequiredIntents(),
+ implConfOp.getPolicySets());
+ }
+ }
+ }
+ }
+
+ private void copyPoliciesToComponent(Component component,
+ Implementation implementation,
+ ModelResolver resolver,
+ boolean clearImplSettings) throws ContributionResolveException {
+ if (implementation instanceof PolicySetAttachPoint) {
+ // Add implementation policies into component, since implementation instances are
+ // reused and it's likely that this implementation instance will not hold after its resolution.
+ // On the first call to this method (clearImplSettings=true), we are moving policies from the
+ // implementation XML element up to the component. In this case if there are mutually exclusive
+ // policies we must clear the component policy so that the implementation policy "wins".
+ // On the second call to this method (clearImplSettings=false), we are moving policies from the
+ // componentType implementation up to the component. In this case if there are mutually
+ // exclusive policies it is an error. This error will be detected later in the PolicyComputer.
+ if (clearImplSettings) {
+ for (Intent intent : ((PolicySetAttachPoint)implementation).getRequiredIntents()) {
+ for (Intent excluded : intent.getExcludedIntents()) {
+ if (component.getRequiredIntents().contains(excluded)) {
+ component.getRequiredIntents().remove(excluded);
+ }
+ for (Iterator i = component.getPolicySets().iterator(); i.hasNext(); ) {
+ PolicySet cmpPolicySet = (PolicySet) i.next();
+ if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
+ i.remove();
+ }
+ }
+ }
+ }
+ for (PolicySet policySet : ((PolicySetAttachPoint)implementation).getPolicySets()) {
+ for (Intent intent : policySet.getProvidedIntents()) {
+ for (Intent excluded : intent.getExcludedIntents()) {
+ if (component.getRequiredIntents().contains(excluded)) {
+ component.getRequiredIntents().remove(excluded);
+ }
+ for (Iterator i = component.getPolicySets().iterator(); i.hasNext(); ) {
+ PolicySet cmpPolicySet = (PolicySet) i.next();
+ if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
+ i.remove();
+ }
+ }
+ }
+ }
+ }
+ }
+ component.getRequiredIntents().addAll(((PolicySetAttachPoint)implementation).getRequiredIntents());
+ component.getPolicySets().addAll(((PolicySetAttachPoint)implementation).getPolicySets());
+ component.getApplicablePolicySets().addAll(((PolicySetAttachPoint)implementation).getApplicablePolicySets());
+
+ if ( implementation instanceof OperationsConfigurator ) {
+ boolean notFound;
+ List<ConfiguredOperation> opsFromImplementation = new ArrayList<ConfiguredOperation>();
+ List<ConfiguredOperation> implConfOperations =
+ new ArrayList<ConfiguredOperation>(((OperationsConfigurator)implementation).getConfiguredOperations());
+ for ( ConfiguredOperation implConfOp : implConfOperations ) {
+ notFound = true;
+ for ( ConfiguredOperation compConfOp : ((OperationsConfigurator)component).getConfiguredOperations() ) {
+ if ( implConfOp.getName().equals(compConfOp.getName()) ) {
+ notFound = false;
+
+ if (clearImplSettings) {
+ for (Intent intent : implConfOp.getRequiredIntents()) {
+ for (Intent excluded : intent.getExcludedIntents()) {
+ if (compConfOp.getRequiredIntents().contains(excluded)) {
+ compConfOp.getRequiredIntents().remove(excluded);
+ }
+ }
+ }
+ for (PolicySet policySet : implConfOp.getPolicySets()) {
+ for (Intent intent : policySet.getProvidedIntents()) {
+ for (Intent excluded : intent.getExcludedIntents()) {
+ if (compConfOp.getRequiredIntents().contains(excluded)) {
+ compConfOp.getRequiredIntents().remove(excluded);
+ }
+ for (Iterator i = compConfOp.getPolicySets().iterator(); i.hasNext(); ) {
+ PolicySet cmpPolicySet = (PolicySet) i.next();
+ if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
+ i.remove();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ addInheritedIntents(implConfOp.getRequiredIntents(), compConfOp.getRequiredIntents());
+ addInheritedPolicySets(implConfOp.getPolicySets(), compConfOp.getPolicySets());
+ addInheritedPolicySets(implConfOp.getApplicablePolicySets(), compConfOp.getApplicablePolicySets());
+ }
+ }
+
+ if ( notFound ) {
+ opsFromImplementation.add(implConfOp);
+ }
+
+ if ( clearImplSettings ) {
+ ((OperationsConfigurator)implementation).getConfiguredOperations().remove(implConfOp);
+ }
+ }
+ ((OperationsConfigurator)component).getConfiguredOperations().addAll(opsFromImplementation);
+ }
+
+ if ( clearImplSettings ) {
+ ((PolicySetAttachPoint)implementation).getRequiredIntents().clear();
+ ((PolicySetAttachPoint)implementation).getPolicySets().clear();
+ }
+ }
+ }
+
+
+ public QName getArtifactType() {
+ return COMPOSITE_QNAME;
+ }
+
+ public Class<Composite> getModelType() {
+ return Composite.class;
+ }
+
+ /**
+ * Returns the model factory extension point to use.
+ *
+ * @param extensionPoints
+ * @return
+ */
+ private static ModelFactoryExtensionPoint modelFactories(ExtensionPointRegistry extensionPoints) {
+ return extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ }
+
+ /**
+ * Returns the monitor to use.
+ *
+ * @param extensionPoints
+ * @return
+ */
+ private static Monitor monitor(ExtensionPointRegistry extensionPoints) {
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ if (utilities != null) {
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ if (monitorFactory != null) {
+ return monitorFactory.createMonitor();
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
new file mode 100644
index 0000000000..aa4980fcb6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.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.assembly.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.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.PolicyFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * Processor for dealing with 'operation' elements from composite definitions
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConfiguredOperationProcessor implements StAXArtifactProcessor<ConfiguredOperation>, Constants{
+
+ private AssemblyFactory assemblyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+ private PolicyFactory policyFactory;
+ private Monitor monitor;
+
+ public ConfiguredOperationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.monitor = monitor;
+ }
+
+ public ConfiguredOperation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ConfiguredOperation configuredOp = assemblyFactory.createConfiguredOperation();
+
+ //Read an <operation>
+ configuredOp.setName(reader.getAttributeValue(null, NAME));
+ configuredOp.setContractName(reader.getAttributeValue(null, SERVICE));
+ configuredOp.setUnresolved(true);
+
+ // Read policies
+ policyProcessor.readPolicies(configuredOp, reader);
+
+ //Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && OPERATION_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return configuredOp;
+ }
+
+ public void write(ConfiguredOperation configuredOperation, XMLStreamWriter writer)
+ throws ContributionWriteException, XMLStreamException {
+
+ // Write an <operation>
+ policyProcessor.writePolicyPrefixes(configuredOperation, writer);
+ writer.writeStartElement(Constants.SCA10_NS, OPERATION);
+ policyProcessor.writePolicyAttributes(configuredOperation, writer);
+
+ writer.writeAttribute(NAME, configuredOperation.getName());
+ if ( configuredOperation.getContractName() != null ) {
+ writer.writeAttribute(SERVICE, configuredOperation.getContractName());
+ }
+ writer.writeEndElement();
+ }
+
+ public void resolve(ConfiguredOperation configuredOperation, ModelResolver resolver)
+ throws ContributionResolveException {
+ }
+
+ public QName getArtifactType() {
+ return OPERATION_QNAME;
+ }
+
+ public Class<ConfiguredOperation> getModelType() {
+ return ConfiguredOperation.class;
+ }
+
+}
+
+
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
new file mode 100644
index 0000000000..3bf5a1173b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.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.assembly.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Constants used in SCA assembly XML files.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Constants {
+ String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ String SCA10_TUSCANY_NS = "http://tuscany.apache.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 OPERATION = "operation";
+ QName OPERATION_QNAME = new QName(SCA10_NS, OPERATION);
+
+ String CALLBACK = "callback";
+ QName CALLBACK_QNAME = new QName(SCA10_NS, CALLBACK);
+
+ String IMPLEMENTATION_COMPOSITE = "implementation.composite";
+ QName IMPLEMENTATION_COMPOSITE_QNAME = new QName(SCA10_NS, IMPLEMENTATION_COMPOSITE);
+
+ String IMPLEMENTATION = "implementation";
+ QName IMPLEMENTATION_QNAME = new QName(SCA10_NS, IMPLEMENTATION);
+
+ String BINDING_SCA = "binding.sca";
+ QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA);
+
+ String NAME = "name";
+ String TARGET_NAMESPACE = "targetNamespace";
+ String LOCAL = "local";
+ String AUTOWIRE = "autowire";
+ String REQUIRES = "requires";
+ String POLICY_SETS = "policySets";
+ String APPLICABLE_POLICY_SETS = "applicablePolicySets";
+ 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";
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java
new file mode 100644
index 0000000000..4c5d6f8f49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.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.assembly.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+
+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.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
+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.monitor.Monitor;
+
+/**
+ * A contrainingType content handler.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<ConstrainingType> {
+ private XMLInputFactory inputFactory;
+
+ /**
+ * Construct a new constrainingType processor.
+ * @param factory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ public ConstrainingTypeDocumentProcessor(StAXArtifactProcessor staxProcessor,
+ XMLInputFactory inputFactory,
+ Monitor monitor) {
+ super(null, null, staxProcessor, monitor);
+ this.inputFactory = inputFactory;
+ }
+
+ /**
+ * Constructs a new constrainingType processor.
+ * @param modelFactories
+ * @param staxProcessor
+ */
+ public ConstrainingTypeDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor staxProcessor,
+ Monitor monitor) {
+ super(null, null, staxProcessor, monitor);
+ this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
+ }
+
+ public ConstrainingType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+
+ // Create a stream reader
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ urlStream = connection.getInputStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+ reader.nextTag();
+
+ // Read the constrainingType model
+ ConstrainingType constrainingType = (ConstrainingType)extensionProcessor.read(reader);
+
+ // For debugging purposes, write it back to XML
+// if (constrainingType != null) {
+// try {
+// ByteArrayOutputStream bos = new ByteArrayOutputStream();
+// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+// extensionProcessor.write(constrainingType, outputFactory.createXMLStreamWriter(bos));
+// Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
+// OutputFormat format = new OutputFormat();
+// format.setIndenting(true);
+// format.setIndent(2);
+// XMLSerializer serializer = new XMLSerializer(System.out, format);
+// serializer.serialize(document);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+
+ return constrainingType;
+
+ } catch (XMLStreamException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", inputFactory, ce);
+ throw ce;
+ } catch (IOException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", inputFactory, ce);
+ throw ce;
+ } 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-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java
new file mode 100644
index 0000000000..7dd95e3944
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.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.assembly.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for ConstrainingType models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeModelResolver implements ModelResolver {
+
+ private Contribution contribution;
+ private Map<QName, ConstrainingType> map = new HashMap<QName, ConstrainingType>();
+
+ public ConstrainingTypeModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ }
+
+ public void addModel(Object resolved) {
+ ConstrainingType composite = (ConstrainingType)resolved;
+ map.put(composite.getName(), composite);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((ConstrainingType)resolved).getName());
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ // Lookup a definition for the given namespace
+ QName qname = ((ConstrainingType)unresolved).getName();
+ ConstrainingType resolved = (ConstrainingType) map.get(qname);
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+
+ // No definition found, delegate the resolution to the imports
+ for (Import import_ : this.contribution.getImports()) {
+ if (import_ instanceof NamespaceImport) {
+ NamespaceImport namespaceImport = (NamespaceImport)import_;
+ if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
+
+ // Delegate the resolution to the import resolver
+ resolved = namespaceImport.getModelResolver().resolveModel(ConstrainingType.class, (ConstrainingType)unresolved);
+ if (!resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ return (T)unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
new file mode 100644
index 0000000000..334b6c6b97
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.ModelFactoryExtensionPoint;
+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.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.w3c.dom.Document;
+
+/**
+ * A constrainingType processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<ConstrainingType> {
+
+ /**
+ * Construct a new constrainingType processor.
+ * @param factory
+ * @param policyFactory
+ * @param extensionProcessor
+ */
+ public ConstrainingTypeProcessor(AssemblyFactory factory, PolicyFactory policyFactory,
+ StAXArtifactProcessor extensionProcessor, Monitor monitor) {
+ super(factory, policyFactory, extensionProcessor, monitor);
+ }
+
+ /**
+ * Constructs a new constrainingType processor.
+ *
+ * @param modelFactories
+ * @param extensionProcessor
+ */
+ public ConstrainingTypeProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor extensionProcessor,
+ Monitor monitor) {
+ super(modelFactories.getFactory(AssemblyFactory.class),
+ modelFactories.getFactory(PolicyFactory.class), extensionProcessor, monitor);
+ }
+
+ public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ConstrainingType constrainingType = null;
+ AbstractService abstractService = null;
+ AbstractReference abstractReference = null;
+ AbstractProperty abstractProperty = null;
+ AbstractContract abstractContract = null;
+ QName name = null;
+
+ // 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)));
+ policyProcessor.readPolicies(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);
+ policyProcessor.readPolicies(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);
+ policyProcessor.readPolicies(abstractReference, reader);
+
+ } else if (Constants.PROPERTY_QNAME.equals(name)) {
+
+ // Read a <property>
+ abstractProperty = assemblyFactory.createAbstractProperty();
+ readAbstractProperty(abstractProperty, reader);
+
+ // Read the property value
+ Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
+ abstractProperty.setValue(value);
+
+ constrainingType.getProperties().add(abstractProperty);
+ policyProcessor.readPolicies(abstractProperty, reader);
+
+ } else if (OPERATION_QNAME.equals(name)) {
+
+ // Read an <operation>
+ Operation operation = new OperationImpl();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ policyProcessor.readPolicies(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);
+ } else {
+
+ // Add the extension element to the current element
+ if (abstractContract != null) {
+ abstractContract.getExtensions().add(extension);
+ } else {
+ constrainingType.getExtensions().add(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;
+ }
+
+ public void write(ConstrainingType constrainingType, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <constrainingType> element
+ writeStartDocument(writer, CONSTRAINING_TYPE,
+ new XAttr(TARGET_NAMESPACE, constrainingType.getName().getNamespaceURI()),
+ new XAttr(NAME, constrainingType.getName().getLocalPart()),
+ policyProcessor.writePolicies(constrainingType));
+
+ // Write <service> elements
+ for (AbstractService service : constrainingType.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
+ policyProcessor.writePolicies(service));
+
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ for (Object extension: service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (AbstractReference reference : constrainingType.getReferences()) {
+ writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
+ policyProcessor.writePolicies(reference));
+
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ for (Object extension: reference.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (AbstractProperty abstractProperty : constrainingType.getProperties()) {
+ writeStart(writer,
+ PROPERTY,
+ new XAttr(NAME, abstractProperty.getName()),
+ new XAttr(MUST_SUPPLY, abstractProperty.isMustSupply()),
+ new XAttr(MANY, abstractProperty.isMany()),
+ new XAttr(TYPE, abstractProperty.getXSDType()),
+ new XAttr(ELEMENT, abstractProperty.getXSDElement()),
+ policyProcessor.writePolicies(abstractProperty));
+
+ // Write property value
+ writePropertyValue(abstractProperty.getValue(), abstractProperty.getXSDElement(), abstractProperty.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : abstractProperty.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extension elements
+ for (Object extension: constrainingType.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(ConstrainingType constrainingType, ModelResolver resolver) throws ContributionResolveException {
+ // Resolve component type services and references
+ resolveAbstractContracts(constrainingType.getServices(), resolver);
+ resolveAbstractContracts(constrainingType.getReferences(), resolver);
+
+ resolveIntents(constrainingType.getRequiredIntents(), resolver);
+ for ( AbstractService service : constrainingType.getServices() ) {
+ resolveIntents(service.getRequiredIntents(), resolver);
+ }
+
+ for ( AbstractReference reference : constrainingType.getReferences() ) {
+ resolveIntents(reference.getRequiredIntents(), resolver);
+ }
+ }
+
+ public QName getArtifactType() {
+ return CONSTRAINING_TYPE_QNAME;
+ }
+
+ public Class<ConstrainingType> getModelType() {
+ return ConstrainingType.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
new file mode 100644
index 0000000000..a63ccdf151
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.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.assembly.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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.ComponentType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.monitor.Monitor;
+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.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Default Model Processor for beans.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultBeanModelProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor {
+
+ private QName artifactType;
+ private Class<Implementation> modelClass;
+ private Object modelFactory;
+ private Method factoryMethod;
+ private Map<String, Method> setterMethods = new HashMap<String, Method>();
+ private Map<String, Method> getterMethods = new HashMap<String, Method>();
+
+ public DefaultBeanModelProcessor(AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ QName artifactType,
+ Class<Implementation> modelClass,
+ Object modelFactory,
+ Monitor monitor) {
+ super(assemblyFactory, policyFactory, null, monitor);
+ this.artifactType = artifactType;
+ this.modelClass = modelClass;
+ this.modelFactory = modelFactory;
+
+ // Introspect the factory class and bean model class
+ if (modelFactory != null) {
+
+ // Find the model create method
+ for (Method method: modelFactory.getClass().getMethods()) {
+ if (method.getName().startsWith("create") && method.getReturnType() == modelClass) {
+ factoryMethod = method;
+ break;
+ }
+ }
+ }
+
+ // Index the bean's setter methods
+ for (Method method: modelClass.getMethods()) {
+ Method getter;
+ String name = method.getName();
+ if (name.startsWith("set") && name.length() > 3) {
+
+ // Get the corresponding getter method
+ try {
+ getter = modelClass.getMethod("get" + name.substring(3));
+ } catch (Exception e) {
+ getter = null;
+ continue;
+ }
+
+ // Get the property name
+ name = name.substring(3);
+ if (name.length() > 1) {
+ if (!name.toUpperCase().equals(name)) {
+ name = name.substring(0, 1).toLowerCase() + name.substring(1);
+ }
+ }
+ } else {
+ continue;
+ }
+
+ // Map an uppercase property name to a lowercase attribute name
+ if (name.toUpperCase().equals(name)) {
+ name = name.toLowerCase();
+ }
+
+ // Trim trailing _ from property names
+ if (name.endsWith("_")) {
+ name = name.substring(0, name.length()-1);
+ }
+ setterMethods.put(name, method);
+ getterMethods.put(name, getter);
+ }
+ }
+
+ public Object read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an element
+ try {
+
+ // Create a new instance of the model
+ Object model;
+ if (modelFactory != null) {
+ // Invoke the factory create method
+ model = factoryMethod.invoke(modelFactory);
+ } else {
+ // Invoke the model bean class default constructor
+ model = modelClass.newInstance();
+ }
+
+ // Initialize the bean properties with the attributes found in the
+ // XML element
+ for (int i = 0, n = reader.getAttributeCount(); i < n; i++) {
+ String attributeName = reader.getAttributeLocalName(i);
+ Method setter = setterMethods.get(attributeName);
+ if (setter != null) {
+ String value = reader.getAttributeValue(i);
+ setter.invoke(model, value);
+ }
+ }
+
+ // Read policies
+ policyProcessor.readPolicies(model, reader);
+
+ // FIXME read extension elements
+
+ // By default mark the model object unresolved
+ if (model instanceof Base) {
+ ((Base)model).setUnresolved(true);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && artifactType.equals(reader.getName())) {
+ break;
+ }
+ }
+ return model;
+
+ } catch (Exception e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", reader, ce);
+ throw ce;
+ }
+ }
+
+ public void write(Object bean, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ try {
+ // Write the bean properties as attributes
+ List<XAttr> attrs = new ArrayList<XAttr>();
+ for (Map.Entry<String, Method> entry: getterMethods.entrySet()) {
+ if (entry.getValue().getReturnType() == String.class) {
+ String value = (String)entry.getValue().invoke(bean);
+ attrs.add(new XAttr(entry.getKey(), value));
+ }
+ }
+
+ // Write element
+ writeStart(writer, artifactType.getNamespaceURI(), artifactType.getLocalPart(),
+ policyProcessor.writePolicies(bean), new XAttr(null, attrs));
+
+ writeEnd(writer);
+
+ } catch (Exception e) {
+ ContributionWriteException ce = new ContributionWriteException(e);
+ error("ContributionWriteException", writer, ce);
+ throw ce;
+ }
+ }
+
+ public void resolve(Object bean, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve and merge the component type associated with an
+ // implementation model
+ if (bean instanceof Implementation) {
+ Implementation implementation = (Implementation)bean;
+ String uri = implementation.getURI();
+ if (uri != null) {
+ int d = uri.lastIndexOf('.');
+ if (d != -1) {
+ uri = uri.substring(0, d) + ".componentType";
+
+ // Resolve the component type
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setURI(uri);
+ componentType.setUnresolved(true);
+
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (componentType != null && !componentType.isUnresolved()) {
+
+ // We found a component type, merge it into the implementation model
+ implementation.getServices().addAll(componentType.getServices());
+ implementation.getReferences().addAll(componentType.getReferences());
+ implementation.getProperties().addAll(componentType.getProperties());
+ implementation.setConstrainingType(componentType.getConstrainingType());
+
+ if (implementation instanceof PolicySetAttachPoint &&
+ componentType instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
+ PolicySetAttachPoint policiedCompType = (PolicySetAttachPoint)componentType;
+
+ if ( policiedImpl.getPolicySets() != null) {
+ policiedImpl.getPolicySets().addAll(policiedCompType.getPolicySets());
+ }
+ if (policiedImpl.getRequiredIntents() != null) {
+ policiedImpl.getRequiredIntents().addAll(policiedCompType.getRequiredIntents());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Mark the model resolved
+ if (bean instanceof Base) {
+ ((Base)bean).setUnresolved(false);
+ }
+ }
+
+ public QName getArtifactType() {
+ return artifactType;
+ }
+
+ public Class<?> getModelType() {
+ return modelClass;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
new file mode 100644
index 0000000000..fc4e10654d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.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.assembly.xml;
+
+import java.util.ArrayList;
+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.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+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;
+
+/**
+ * A Policy Attach Point processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implements Constants {
+
+ private PolicyFactory policyFactory;
+
+ public PolicyAttachPointProcessor(PolicyFactory policyFactory) {
+ this.policyFactory = policyFactory;
+ }
+
+ /**
+ * Read policy intents associated with an operation.
+ * @param attachPoint
+ * @param operation
+ * @param reader
+ */
+ private void readIntents(Object attachPoint, Operation operation, XMLStreamReader reader) {
+ if (!(attachPoint instanceof IntentAttachPoint))
+ return;
+ IntentAttachPoint intentAttachPoint = (IntentAttachPoint)attachPoint;
+ String value = reader.getAttributeValue(null, REQUIRES);
+ if (value != null) {
+ List<Intent> requiredIntents = intentAttachPoint.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) {
+ //FIXME Don't we need to handle intent specification
+ // on an operation basis?
+ //intent.getOperations().add(operation);
+ }
+ requiredIntents.add(intent);
+ }
+ }
+ }
+
+ /**
+ * Reads policy intents and policy sets associated with an operation.
+ * @param attachPoint
+ * @param operation
+ * @param reader
+ */
+ public void readPolicies(Object attachPoint, Operation operation, XMLStreamReader reader) {
+ readIntents(attachPoint, operation, reader);
+ readPolicySets(attachPoint, operation, reader);
+ }
+
+ /**
+ * Reads policy intents and policy sets.
+ * @param attachPoint
+ * @param reader
+ */
+ public void readPolicies(Object attachPoint, XMLStreamReader reader) {
+ readPolicies(attachPoint, null, reader);
+ }
+
+ /**
+ * Reads policy sets associated with an operation.
+ * @param attachPoint
+ * @param operation
+ * @param reader
+ */
+ private void readPolicySets(Object attachPoint, Operation operation, XMLStreamReader reader) {
+ if (!(attachPoint instanceof PolicySetAttachPoint)) {
+ return;
+ }
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
+ String value = reader.getAttributeValue(null, POLICY_SETS);
+ if (value != null) {
+ List<PolicySet> policySets = policySetAttachPoint.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) {
+ //FIXME Don't we need to handle policySet specification
+ // on an operation basis?
+ //policySet.getOperations().add(operation);
+ }
+ policySets.add(policySet);
+ }
+ }
+
+ value = reader.getAttributeValue(SCA10_TUSCANY_NS, APPLICABLE_POLICY_SETS);
+ if (value != null) {
+ List<PolicySet> applicablePolicySets = policySetAttachPoint.getApplicablePolicySets();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(qname);
+ if (operation != null) {
+ //FIXME Don't we need to handle policySet specification
+ // on an operation basis?
+ //policySet.getOperations().add(operation);
+ }
+ applicablePolicySets.add(policySet);
+ }
+ }
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ XAttr writePolicies(Object attachPoint) throws XMLStreamException {
+ return writePolicies(attachPoint, (Operation)null);
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ public void writePolicyAttributes(Object attachPoint, XMLStreamWriter writer) throws XMLStreamException {
+ writePolicyAttributes(attachPoint, (Operation)null, writer);
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ public void writePolicyPrefixes(Object attachPoint, XMLStreamWriter writer) throws XMLStreamException {
+ writePolicyPrefixes(attachPoint, (Operation)null, writer);
+ }
+
+ /**
+ * Write policies associated with an operation
+ * @param attachPoint
+ * @param operation
+ * @return
+ */
+ XAttr writePolicies(Object attachPoint, Operation operation) {
+ List<XAttr> attrs =new ArrayList<XAttr>();
+ attrs.add(writeIntents(attachPoint, operation));
+ attrs.add(writePolicySets(attachPoint, operation));
+ return new XAttr(null, attrs);
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ public void writePolicyAttributes(Object attachPoint, Operation operation, XMLStreamWriter writer) throws XMLStreamException {
+ XAttr attr = writePolicies(attachPoint, operation);
+ attr.write(writer);
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ public void writePolicyPrefixes(Object attachPoint, Operation operation, XMLStreamWriter writer) throws XMLStreamException {
+ XAttr attr = writePolicies(attachPoint, operation);
+ attr.writePrefix(writer);
+ }
+
+ /**
+ * Write policy intents associated with an operation.
+ * @param attachPoint
+ * @param operation
+ */
+ private XAttr writeIntents(Object attachPoint, Operation operation) {
+ if (!(attachPoint instanceof IntentAttachPoint)) {
+ return null;
+ }
+ IntentAttachPoint intentAttachPoint = (IntentAttachPoint)attachPoint;
+ List<QName> qnames = new ArrayList<QName>();
+ for (Intent intent: intentAttachPoint.getRequiredIntents()) {
+ qnames.add(intent.getName());
+ }
+ return new XAttr(Constants.REQUIRES, qnames);
+ }
+
+ /**
+ * Write policy sets associated with an operation.
+ * @param attachPoint
+ * @param operation
+ */
+ private XAttr writePolicySets(Object attachPoint, Operation operation) {
+ if (!(attachPoint instanceof PolicySetAttachPoint)) {
+ return null;
+ }
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
+ List<QName> qnames = new ArrayList<QName>();
+ for (PolicySet policySet: policySetAttachPoint.getPolicySets()) {
+ qnames.add(policySet.getName());
+ }
+ return new XAttr(Constants.POLICY_SETS, qnames);
+ }
+
+ public void resolvePolicies(Object attachPoint, ModelResolver resolver) {
+ if ( attachPoint instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
+
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ Intent resolvedIntent = null;
+
+ if ( policySetAttachPoint.getRequiredIntents() != null && policySetAttachPoint.getRequiredIntents().size() > 0 ) {
+ for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) {
+ resolvedIntent = resolver.resolveModel(Intent.class, intent);
+ requiredIntents.add(resolvedIntent);
+ }
+ policySetAttachPoint.getRequiredIntents().clear();
+ policySetAttachPoint.getRequiredIntents().addAll(requiredIntents);
+ }
+
+ if ( policySetAttachPoint.getPolicySets() != null && policySetAttachPoint.getPolicySets().size() > 0 ) {
+ List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
+ PolicySet resolvedPolicySet = null;
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
+ resolvedPolicySets.add(resolvedPolicySet);
+ }
+ policySetAttachPoint.getPolicySets().clear();
+ policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..7a190dea9c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -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.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#componentType,model=org.apache.tuscany.sca.assembly.ComponentType
+org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#constrainingType,model=org.apache.tuscany.sca.assembly.ConstrainingType
+org.apache.tuscany.sca.assembly.xml.CompositeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#composite,model=org.apache.tuscany.sca.assembly.Composite
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
new file mode 100644
index 0000000000..403c049b48
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
@@ -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.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.ComponentTypeDocumentProcessor;type=.componentType,model=org.apache.tuscany.sca.assembly.ComponentType
+org.apache.tuscany.sca.assembly.xml.ConstrainingTypeDocumentProcessor;type=.constrainingType,model=org.apache.tuscany.sca.assembly.ConstrainingType
+org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;type=.composite,model=org.apache.tuscany.sca.assembly.Composite
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..ecc34942f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -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.
+
+org.apache.tuscany.sca.assembly.xml.CompositeModelResolver;model=org.apache.tuscany.sca.assembly.Composite
+org.apache.tuscany.sca.assembly.xml.ConstrainingTypeModelResolver;model=org.apache.tuscany.sca.assembly.ConstrainingType
+org.apache.tuscany.sca.assembly.xml.ComponentTypeModelResolver;model=org.apache.tuscany.sca.assembly.ComponentType
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
new file mode 100644
index 0000000000..95edf89e30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
@@ -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.
+#
+#
+NoCompositeNamespace = No namespace found: Composite = {0}
+UnexpectedInterfaceElement = Unexpected <interface> element found. It should appear inside a <service> or <reference> element.
+UnexpectedBindingElement = Unexpected <binding> element found. It should appear inside a <service> or <reference> element.
+UnexpectedImplementationElement = Unexpected <implementation> element found. It should appear inside a <component> element.
+PolicyImplValidationException = PolicyValidation exception when processing implementation of component {0} due to {1}.
+PolicyServiceValidationException = PolicyValidation exceptions when processing service/reference {0} in {1}. Error is {2}
+ContributionReadException = ContributionReadException occured due to : {0}
+ContributionWriteException = ContributionWriteException occured due to : {0}
+
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java
new file mode 100644
index 0000000000..5f8f976b84
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+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.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev: 561254 $ $Date: 2007-07-31 13:16:27 +0530 (Tue, 31 Jul 2007) $
+ */
+public class BuildPolicyTestCase extends TestCase {
+ private URLArtifactProcessor<Object> documentProcessor;
+ private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
+ private ModelResolver resolver;
+ private CompositeBuilder compositeBuilder;
+ private Composite composite;
+ private Monitor monitor;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ SCABindingFactory scaBindingFactory = new TestSCABindingFactoryImpl();
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ List<SCADefinitions> policyDefinitions = new ArrayList<SCADefinitions>();
+ resolver = new DefaultModelResolver();
+
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ monitor = monitorFactory.createMonitor();
+
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, monitor);
+ URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(extensionPoints);
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
+ policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
+
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
+
+ URL url = getClass().getResource("CalculatorComponent.constrainingType");
+ URI uri = URI.create("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ url = getClass().getResource("TestAllPolicyCalculator.composite");
+ uri = URI.create("TestAllCalculator.constrainingType");
+ composite = (Composite)documentProcessor.read(null, uri, url);
+ assertNotNull(composite);
+
+ url = getClass().getResource("another_test_definitions.xml");
+ uri = URI.create("another_test_definitions.xml");
+ SCADefinitions definitions = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
+ assertNotNull(definitions);
+ policyDefinitions.add(definitions);
+
+ documentProcessor.resolve(definitions, resolver);
+ documentProcessor.resolve(composite, resolver);
+
+ compositeBuilder.build(composite);
+ }
+
+ public void testPolicyIntentInheritance() throws Exception {
+ String namespaceUri = "http://test";
+
+ IntentAttachPoint policiedComposite = (IntentAttachPoint)composite;
+ assertEquals(policiedComposite.getRequiredIntents().size(), 1);
+ assertEquals(policiedComposite.getRequiredIntents().get(0).getName(), new QName(namespaceUri, "tuscanyIntent_1"));
+
+ //1 defined for composite, 2 defined for the service, 1 defined and 3 inherited for the promoted service (4)
+ assertEquals(composite.getServices().get(0).getRequiredIntents().size(), 7);
+ //1 from the operation defined in this service and 2 from the operation defined in the promoted service
+ assertEquals(composite.getServices().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
+ assertEquals(composite.getServices().get(0).getRequiredIntents().get(3).getName(), new QName(namespaceUri, "tuscanyIntent_3"));
+ //bindings will have only 2 intents since duplications will be cut out
+ assertEquals(((IntentAttachPoint)composite.getServices().get(0).getBindings().get(0)).getRequiredIntents().size(), 3);
+ assertEquals(((OperationsConfigurator)composite.getServices().get(0).getBindings().get(0)).getConfiguredOperations().size(), 1);
+ assertEquals(((OperationsConfigurator)composite.getServices().get(0).getBindings().get(0)).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
+
+ assertEquals(composite.getReferences().get(0).getRequiredIntents().size(), 5);
+ assertEquals(composite.getReferences().get(0).getConfiguredOperations().size(), 1);
+ assertEquals(composite.getReferences().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 4);
+ assertEquals(composite.getReferences().get(0).getRequiredIntents().get(1).getName(), new QName(namespaceUri, "tuscanyIntent_1"));
+ assertEquals(((IntentAttachPoint)composite.getReferences().get(0).getBindings().get(0)).getRequiredIntents().size(), 3);
+
+ assertEquals(composite.getComponents().get(0).getRequiredIntents().size(), 3);
+ assertEquals(composite.getComponents().get(0).getRequiredIntents().get(2).getName(), new QName(namespaceUri, "tuscanyIntent_1"));
+ assertEquals(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().size(), 4);
+ assertEquals(composite.getComponents().get(0).getServices().get(0).getCallback().getRequiredIntents().size(), 4);
+ assertEquals(composite.getComponents().get(0).getServices().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
+ assertEquals(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().size(), 5);
+ assertEquals(composite.getComponents().get(0).getReferences().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
new file mode 100644
index 0000000000..e2aeb85d32
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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 junit.framework.TestCase;
+
+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.Property;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Test reading SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadAllTestCase extends TestCase {
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private XMLInputFactory inputFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
+ assertNotNull(composite);
+ assertEquals(composite.getName(), new QName("http://calc", "TestAllCalculator"));
+ assertEquals(composite.getConstrainingType().getName(), new QName("http://calc", "CalculatorComponent"));
+ assertTrue(composite.isLocal());
+ assertFalse(composite.getAutowire() == Boolean.TRUE);
+ assertEquals(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getName(), new QName("http://test",
+ "confidentiality"));
+ assertEquals(((PolicySetAttachPoint)composite).getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+
+ 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(),
+ "CalculatorService");
+ assertEquals(calcCompositeService.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcCompositeService.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // TODO test operations
+ Callback calcServiceCallback = calcCompositeService.getCallback();
+ assertNotNull(calcServiceCallback);
+ assertEquals(calcServiceCallback.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcServiceCallback.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // TODO test operations
+
+ Component calcComponent = composite.getComponents().get(0);
+ assertEquals(calcComponent.getName(), "CalculatorServiceComponent");
+ assertEquals(calcComponent.getAutowire(), Boolean.FALSE);
+ assertEquals(calcComponent.getConstrainingType().getName(), new QName("http://calc",
+ "CalculatorComponent"));
+ assertEquals(calcComponent.getRequiredIntents().get(0).getName(), new QName("http://test",
+ "confidentiality"));
+ assertEquals(calcComponent.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+
+ ComponentService calcComponentService = calcComponent.getServices().get(0);
+ assertEquals(calcComponentService.getName(), "CalculatorService");
+ assertEquals(calcComponentService.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcComponentService.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // TODO test operations
+
+ ComponentReference calcComponentReference = calcComponent.getReferences().get(0);
+ assertEquals(calcComponentReference.getName(), "addService");
+ assertEquals(calcComponentReference.getAutowire(), Boolean.FALSE);
+ assertEquals(calcComponentReference.isWiredByImpl(), false);
+ assertEquals(calcComponentReference.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcComponentReference.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // 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"));
+ assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // TODO test operations
+ Callback calcCallback = calcCompositeReference.getCallback();
+ assertEquals(calcCompositeReference.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ assertNotNull(calcCallback);
+ // TODO test operations
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
new file mode 100644
index 0000000000..111a517552
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.URI;
+import java.net.URL;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultValidationSchemaExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadDocumentTestCase extends TestCase {
+
+ private URLArtifactProcessor<Object> documentProcessor;
+ private ModelResolver resolver;
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
+
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+
+ resolver = new DefaultModelResolver();
+ }
+
+ public void testValidateAssembly() throws Exception {
+
+ SchemaFactory schemaFactory;
+ try {
+ schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ } catch (Error e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ } catch (Exception e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ }
+ Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
+ ValidatorHandler handler = schema.newValidatorHandler();
+
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ URL url = getClass().getResource("Calculator.composite");
+ XMLReader reader = parserFactory.newSAXParser().getXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(url.openStream()));
+
+ }
+
+ public void testValidateImplementation() throws Exception {
+
+ SchemaFactory schemaFactory;
+ try {
+ schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ } catch (Error e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ } catch (Exception e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ }
+ Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
+ ValidatorHandler handler = schema.newValidatorHandler();
+
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ URL url = getClass().getResource("JavaScriptReference.composite");
+ XMLReader reader = parserFactory.newSAXParser().getXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(url.openStream()));
+ }
+
+ public void testReadImplementation() throws Exception {
+
+ ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
+ schemas.addSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd").toString());
+ XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, null);
+ CompositeDocumentProcessor compositeDocumentProcessor = new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, null, null);
+
+ URL url = getClass().getResource("JavaScriptReference.composite");
+ URI uri = URI.create("JavaScriptReference.composite");
+ Composite composite = (Composite)compositeDocumentProcessor.read(null, uri, url);
+ assertNotNull(composite);
+ }
+
+ public void testValidateBinding() throws Exception {
+
+ SchemaFactory schemaFactory;
+ try {
+ schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ } catch (Error e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ } catch (Exception e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ }
+ Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
+ ValidatorHandler handler = schema.newValidatorHandler();
+
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ URL url = getClass().getResource("RMIBindingTest.composite");
+ XMLReader reader = parserFactory.newSAXParser().getXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(url.openStream()));
+ }
+
+ public void testReadBinding() throws Exception {
+
+ ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
+ schemas.addSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd").toString());
+ XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, null);
+ CompositeDocumentProcessor compositeDocumentProcessor = new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, null, null);
+
+ URL url = getClass().getResource("RMIBindingTest.composite");
+ URI uri = URI.create("RMIBindingTest.composite");
+ Composite composite = (Composite)compositeDocumentProcessor.read(null, uri, url);
+ assertNotNull(composite);
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+
+ URL url = getClass().getResource("CalculatorComponent.constrainingType");
+ URI uri = URI.create("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ uri = URI.create("TestAllCalculator.constrainingType");
+ Composite composite = (Composite)documentProcessor.read(null, uri, 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");
+ URI uri = URI.create("Calculator.composite");
+ Composite nestedComposite = (Composite)documentProcessor.read(null, uri, url);
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ uri = URI.create("TestAllCalculator.composite");
+ Composite composite = (Composite)documentProcessor.read(null, uri, url);
+
+ documentProcessor.resolve(composite, resolver);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java
new file mode 100644
index 0000000000..1aede413a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.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.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.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+
+/**
+ * Test reading SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(staxProcessor.read(reader));
+ is.close();
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(staxProcessor.read(reader));
+ is.close();
+
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(staxProcessor.read(reader));
+ is.close();
+
+ }
+
+ public void testReadCompositeAndWireIt() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(staxProcessor.read(reader));
+ is.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java
new file mode 100644
index 0000000000..9b88ad3a3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.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.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+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.Composite;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+
+/**
+ * Test reading SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadWriteAttributeTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+
+ private static final QName ATTRIBUTE = new QName("http://test", "customAttribute");
+
+ private static final String XML = "<?xml version='1.0' encoding='UTF-8'?>"+
+ "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\">"+
+ "<service name=\"CalculatorService\" promote=\"CalculatorServiceComponent\">"+
+ "<interface.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" interface=\"calculator.CalculatorService\" />"+
+ "</service>"+
+ "<component name=\"CalculatorServiceComponent\" customAttribute=\"customValue\">"+
+ "<reference name=\"addService\" target=\"AddServiceComponent\" />"+
+ "<reference name=\"subtractService\" target=\"SubtractServiceComponent\" />"+
+ "<reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" />"+
+ "<reference name=\"divideService\" target=\"DivideServiceComponent\" />"+
+ "</component>"+
+ "<component name=\"AddServiceComponent\" />"+
+ "<component name=\"SubtractServiceComponent\" />"+
+ "<component name=\"MultiplyServiceComponent\" />"+
+ "<component name=\"DivideServiceComponent\" />"+
+ "</composite>";
+
+ @Override
+ public void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ StAXAttributeProcessorExtensionPoint staxAttributeProcessors = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
+ staxAttributeProcessors.addArtifactProcessor(new TestAttributeProcessor());
+
+
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorExtended.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite) staxProcessor.read(reader);
+ assertNotNull(composite);
+ is.close();
+ }
+
+ public void testWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorExtended.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite) staxProcessor.read(reader);
+ assertNotNull(composite);
+ is.close();
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ System.out.println(bos.toString());
+
+ assertEquals(XML, bos.toString());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
new file mode 100644
index 0000000000..32a2d94220
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.assembly.xml;
+
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev: 561254 $ $Date: 2007-07-31 13:16:27 +0530 (Tue, 31 Jul 2007) $
+ */
+public class ResolvePolicyTestCase extends TestCase {
+
+ private URLArtifactProcessor<Object> documentProcessor;
+ private ModelResolver resolver;
+ private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ resolver = new DefaultModelResolver();
+
+ URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
+ policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
+
+ // Create StAX processors
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+
+ URL url = getClass().getResource("CalculatorComponent.constrainingType");
+ URI uri = URI.create("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ uri = URI.create("TestAllCalculator.constrainingType");
+ Composite composite = (Composite)documentProcessor.read(null, uri, url);
+ assertNotNull(composite);
+
+ url = getClass().getResource("test_definitions.xml");
+ uri = URI.create("test_definitions.xml");
+ SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
+ assertNotNull(scaDefns);
+
+ preResolvePolicyTests(composite);
+ documentProcessor.resolve(scaDefns, resolver);
+ documentProcessor.resolve(composite, resolver);
+ postResolvePolicyTests(composite);
+
+ assertEquals(composite.getConstrainingType(), constrainingType);
+ assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+ }
+
+ private void preResolvePolicyTests(Composite composite) {
+ assertNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
+ assertTrue(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
+
+ assertNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+
+ assertNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+
+ assertNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+ }
+
+ private void postResolvePolicyTests(Composite composite) {
+ assertNotNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
+ assertFalse(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+
+ assertNotNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+ assertNotNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+
+ assertNotNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+ assertNotNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+ assertNotNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+
+ assertNotNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+ assertNotNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+
+
+ }
+
+ public void testResolveComposite() throws Exception {
+ URL url = getClass().getResource("Calculator.composite");
+ URI uri = URI.create("Calculator.composite");
+ Composite nestedComposite = (Composite)documentProcessor.read(null, uri, url);
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ uri = URI.create("TestAllCalculator.composite");
+ Composite composite = (Composite)documentProcessor.read(null, uri, url);
+
+ documentProcessor.resolve(composite, resolver);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java
new file mode 100644
index 0000000000..df09a56c38
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.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.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+
+/**
+ * Test resolving SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResolveTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessorExtensionPoint staxProcessors;
+ private ModelResolver resolver;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ resolver = new DefaultModelResolver();
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ StAXArtifactProcessor<ConstrainingType> constrainingTypeReader = staxProcessors.getProcessor(ConstrainingType.class);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = constrainingTypeReader.read(reader);
+ is.close();
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ StAXArtifactProcessor<Composite> compositeReader = staxProcessors.getProcessor(Composite.class);
+ 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");
+ StAXArtifactProcessor<Composite> compositeReader = staxProcessors.getProcessor(Composite.class);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite nestedComposite = compositeReader.read(reader);
+ is.close();
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ 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-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestAttributeProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestAttributeProcessor.java
new file mode 100644
index 0000000000..691145a30e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestAttributeProcessor.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.assembly.xml;
+
+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.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
+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 Policy Processor used for testing.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestAttributeProcessor extends BaseStAXArtifactProcessor implements StAXAttributeProcessor<String> {
+ private static final QName ATTRIBUTE = new QName("http://test", "customAttribute");
+
+ public QName getArtifactType() {
+ return ATTRIBUTE;
+ }
+
+ public String read(QName attributeName, XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ return reader.getAttributeValue(attributeName.getNamespaceURI(), attributeName.getLocalPart());
+ }
+
+ public void write(String value, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ writer.setPrefix(ATTRIBUTE.getPrefix(), ATTRIBUTE.getNamespaceURI());
+ writer.writeAttribute(ATTRIBUTE.getLocalPart(), value);
+ }
+
+ public Class<String> getModelType() {
+ return String.class;
+ }
+
+ public void resolve(String arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestPolicyProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestPolicyProcessor.java
new file mode 100644
index 0000000000..16cefc58cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestPolicyProcessor.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.assembly.xml;
+
+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.sca.policy.Policy;
+
+/**
+ * A Policy Processor used for testing.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestPolicyProcessor implements StAXArtifactProcessor<Policy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
+ return new MockPolicyImplOne();
+ }
+
+ public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<Policy> getModelType() {
+ return Policy.class;
+ }
+
+ public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
+ }
+
+
+ public class MockPolicyImplOne implements Policy {
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestReadWriteUnkonwnElement.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestReadWriteUnkonwnElement.java
new file mode 100644
index 0000000000..3c1d9ba88e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestReadWriteUnkonwnElement.java
@@ -0,0 +1,60 @@
+package org.apache.tuscany.sca.assembly.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.Iterator;
+
+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.Composite;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.junit.Test;
+import org.w3c.dom.Document;
+
+public class TestReadWriteUnkonwnElement extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ String XML = "<?xml version='1.0' encoding='UTF-8'?><composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\"><service name=\"CalculatorService\" promote=\"CalculatorServiceComponent\"><interface.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" interface=\"calculator.CalculatorService\" /></service><component name=\"CalculatorServiceComponent\"><reference name=\"addService\" target=\"AddServiceComponent\" /><reference name=\"subtractService\" target=\"SubtractServiceComponent\" /><reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" /><reference name=\"divideService\" target=\"DivideServiceComponent\" /></component><component name=\"AddServiceComponent\" /><component name=\"SubtractServiceComponent\" /><component name=\"MultiplyServiceComponent\" /><component name=\"DivideServiceComponent\" /><x:unknownElement xmlns:x=\"http://x\" uknAttr=\"attribute1\"><x:subUnknownElement1 uknAttr1=\"attribute1\" /><x:subUnknownElement2 /></x:unknownElement></composite>";
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testReadWriteComposite() throws Exception{
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+ assertNotNull(composite);
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ System.out.println(bos.toString());
+ assertEquals(XML,bos.toString());
+ bos.close();
+
+ is.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java
new file mode 100644
index 0000000000..c423df6f7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.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.assembly.xml;
+
+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 class TestSCABindingFactoryImpl implements SCABindingFactory {
+ public SCABinding createSCABinding() {
+ return new TestSCABindingImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
new file mode 100644
index 0000000000..af25109de1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.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.assembly.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * A test cheel for the SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestSCABindingImpl implements SCABinding, OptimizableBinding, PolicySetAttachPoint, OperationsConfigurator {
+ private String name;
+ private String uri;
+ private List<Object> extensions = new ArrayList<Object>();
+
+ private Component targetComponent;
+ private ComponentService targetComponentService;
+ private Binding targetBinding;
+
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType bindingType = new TestSCABindingType();
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ /**
+ * Constructs a new SCA binding.
+ */
+ protected TestSCABindingImpl() {
+ }
+
+ 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<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ /**
+ * @return the targetComponent
+ */
+ public Component getTargetComponent() {
+ return targetComponent;
+ }
+
+ /**
+ * @param targetComponent the targetComponent to set
+ */
+ public void setTargetComponent(Component targetComponent) {
+ this.targetComponent = targetComponent;
+ }
+
+ /**
+ * @return the targetComponentService
+ */
+ public ComponentService getTargetComponentService() {
+ return targetComponentService;
+ }
+
+ /**
+ * @param targetComponentService the targetComponentService to set
+ */
+ public void setTargetComponentService(ComponentService targetComponentService) {
+ this.targetComponentService = targetComponentService;
+ }
+
+ /**
+ * @return the targetBinding
+ */
+ public Binding getTargetBinding() {
+ return targetBinding;
+ }
+
+ /**
+ * @param targetBinding the targetBinding to set
+ */
+ public void setTargetBinding(Binding targetBinding) {
+ this.targetBinding = targetBinding;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // TODO Auto-generated method stub
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // TODO Auto-generated method stub
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ // TODO Auto-generated method stub
+ return bindingType;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.bindingType = type;
+ }
+
+ private class TestSCABindingType implements IntentAttachPointType {
+ private QName name = new QName("http://www.osoa.org/xmlns/sca/1.0","binding");
+
+ public List<Intent> getAlwaysProvidedIntents() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<Intent> getMayProvideIntents() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public boolean isUnresolved() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setName(QName type) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
+ this.configuredOperations = configuredOperations;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
new file mode 100644
index 0000000000..76361d4b70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.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.assembly.xml;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+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.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Test the wiring of SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private ModelResolver resolver;
+ private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
+ private CompositeBuilder compositeBuilder;
+ private Monitor monitor;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+ resolver = new DefaultModelResolver();
+
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ monitor = monitorFactory.createMonitor();
+
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ SCABindingFactory scaBindingFactory = new TestSCABindingFactoryImpl();
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, monitor);
+
+ URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(reader);
+ is.close();
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+ is.close();
+ assertNotNull(composite);
+
+ URL url = getClass().getResource("test_definitions.xml");
+ URI uri = URI.create("test_definitions.xml");
+ SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
+ assertNotNull(scaDefns);
+
+ policyDefinitionsProcessor.resolve(scaDefns, resolver);
+
+ staxProcessor.resolve(composite, resolver);
+ compositeBuilder.build(composite);
+
+ assertEquals(composite.getConstrainingType(), constrainingType);
+ assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+ }
+
+ public void testResolveComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite nestedComposite = (Composite)staxProcessor.read(reader);
+ is.close();
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+ is.close();
+
+ URL url = getClass().getResource("test_definitions.xml");
+ URI uri = URI.create("test_definitions.xml");
+ SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
+ assertNotNull(scaDefns);
+
+ policyDefinitionsProcessor.resolve(scaDefns, resolver);
+
+ staxProcessor.resolve(composite, resolver);
+ compositeBuilder.build(composite);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
new file mode 100644
index 0000000000..b859779437
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.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.assembly.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+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.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Test writing SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteAllTestCase extends TestCase {
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private ModelResolver resolver;
+ private CompositeBuilder compositeBuilder;
+ private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
+ private Monitor monitor;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ outputFactory = XMLOutputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
+ resolver = new DefaultModelResolver();
+
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ SCABindingFactory scaBindingFactory = new TestSCABindingFactoryImpl();
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ monitor = monitorFactory.createMonitor();
+
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, monitor);
+
+ URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+
+ verifyComposite(composite);
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ bos.close();
+
+ ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+ composite = staxProcessor.read(bis, Composite.class);
+
+ verifyComposite(composite);
+
+ }
+
+ public void testReadWireWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+
+ URL url = getClass().getResource("test_definitions.xml");
+ URI uri = URI.create("test_definitions.xml");
+ SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
+ assertNotNull(scaDefns);
+ policyDefinitionsProcessor.resolve(scaDefns, resolver);
+
+ staxProcessor.resolve(composite, resolver);
+ compositeBuilder.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);
+ }
+
+ private void verifyComposite(Composite composite) {
+ assertEquals(composite.getProperties().get(0).getName(),"prop1");
+ assertEquals(composite.getProperties().get(0).isMany(), true);
+ assertEquals(composite.getProperties().get(1).getName(),"prop2");
+ assertEquals(composite.getProperties().get(1).isMustSupply(), true);
+ assertEquals(composite.getProperties().get(0).getXSDType(), new QName("http://foo", "MyComplexType"));
+ assertEquals(composite.getProperties().get(1).getXSDElement(), new QName("http://www.osoa.org/xmlns/sca/1.0", "MyComplexPropertyValue1"));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java
new file mode 100644
index 0000000000..5188b1c91a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.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.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+
+/**
+ * Test writing SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteNamespacesTestCase extends TestCase {
+ private StAXArtifactProcessor<Composite> compositeProcessor;
+ private XMLOutputFactory outputFactory;
+ private XMLInputFactory inputFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ //outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+ inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+
+ StAXArtifactProcessorExtensionPoint artifactProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ compositeProcessor = artifactProcessors.getProcessor(Composite.class);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+
+ // Read
+ InputStream is = getClass().getResourceAsStream("NestedCalculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ Component component = composite.getComponents().get(0);
+ Composite implementation = (Composite)component.getImplementation();
+ QName qname = implementation.getName();
+
+ // Write
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
+ compositeProcessor.write(composite, writer);
+ System.out.println(bos);
+
+ // Read again
+ is = new ByteArrayInputStream(bos.toByteArray());
+ reader = inputFactory.createXMLStreamReader(is);
+ composite = compositeProcessor.read(reader);
+
+ // Compare
+ component = composite.getComponents().get(0);
+ implementation = (Composite)component.getImplementation();
+ assertEquals(qname, implementation.getName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
new file mode 100644
index 0000000000..85f6a39243
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:x="http://x"
+ 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>
+
+ <x:unknownElement uknAttr="attribute1">
+ <x:subUnknownElement1 uknAttr1="attribute1"/>
+ <x:subUnknownElement2/>
+ </x:unknownElement>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorExtended.composite b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorExtended.composite
new file mode 100644
index 0000000000..3c69d0ed67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorExtended.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:calc="http://calc"
+ xmlns:test="http://test"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent" test:customAttribute="customValue">
+ <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-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite
new file mode 100644
index 0000000000..a313dd1e6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/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"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JavaScriptReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ </component>
+
+ <component name="ReferenceComponent">
+ <tuscany: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-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/NestedCalculator.composite b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/NestedCalculator.composite
new file mode 100644
index 0000000000..2719ee9162
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/NestedCalculator.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:calc="http://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.composite xmlns:n="http://inner" name="n:InnerCalculator"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite
new file mode 100644
index 0000000000..d29fe85586
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.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"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="HelloWorldRmiComposite">
+
+ <service name="HelloWorldRmiService" promote="HelloWorldServiceComponent">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" />
+ </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"/>
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
new file mode 100644
index 0000000000..5091ff700b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:SecureReliablePolicy"
+ 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:ext="http://extension"
+ xmlns:cns="http://test" xmlns:sns="http://test">
+
+ <include name="tns:TestAllDivide"/>
+ <ext:testExtension/>
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent/CalculatorService" requires="cns:confidentiality"
+ policySets="sns:SecureReliablePolicy">
+ <ext:testExtension/>
+ <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+ <operation name="add" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+
+ <binding.ws name="CalculatorWS" policySets="sns:SecureReliablePolicy" port="" requires="cns:confidentiality" uri="http://calc/ws">
+ <operation name="add" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+ </binding.ws>
+
+ <callback policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+ <ext:testExtension/>
+ <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+ <operation name="addCallback" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+ </binding.ws>
+ </callback>
+ </service>
+
+ <component name="CalculatorServiceComponent" autowire="false" constrainingType="tns:CalculatorComponent"
+ policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+ <ext:testExtension/>
+ <service name="CalculatorService" policySets="sns:SecureReliablePolicy" 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:SecureReliablePolicy" requires="cns:confidentiality" wiredByImpl="false">
+ <ext:testExtension/>
+ <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:SecureReliablePolicy"
+ requires="cns:confidentiality">
+ <interface.java interface="calculator.MultiplyService" callbackInterface="calculator.MultiplyCallback" />
+ <operation name="multiply" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+
+ <binding.ws name="MultiplyWS" port="" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" uri="http://calc/ws">
+ <operation name="multiply" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+ </binding.ws>
+
+ <callback policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+ <binding.ws name="MultiplyCallbackWS" port="" uri="http://calc/callback/ws" policySets="sns:SecureReliablePolicy"
+ requires="cns:confidentiality">
+ <operation name="multiplyCallback" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+ </binding.ws>
+ </callback>
+ </reference>
+
+ <property name="prop1" xmlns:foo="http://foo" many="true" type="foo:MyComplexType">
+ <ext:testExtension/>
+ <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>
+
+ <property name="prop2" xmlns:foo="http://foo" mustSupply="true" element="MyComplexPropertyValue1"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite
new file mode 100644
index 0000000000..d59e69209d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 name="tns:CompleteDivide"/>
+
+ <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-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite
new file mode 100644
index 0000000000..7bc7ccdb83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite autowire="false" constrainingType="tns:CalculatorComponent" local="true" name="TestAllCalculator"
+ requires="cns:tuscanyIntent_1" 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:ext="http://extension"
+ xmlns:cns="http://test" xmlns:sns="http://test">
+
+ <include name="tns:TestAllDivide"/>
+ <ext:testExtension/>
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent/CalculatorService" requires="cns:tuscanyIntent_2 cns:tuscanyIntent_1">
+ <ext:testExtension/>
+ <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+ <operation name="add" requires="cns:tuscanyIntent_6"/>
+
+ <binding.ws name="CalculatorWS" port="" requires="cns:tuscanyIntent_3" uri="http://calc/ws">
+ </binding.ws>
+
+ <callback requires="cns:tuscanyIntent_4">
+ <ext:testExtension/>
+ <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="cns:tuscanyIntent_5" uri="http://calc/callback/ws">
+ </binding.ws>
+ </callback>
+ </service>
+
+ <component name="CalculatorServiceComponent" autowire="false" constrainingType="tns:CalculatorComponent"
+ requires="cns:tuscanyIntent_2 cns:tuscanyIntent_3">
+ <ext:testExtension/>
+ <service name="CalculatorService" requires="cns:tuscanyIntent_3">
+ <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+ <operation name="add" requires="cns:tuscanyIntent_6 cns:tuscanyIntent_7"/>
+ <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="cns:tuscanyIntent_4" uri="http://calc/callback/ws">
+ </binding.ws>
+ <callback>
+ </callback>
+ </service>
+
+ <reference name="addService" target="AddServiceComponent/AddService" autowire="false" multiplicity="1..1"
+ requires="cns:tuscanyIntent_3 cns:tuscanyIntent_2.qualified" wiredByImpl="false">
+ <ext:testExtension/>
+ <interface.java interface="calculator.AddService" callbackInterface="calculator.AddCallback" />
+ <operation name="add" requires="cns:tuscanyIntent_8 cns:tuscanyIntent_9"/>
+ <binding.ws name="addServiceWSRef" policySets="" port="" requires="cns:tuscanyIntent_4" uri="http://calc/callback/ws">
+ </binding.ws>
+ </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="cns:tuscanyIntent_4" />
+ </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"
+ requires="cns:tuscanyIntent_2">
+ <interface.java interface="calculator.MultiplyService" callbackInterface="calculator.MultiplyCallback" />
+ <operation name="multiply" requires="cns:tuscanyIntent_6"/>
+
+ <binding.ws name="MultiplyWS" port="" requires="cns:tuscanyIntent_3" uri="http://calc/ws">
+ </binding.ws>
+
+ <callback policySets="sns:SecureReliablePolicy" requires="cns:tuscanyIntent_3">
+ <binding.ws name="MultiplyCallbackWS" port="" uri="http://calc/callback/ws"
+ requires="cns:tuscanyIntent_4">
+ </binding.ws>
+ </callback>
+ </reference>
+
+ <property name="prop1" xmlns:foo="http://foo">
+ <ext:testExtension/>
+ <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-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml
new file mode 100644
index 0000000000..bcc8c54dc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml
@@ -0,0 +1,97 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- simple intent -->
+ <sca:intent name="tuscanyIntent_1"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_2"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_3"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_4"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+<sca:intent name="tuscanyIntent_5"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_6"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_7"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_8"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_9"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_10"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+ <!-- qualified intents -->
+ <sca:intent name="tuscanyIntent_1.qualified" />
+ <sca:intent name="tuscanyIntent_2.qualified" />
+</sca:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml
new file mode 100644
index 0000000000..b79cb6b7b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml
@@ -0,0 +1,175 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <!-- qualified intents -->
+ <sca:intent name="confidentiality.transport" />
+ <sca:intent name="confidentiality.message" />
+ <sca:intent name="confidentiality.message.whole" />
+ <sca:intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <sca:policySet name="SecureReliablePolicy"
+ provides="confidentiality.transport integrity"
+ appliesTo="//sca:binding.ws | //sca:binding.sca"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </sca:policySet>
+
+ <sca:policySet name="SecureMessagingPolicies"
+ provides="confidentiality"
+ appliesTo="//sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "transport" alternative -->
+ </wsp:Policy>
+ <wsp:Policy>...</wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "message" alternative" -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="SecurityPolicy" provides="confidentiality"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <sca:intentMap provides="confidentiality" default="message">
+ <sca:qualifier name="message">
+ <sca:intentMap provides="message" default="whole">
+ <sca:qualifier name="body">
+ <wsp:Policy>
+ <!-- policy attachment for body encryption -->
+ </wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="whole">
+ <wsp:Policy>
+ <!-- policy attachment for whole message encryption -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:qualifier>
+ <sca:qualifier name="transport">
+ <wsp:Policy>
+ <!-- policy attachment for transport encryption -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="BasicAuthMsgProtSecurity"
+ provides="authentication confidentiality"
+ appliesTo="//sca:binding.ws"
+ xmlns="http://test">
+ <sca:policySetReference name="AuthenticationPolicies"/>
+ <sca:policySetReference name="ConfidentialityPolicies"/>
+</sca:policySet>
+
+<sca:policySet name="AuthenticationPolicies"
+ provides="authentication"
+ appliesTo="//sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</sca:policySet>
+
+<sca:policySet name="ConfidentialityPolicies"
+ provides="confidentiality"
+ bindings="binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:Policy>
+ <wsp:Policy>...</wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<!-- profile intent -->
+ <sca:intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="messageProtection">
+ <sca:description>
+ Protect messages from unauthorized reading or modification
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="messageProtection"
+ constrains="sca:binding"
+ requires="confidentiality integrity">
+ <sca:description>
+ Protect messages from unauthorized reading or modification
+ </sca:description>
+ </sca:intent>
+
+<!-- simple intent -->
+ <sca:intent name="confidentiality"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="integrity"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="authentication"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding required
+ Authentication.
+ </sca:description>
+ </sca:intent>
+
+</sca:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/LICENSE b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/LICENSE
new file mode 100644
index 0000000000..bfded7c6a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/LICENSE
@@ -0,0 +1,244 @@
+
+ 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 includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface Definition files and XSD files.
+
+Permission to copy, make derivative works of, and distribute the Service Component Architecture
+JavaDoc, Interface Definition Files and XSD files in any medium without fee or royalty as part
+of a compliant implementation of the Service Component Architecture Specification is hereby granted.
+The Service Components Architecture Specification may be found at the following location:
+
+ http://www.osoa.org/download/attachments/35/SCA_AssemblyModel_V100.pdf
+
+THE SERVICE COMPONENT ARCHITECTURE SPECIFICATION AND THE JAVADOC, INTERFACE DEFINITION FILES AND XSD FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC, INTERFACE DEFINITION FILES AND XSD 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 COMPONENT ARCHITECTURE SPECIFICATION OR THE JAVADOC, INTERFACE DEFINTION FILES OR XSD 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 Component Architecture Specification and the
+JavaDoc, Interface Definition Files and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+===============================================================================
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/META-INF/README b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/NOTICE b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/NOTICE
new file mode 100644
index 0000000000..6dcfe88195
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/NOTICE
@@ -0,0 +1,12 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product also includes software under the SCA Collaboration license
+(see the LICENSE file contained in this distribution), with the following
+copyright:
+
+(c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/pom.xml b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/pom.xml
new file mode 100644
index 0000000000..90bb93222d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <name>Apache Tuscany SCA Assembly Model XML Schemas</name>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.assembly.xsd</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..69b2701e30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -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.
+#
+tuscany-sca.xsd \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-all.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-all.xsd
new file mode 100644
index 0000000000..82899ed8ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-all.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.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <include schemaLocation="sca.xsd"/>
+
+ <include schemaLocation="sca-binding-ejb.xsd"/>
+
+ <include schemaLocation="sca-implementation-bpel.xsd"/>
+ <include schemaLocation="sca-implementation-spring.xsd"/>
+ <include schemaLocation="sca-implementation-ejb.xsd"/>
+ <include schemaLocation="sca-implementation-web.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd
new file mode 100644
index 0000000000..26bedfcce5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ejb" type="sca:EJBSessionBeanBinding"
+ substitutionGroup="sca:binding" />
+
+ <simpleType name="BeanType">
+ <restriction base="string">
+ <enumeration value="stateless"/>
+ <enumeration value="stateful"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="VersionValue">
+ <restriction base="string">
+ <enumeration value="EJB2"/>
+ <enumeration value="EJB3"/>
+ </restriction>
+ </simpleType>
+
+
+ <complexType name="EJBSessionBeanBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="homeInterface" type="NCName" use="optional"/>
+ <attribute name="ejb-link-name" type="NCName" use="optional"/>
+ <attribute name="session-type" type="sca:BeanType" use="optional" default="stateless"/>
+ <attribute name="ejb-version" type="sca:VersionValue" use="optional" default="EJB2"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd
new file mode 100644
index 0000000000..6f64453635
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <complexType name="JMSBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <element name="destination" type="sca:Destination" minOccurs="0"/>
+ <element name="connectionFactory" type="sca:ConnectionFactory"
+ minOccurs="0"/>
+ <element name="activationSpec" type="sca:ActivationSpec"
+ minOccurs="0"/>
+ <element name="response" type="sca:Response" minOccurs="0"/>
+ <element name="headers" type="sca:Headers" minOccurs="0"/>
+ <element name="resourceAdapter" type="sca:ResourceAdapter"
+ minOccurs="0"/>
+ <element name="operationProperties" type="sca:OperationProperties"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="correlationScheme"
+ default="RequestMsgIDToCorrelID">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="RequestMsgIDToCorrelID"/>
+ <enumeration value="RequestCorrelIDToCorrelID"/>
+ <enumeration value="None"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+
+ <attribute name="initialContextFactory" type="anyURI"/>
+ <attribute name="jndiURL" type="anyURI"/>
+ <attribute name="requestConnection" type="QName"/>
+ <attribute name="responseConnection" type="QName"/>
+ <attribute name="operationProperties" type="QName"/>
+ <anyAttribute/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="CreateResource">
+ <restriction base="string">
+ <enumeration value="always"/>
+ <enumeration value="never"/>
+ <enumeration value="ifnotexist"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="Destination">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="type" use="optional" default="queue">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="queue"/>
+ <enumeration value="topic"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="ConnectionFactory">
+ <sequence> <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="ActivationSpec">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="Response">
+ <sequence>
+ <element name="destination" type="sca:Destination" minOccurs="0"/>
+ <element name="connectionFactory" type="sca:ConnectionFactory"
+ minOccurs="0"/>
+ <element name="activationSpec" type="sca:ActivationSpec" minOccurs="0"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="Headers">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="JMSType" type="string"/>
+ <attribute name="JMSCorrelationID" type="string"/>
+ <attribute name="JMSDeliveryMode" type="string"/>
+ <attribute name="JMSTimeToLive" type="int"/>
+ <attribute name="JMSPriority" type="string"/>
+ </complexType>
+
+ <complexType name="SubscriptionHeaders">
+ <attribute name="JMSSelector" type="string"/>
+ </complexType>
+
+ <complexType name="ResourceAdapter">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="string" use="required"/>
+ </complexType>
+
+ <complexType name="OperationProperties">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <element name="headers" type="sca:Headers"/>
+ </sequence>
+ <attribute name="name" type="string" use="required"/>
+ <attribute name="nativeOperation" type="string"/>
+ </complexType>
+
+ <element name="binding.jms" type="sca:JMSBinding"
+ substitutionGroup="sca:binding"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd
new file mode 100644
index 0000000000..02703402ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.sca" type="sca:SCABinding"
+ substitutionGroup="sca:binding"/>
+ <complexType name="SCABinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd
new file mode 100644
index 0000000000..3e92de193b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ xmlns:wsa="http://www.w3.org/2004/12/addressing"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ws" type="sca:WebServiceBinding"
+ substitutionGroup="sca:binding"/>
+ <complexType name="WebServiceBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="wsdlElement" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-contributions.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-contributions.xsd
new file mode 100644
index 0000000000..a22d8ac075
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-contributions.xsd
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="contribution" type="sca:ContributionType"/>
+ <complexType name="ContributionType">
+ <sequence>
+ <element name="deployable" type="sca:DeployableType" minOccurs="1" maxOccurs="unbounded"/>
+ <element name="import" type="sca:ImportType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="export" type="sca:ExportType" minOccurs="0" maxOccurs="unbounded"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##other" processContents="lax"/>
+ </complexType>
+
+ <complexType name="DeployableType">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="composite" type="QName" use="required"/>
+ <anyAttribute namespace="##other" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ImportType">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="namespace" type="string" use="required"/>
+ <attribute name="location" type="anyURI" use="required"/>
+ <anyAttribute namespace="##other" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ExportType">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="namespace" type="string" use="required"/>
+ <anyAttribute namespace="##other" processContents="lax"/>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-core.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-core.xsd
new file mode 100644
index 0000000000..a7ca0433f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-core.xsd
@@ -0,0 +1,348 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="sca:implementation"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService" />
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:Property"/>
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="composite" type="sca:Composite"/>
+ <complexType name="Composite">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="include" type="sca:Include"/>
+ <element name="service" type="sca:Service"/>
+ <element name="property" type="sca:Property"/>
+ <element name="component" type="sca:Component"/>
+ <element name="reference" type="sca:Reference"/>
+ <element name="wire" type="sca:Wire"/>
+ <!-- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> -->
+ </choice>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="targetNamespace" type="anyURI" use="optional"/>
+ <attribute name="local" type="boolean" use="optional" default="false"/>
+ <attribute name="autowire" type="boolean" use="optional" default="false"/>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="promote" type="anyURI" use="required" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <element name="interface" type="sca:Interface" abstract="true" />
+ <complexType name="Interface" abstract="true"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax" />
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
+ <attribute name="wiredByImpl" type="boolean" use="optional" default="false"/>
+ <attribute name="multiplicity" type="sca:Multiplicity"
+ use="optional" default="1..1" />
+ <attribute name="promote" type="sca:listOfAnyURIs" use="required" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <complexType name="SCAPropertyBase" mixed="true">
+ <!-- mixed="true" to handle simple type -->
+ <sequence>
+ <any namespace="##any" processContents="lax" minOccurs="0"
+ maxOccurs="1" />
+ <!-- NOT an extension point; This xsd:any exists to accept
+ the element-based or complex type property
+ i.e. no element-based extension point under "sca:property" -->
+ </sequence>
+ </complexType>
+
+ <!-- complex type for sca:property declaration -->
+ <complexType name="Property" mixed="true">
+ <complexContent>
+ <extension base="sca:SCAPropertyBase">
+ <!-- extension defines the place to hold default value -->
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="optional"/>
+ <attribute name="element" type="QName" use="optional"/>
+ <attribute name="many" type="boolean" default="false"
+ use="optional"/>
+ <attribute name="noDefault" type="boolean" default="false"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ <!-- an extension point ; attribute-based only -->
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="PropertyValue" mixed="true">
+ <complexContent>
+ <extension base="sca:SCAPropertyBase">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="optional"/>
+ <attribute name="element" type="QName" use="optional"/>
+ <attribute name="many" type="boolean" default="false"
+ use="optional"/>
+ <attribute name="source" type="string" use="optional"/>
+ <attribute name="file" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ <!-- an extension point ; attribute-based only -->
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="binding" type="sca:Binding" abstract="true"/>
+ <complexType name="Binding" abstract="true">
+ <sequence>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <attribute name="name" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ </complexType>
+
+ <element name="bindingType" type="sca:BindingType"/>
+ <complexType name="BindingType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax" />
+ </sequence>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="callback" type="sca:Callback"/>
+ <complexType name="Callback">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Component">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="sca:implementation"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService"/>
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:PropertyValue" />
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="autowire" type="boolean" use="optional" default="false"/>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ComponentService">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1"/>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1"/>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="requires" type="sca:listOfQNames"
+ use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ComponentReference">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax" />
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
+ <attribute name="multiplicity" type="sca:Multiplicity"
+ use="optional" default="1..1" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <element name="implementation" type="sca:Implementation"
+ abstract="true" />
+ <complexType name="Implementation" abstract="true">
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ </complexType>
+
+ <element name="implementationType" type="sca:ImplementationType"/>
+ <complexType name="ImplementationType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax" />
+ </sequence>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Wire">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="source" type="anyURI" use="required"/>
+ <attribute name="target" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="include" type="sca:Include"/>
+ <complexType name="Include">
+ <attribute name="name" type="QName"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Operation">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="constrainingType" type="sca:ConstrainingType"/>
+ <complexType name="ConstrainingType">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService"/>
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:Property" />
+ </choice>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="targetNamespace" type="anyURI"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <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>
+
+ <!-- Global attribute definition for @requires to permit use of intents
+ within WSDL documents -->
+ <attribute name="requires" type="sca:listOfQNames"/>
+
+ <!-- Global attribute defintion for @endsConversation to mark operations
+ as ending a conversation -->
+ <attribute name="endsConversation" type="boolean" default="false"/>
+
+ <simpleType name="listOfQNames">
+ <list itemType="QName"/>
+ </simpleType>
+
+ <simpleType name="listOfAnyURIs">
+ <list itemType="anyURI"/>
+ </simpleType>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-definitions.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-definitions.xsd
new file mode 100644
index 0000000000..0249882a92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-definitions.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+ <include schemaLocation="sca-policy.xsd"/>
+
+ <element name="definitions">
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:intent"/>
+ <element ref="sca:policySet"/>
+ <element ref="sca:binding"/>
+ <element ref="sca:bindingType"/>
+ <element ref="sca:implementationType"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="targetNamespace" type="anyURI" use="optional"/>
+ </complexType>
+ </element>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd
new file mode 100644
index 0000000000..87b443fb36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<xsd:schema xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <xsd:include schemaLocation="sca-core.xsd" />
+
+ <xsd:element name="implementation.bpel" type="BpelImplementation"
+ substitutionGroup="implementation" />
+
+ <xsd:complexType name="BpelImplementation">
+ <xsd:complexContent>
+ <xsd:extension base="Implementation">
+ <xsd:sequence>
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="process" type="xsd:QName" use="required" />
+ <xsd:anyAttribute namespace="##any" processContents="lax" />
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:element name="interface.partnerLinkType" type="BpelPartnerLinkType"
+ substitutionGroup="interface" />
+
+ <xsd:complexType name="BpelPartnerLinkType">
+ <xsd:complexContent>
+ <xsd:extension base="Interface">
+ <xsd:sequence>
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:QName" use="required" />
+ <xsd:attribute name="serviceRole" type="xsd:NCName" use="optional" />
+ <xsd:anyAttribute namespace="##any" processContents="lax" />
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd
new file mode 100644
index 0000000000..99669bc672
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+ <element name="implementation.composite" type="sca:SCAImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="SCAImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="QName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd
new file mode 100644
index 0000000000..6f1cf14a4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.cpp" type="sca:CPPImplementation" substitutionGroup="sca:implementation" />
+ <complexType name="CPPImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <element name="method" type="sca:CPPImplementationMethod" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="library" type="NCName" use="required"/>
+ <attribute name="header" type="NCName" use="required"/>
+ <attribute name="path" type="NCName" use="optional"/>
+ <attribute name="class" type="Name" use="optional"/>
+ <attribute name="scope" type="sca:CPPImplementationScope" use="optional"/>
+ <attribute name="eagerInit" type="boolean" use="optional"/>
+ <attribute name="allowsPassByReference" type="boolean" use="optional"/>
+ <attribute name="conversationMaxAge" type="string" use="optional"/>
+ <attribute name="conversationMaxIdle" type="string" use="optional"/>
+ <attribute name="conversationSinglePrincipal" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="CPPImplementationScope">
+ <restriction base="string">
+ <enumeration value="stateless"/>
+ <enumeration value="composite"/>
+ <enumeration value="request"/>
+ <enumeration value="converstion"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="CPPImplementationMethod">
+ <complexContent>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="allowsPassByReference" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexContent>
+ </complexType>
+
+</schema>
+
+
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd
new file mode 100644
index 0000000000..a7e781b18f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.ejb" type="sca:EJBImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="EJBImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <!-- we might want to make this refer to the JEE ejb-link type -->
+ <attribute name="ejb-link" type="token" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd
new file mode 100644
index 0000000000..f9d8171b8e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.java" type="sca:JavaImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="JavaImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd
new file mode 100644
index 0000000000..1cf9fb3ea9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.spring" type="sca:SpringImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="SpringImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-web.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-web.xsd
new file mode 100644
index 0000000000..a1adf10fd9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-implementation-web.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.web" type="sca:WebImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="WebImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="web-uri" type="string" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd
new file mode 100644
index 0000000000..44f14e5ed5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/1.0/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/1.0/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.cpp" type="sca:CPPInterface" substitutionGroup="sca:interface"/>
+
+ <complexType name="CPPInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <element name="method" type="sca:CPPMethod" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="header" type="NCName" use="required"/>
+ <attribute name="class" type="Name" use="required"/>
+ <attribute name="callbackHeader" type="NCName" use="optional"/>
+ <attribute name="callbackClass" type="Name" use="optional"/>
+ <attribute name="remotable" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="CPPMethod">
+ <complexContent>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="oneWay" type="boolean" use="optional"/>
+ <attribute name="endConversation" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexContent>
+ </complexType>
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd
new file mode 100644
index 0000000000..81f939bdb4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.java" type="sca:JavaInterface" substitutionGroup="sca:interface"/>
+ <complexType name="JavaInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="NCName" use="required"/>
+ <attribute name="callbackInterface" type="NCName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd
new file mode 100644
index 0000000000..c1fdfd8f3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.wsdl" type="sca:WSDLPortType" substitutionGroup="sca:interface"/>
+ <complexType name="WSDLPortType">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="anyURI" use="required"/>
+ <attribute name="callbackInterface" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-policy.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-policy.xsd
new file mode 100644
index 0000000000..2c4875f36c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca-policy.xsd
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="intent" type="sca:Intent"/>
+ <complexType name="Intent">
+ <sequence>
+ <element name="description" type="string" minOccurs="0" maxOccurs="1" />
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="QName" use="required"/>
+ <attribute name="constrains" type="sca:listOfQNames" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="excludes" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="policySet" type="sca:PolicySet"/>
+ <complexType name="PolicySet">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="policySetReference" type="sca:PolicySetReference"/>
+ <element name="intentMap" type="sca:IntentMap"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="name" type="QName" use="required"/>
+ <attribute name="provides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="appliesTo" type="string" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="PolicySetReference">
+ <attribute name="name" type="QName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="IntentMap">
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element name="qualifier" type="sca:Qualifier"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="provides" type="QName" use="required"/>
+ <attribute name="default" type="string" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Qualifier">
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element name="intentMap" type="sca:IntentMap"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="name" type="string" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="allow" type="sca:Allow"/>
+ <complexType name="Allow">
+ <attribute name="roles" type="string" use="required"/>
+ </complexType>
+
+ <element name="permitAll" type="sca:PermitAll"/>
+ <complexType name="PermitAll"/>
+
+ <element name="denyAll" type="sca:DenyAll"/>
+ <complexType name="DenyAll"/>
+
+ <element name="runAs" type="sca:RunAs"/>
+ <complexType name="RunAs">
+ <attribute name="role" type="string" use="required"/>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca.xsd
new file mode 100644
index 0000000000..88edad794c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/sca.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <include schemaLocation="sca-interface-java.xsd"/>
+ <include schemaLocation="sca-interface-wsdl.xsd"/>
+
+ <include schemaLocation="sca-implementation-java.xsd"/>
+ <include schemaLocation="sca-implementation-composite.xsd"/>
+
+ <include schemaLocation="sca-binding-webservice.xsd"/>
+ <include schemaLocation="sca-binding-jms.xsd"/>
+ <include schemaLocation="sca-binding-sca.xsd"/>
+
+ <include schemaLocation="sca-contributions.xsd"/>
+
+ <include schemaLocation="sca-definitions.xsd"/>
+ <include schemaLocation="sca-policy.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd
new file mode 100644
index 0000000000..c93a1d72de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.atom" type="t:AtomBinding"/>
+
+ <complexType name="AtomBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="title" type="string" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd
new file mode 100644
index 0000000000..d0da5421ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.dwr" type="t:DWRBinding"/>
+
+ <complexType name="DWRBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd
new file mode 100644
index 0000000000..ff48b97d7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.http" type="t:HTTPBinding"/>
+
+ <complexType name="HTTPBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd
new file mode 100644
index 0000000000..7c79738898
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.jsonrpc" type="t:JSONRPCBinding"/>
+
+ <complexType name="JSONRPCBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd
new file mode 100644
index 0000000000..6d5468b2f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.notification" type="t:NotificationBinding"/>
+
+ <complexType name="NotificationBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="ntm" type="anyURI" use="optional"/>
+ <attribute name="notificationType" type="anyURI" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd
new file mode 100644
index 0000000000..2697a1ea98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.rmi" type="t:RMIBinding"/>
+
+ <complexType name="RMIBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="host" type="anyURI" use="optional"/>
+ <attribute name="port" type="int" use="optional"/>
+ <attribute name="serviceName" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd
new file mode 100644
index 0000000000..821f323d73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.rss" type="t:RSSBinding"/>
+
+ <complexType name="RSSBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="title" type="string" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-data-helper.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-data-helper.xsd
new file mode 100644
index 0000000000..4331da0439
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-data-helper.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://data.tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:data="http://data.tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <complexType name="ConnectionProperties">
+ <attribute name="driverClass" type="string" />
+ <attribute name="databaseURL" type="string" />
+ <attribute name="userName" type="string" default="" />
+ <attribute name="password" type="string" default="" />
+ <attribute name="loginTimeout" type="int" default="0" />
+ </complexType>
+
+ <complexType name="ConnectionInfo">
+ <sequence>
+ <element maxOccurs="1" minOccurs="0"
+ name="ConnectionProperties" type="data:ConnectionProperties" />
+ </sequence>
+ <attribute name="dataSource" type="string" />
+ <attribute name="managedtx" type="boolean"
+ default="true" />
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-das.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-das.xsd
new file mode 100644
index 0000000000..1f6f9abb16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-das.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:data="http://data.tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+ <import namespace="http://data.tuscany.apache.org/xmlns/sca/1.0" schemaLocation="tuscany-sca-data-helper.xsd"/>
+
+ <element name="implementation.das" type="t:DASImplementation"/>
+
+ <complexType name="DASImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <element maxOccurs="1" minOccurs="0" name="ConnectionInfo"
+ type="data:ConnectionInfo"/>
+ </sequence>
+ <attribute name="config" type="NCName" use="required"/>
+ <attribute name="dataAccessType" type="NCName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-data-xml.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-data-xml.xsd
new file mode 100644
index 0000000000..4a06bdd36a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-data-xml.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:data="http://data.tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+ <import namespace="http://data.tuscany.apache.org/xmlns/sca/1.0" schemaLocation="tuscany-sca-data-helper.xsd"/>
+
+ <element name="implementation.data" type="t:DATAImplementation"/>
+
+ <complexType name="DATAImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <element maxOccurs="1" minOccurs="0" name="ConnectionInfo"
+ type="data:ConnectionInfo"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd
new file mode 100644
index 0000000000..1b5c8aece2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.node" type="t:NodeImplementation"/>
+
+ <complexType name="NodeImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="uri" type="string" use="required"/>
+ <attribute name="composite" type="QName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd
new file mode 100644
index 0000000000..f8d437310e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.notification" type="t:NotificationImplementation"/>
+
+ <complexType name="NotificationImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd
new file mode 100644
index 0000000000..f8ece54a07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.osgi" type="t:OSGiImplementation"/>
+
+ <!-- TODO Declare the proper attributes and elements -->
+ <complexType name="OSGiImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##any" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd
new file mode 100644
index 0000000000..dd596821ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.resource" type="t:ResourceImplementation"/>
+
+ <complexType name="ResourceImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd
new file mode 100644
index 0000000000..e1723d65f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.script" type="t:ScriptImplementation"/>
+
+ <complexType name="ScriptImplementation">
+ <complexContent mixed="true">
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="script" type="anyURI" use="optional"/>
+ <attribute name="language" type="NCName" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd
new file mode 100644
index 0000000000..0c0998595f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.widget" type="t:WidgetImplementation"/>
+
+ <complexType name="WidgetImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd
new file mode 100644
index 0000000000..cdabb697aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.xquery" type="t:XQueryImplementation"/>
+
+ <complexType name="XQueryImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd
new file mode 100644
index 0000000000..032143bd13
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly-xsd/src/main/resources/tuscany-sca.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://tuscany.apache.org/xmlns/sca/1.0">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-all.xsd"/>
+ <import namespace="http://data.tuscany.apache.org/xmlns/sca/1.0" schemaLocation="tuscany-sca-data-helper.xsd"/>
+
+ <include schemaLocation="tuscany-sca-binding-atom.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-dwr.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-http.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-jsonrpc.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-notification.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-rmi.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-rss.xsd"/>
+
+ <!--
+ <include schemaLocation="tuscany-sca-implementation-das.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-data-xml.xsd"/>
+ -->
+ <include schemaLocation="tuscany-sca-implementation-node.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-notification.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-osgi.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-resource.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-script.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-widget.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-xquery.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/LICENSE b/sca-java-1.x/branches/sca-android/modules/assembly/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/assembly/META-INF/README b/sca-java-1.x/branches/sca-android/modules/assembly/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/NOTICE b/sca-java-1.x/branches/sca-android/modules/assembly/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/assembly/pom.xml b/sca-java-1.x/branches/sca-android/modules/assembly/pom.xml
new file mode 100644
index 0000000000..5257d7ef63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/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-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly</artifactId>
+ <name>Apache Tuscany SCA Assembly Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-monitor</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.assembly</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.assembly*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java
new file mode 100644
index 0000000000..b8487d95c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.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;
+
+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, Extensible, IntentAttachPoint, OperationsConfigurator {
+
+ /**
+ * 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();
+
+ /**
+ * Sets the interface contract defining the interface and callback
+ * interface for the contract.
+ *
+ * @param interfaceContract the interface contract
+ */
+ void setInterfaceContract(InterfaceContract interfaceContract);
+
+ /**
+ * Returns true if this contract is a reference or service created internally
+ * to handle a callback interface of another contract, false otherwise.
+ *
+ * @return true for a callback contract, false otherwise
+ */
+ boolean isCallback();
+
+ /**
+ * Sets a flag indicating whether this is a callback contract.
+ *
+ * @param isCallback true for a callback contract, false otherwise
+ */
+ void setIsCallback(boolean isCallback);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java
new file mode 100644
index 0000000000..05f0e60981
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.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.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.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractProperty extends Base, Extensible, 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 this property
+ */
+ Object getValue();
+
+ /**
+ * Sets the default value of the property.
+ *
+ * @param defaultValue the default value of this 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 element the element defining the type of this property
+ */
+ void setXSDElement(QName element);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
new file mode 100644
index 0000000000..8a4fc6dfda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.assembly;
+
+
+/**
+ * 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 configured operation.
+ *
+ * @return a new ConfiguredOperation
+ */
+ ConfiguredOperation createConfiguredOperation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java
new file mode 100644
index 0000000000..76511d351d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.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;
+
+
+/**
+ * Base interface for all assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Base {
+
+ /**
+ * 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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java
new file mode 100644
index 0000000000..f8b7d4d236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.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;
+
+
+/**
+ * Represents a binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Binding extends Base, Cloneable {
+
+ /**
+ * 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);
+
+ /**
+ * Clone the binding
+ *
+ * @return
+ */
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java
new file mode 100644
index 0000000000..f49a653aa9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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, Extensible, IntentAttachPoint, PolicySetAttachPoint, OperationsConfigurator {
+
+ /**
+ * Returns the bindings supported for callbacks.
+ *
+ * @return the bindings supported for callbacks
+ */
+ List<Binding> getBindings();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
new file mode 100644
index 0000000000..8e1943224c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.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.assembly;
+
+import java.util.List;
+
+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, Extensible, PolicySetAttachPoint, Cloneable {
+
+ /**
+ * 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);
+
+ /**
+ * Return the Boolean value of autowire
+ * @return null/TRUE/FALSE
+ */
+ Boolean getAutowire();
+
+ /**
+ * 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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
new file mode 100644
index 0000000000..13d19b1757
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.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.assembly;
+
+import javax.xml.xpath.XPathExpression;
+
+/**
+ * Represents a configured property of a component.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentProperty extends Property {
+
+ /**
+ * Returns the property defined by the component implementation.
+ *
+ * @return the property defined by the component implementation
+ */
+ Property getProperty();
+
+ /**
+ * Sets the property defined by this component implementation.
+ *
+ * @param property the property defined by this component implementation
+ */
+ 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);
+
+ /**
+ * Get the XPath expression for the source attribute
+ * @return the XPath expression for the source attribute
+ */
+ XPathExpression getSourceXPathExpression();
+
+ /**
+ * Set the XPath expression for the source attribute
+ * @param sourceXPathExpression the XPath expression for the source attribute
+ */
+ void setSourceXPathExpression(XPathExpression sourceXPathExpression);
+
+ /**
+ * 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);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java
new file mode 100644
index 0000000000..ce40bc089b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.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.assembly;
+
+import java.util.List;
+
+
+
+/**
+ * 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 the implementation reference
+ */
+ Reference getReference();
+
+ /**
+ * Sets the reference defined by the implementation for this reference.
+ *
+ * @param reference the implementation reference
+ */
+ void setReference(Reference reference);
+
+ /**
+ * Return the Boolean value of autowire
+ * @return null/TRUE/FALSE
+ */
+ Boolean getAutowire();
+
+ /**
+ * Sets whether component references should be autowired.
+ *
+ * @param autowire whether component references should be autowired
+ */
+ void setAutowire(Boolean autowire);
+
+
+ /**
+ * Returns the callback service created internally as a target endpoint
+ * for callbacks to this reference.
+ *
+ * @return the callback service
+ */
+ ComponentService getCallbackService();
+
+ /**
+ * Sets the callback service created internally as a target endpoint
+ * for callbacks to this reference.
+ *
+ * @param callbackService the callback service
+ */
+ void setCallbackService(ComponentService callbackService);
+
+ /**
+ * Returns the endpoints implied by this reference.
+ *
+ * @return the endpoints implied by this reference
+ */
+ List<Endpoint> getEndpoints();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java
new file mode 100644
index 0000000000..65945692f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.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;
+
+
+/**
+ * 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);
+
+ /**
+ * Returns the callback reference created internally as a source endpoint
+ * for callbacks from this service.
+ *
+ * @return the callback reference
+ */
+ ComponentReference getCallbackReference();
+
+ /**
+ * Sets the callback reference created internally as a source endpoint
+ * for callbacks from this service.
+ *
+ * @param callbackReference the callback reference
+ */
+ void setCallbackReference(ComponentReference callbackReference);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
new file mode 100644
index 0000000000..e1ea65ea39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.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;
+
+import java.util.List;
+
+/**
+ * Describes an implementation and represents its configurable aspects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentType extends Base {
+
+ /**
+ * 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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java
new file mode 100644
index 0000000000..2c7b7c6b9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.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.assembly;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+
+/**
+ * Represents a composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Composite extends Implementation, Extensible, Cloneable, PolicySetAttachPoint {
+
+ /**
+ * 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);
+
+ /**
+ * Return the Boolean value of autowire
+ * @return null/TRUE/FALSE
+ */
+ Boolean getAutowire();
+
+ /**
+ * 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 type.
+ *
+ * @return a clone of the component type
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
new file mode 100644
index 0000000000..7143f571f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.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.assembly;
+
+/**
+ * Represents a composite service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeService extends Service {
+
+ /**
+ * Returns the promoted component.
+ *
+ * @return the promoted component.
+ */
+ Component getPromotedComponent();
+
+ /**
+ * Sets the promoted component
+ *
+ * @param promotedComponent the promoted component.
+ */
+ void setPromotedComponent(Component promotedComponent);
+
+ /**
+ * 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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java
new file mode 100644
index 0000000000..8832597343
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.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.assembly;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents an Operation. Typically Operation elements are used when there is a
+ * need to apply certain facets such as intents and policysets only to a specific
+ * operation provided by a service or reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConfiguredOperation extends Base, PolicySetAttachPoint {
+ /**
+ * 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 the name of the service or reference to which this operation belongs.
+ * This method is particularly useful when operation elements are specified under implementation
+ * elements and it is necessary to identify which of the various services provided by the
+ * implementation is referred to by the operation element in question
+ *
+ * @return the name of the contract to which this operation belongs
+ */
+ String getContractName();
+
+ /**
+ * Sets the name of the service or reference to which this operation belongs.
+ *
+ * @param contractName the name of the contract to which this operation belongs
+ */
+ void setContractName(String contractName);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java
new file mode 100644
index 0000000000..9890bfed68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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, Extensible, 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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java
new file mode 100644
index 0000000000..f9a62774e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.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;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+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, Cloneable {
+
+ /**
+ * 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 binding of the specified type or null if there is no such
+ * callback binding configured on this contract.
+ *
+ * @param <B> the callback binding type
+ * @param bindingClass the callback binding type class
+ * @return the callback binding or null if there is no callback binding of the specified type
+ */
+ <B> B getCallbackBinding(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);
+
+ /**
+ * Returns a clone of the contract.
+ *
+ * @return a clone of the reference
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+ /**
+ * Returns the interface contract given a binding. Important in the case where
+ * a reference with multiplicity > 1 has been promoted and has it's list of
+ * resolved bindings extended by a promoting reference. Here the binding
+ * from the promoting reference may need the interface contract from the
+ * promoting reference and not the promoted reference.
+ * TODO - remove this wrinkle with better endpoint support.
+ *
+ * @param binding the binding for which the interface contract is required
+ * @return the interface contract
+ */
+ InterfaceContract getInterfaceContract(Binding binding);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultEndpointFactory.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultEndpointFactory.java
new file mode 100644
index 0000000000..6b0c076ee5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultEndpointFactory.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;
+
+
+import org.apache.tuscany.sca.assembly.impl.EndpointFactoryImpl;
+
+/**
+ * A default factory for the Endpoint model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultEndpointFactory extends EndpointFactoryImpl {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java
new file mode 100644
index 0000000000..ee63497fbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.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.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * Represents an endpoint (primarily a combination of a target service name and a set of
+ * candidate bindings)
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Endpoint extends Base, Cloneable {
+
+ /**
+ * Get the name of the target service that this endpoint refers to
+ *
+ * @return target service name
+ */
+ String getTargetName();
+
+ /**
+ * Set the name of the target service that this endpoint refers to
+ *
+ * @param targetName
+ */
+ void setTargetName(String targetName);
+
+ /**
+ * Get the source component model object
+ *
+ * @return source component
+ */
+ Component getSourceComponent();
+
+ /**
+ * Set the source component model object
+ *
+ * @param component the source component for the endpoint
+ */
+ void setSourceComponent(Component component);
+
+ /**
+ * Get the source component reference model object
+ *
+ * @return reference the source component reference for the endpoint
+ */
+ ComponentReference getSourceComponentReference();
+
+ /**
+ * Set the source component reference model object
+ *
+ * @param reference
+ */
+ void setSourceComponentReference(ComponentReference reference);
+
+ /**
+ * Get the resolved source binding
+ *
+ * @return binding the resolved source binding
+ */
+ Binding getSourceBinding();
+
+ /**
+ * Set the resolved source binding
+ *
+ * @param binding the resolved source binding
+ */
+ void setSourceBinding(Binding binding);
+
+ /**
+ * Get the resolved source callback binding
+ *
+ * @return binding the resolved source callback binding
+ */
+ Binding getSourceCallbackBinding();
+
+ /**
+ * Set the resolved source callback binding
+ *
+ * @param binding the resolved source callback binding
+ */
+ void setSourceCallbackBinding(Binding binding);
+
+ /**
+ * Get the list of candidate bindings that could be used to
+ * communication with the target service
+ *
+ * @return list of candidate bindings
+ */
+ List<Binding> getCandidateBindings();
+
+
+ /**
+ * Get the target component model object
+ *
+ * @return target component
+ */
+ Component getTargetComponent();
+
+ /**
+ * Set the target component model object
+ *
+ * @param component target component
+ */
+ void setTargetComponent(Component component);
+
+ /**
+ * Get the target component service model object
+ *
+ * @return target component service
+ */
+ ComponentService getTargetComponentService();
+
+ /**
+ * Set the target component service model object
+ *
+ * @param service
+ */
+ void setTargetComponentService(ComponentService service);
+
+ /**
+ * Get the resolved target binding
+ *
+ * @return target binding
+ */
+ Binding getTargetBinding();
+
+ /**
+ * Set the resolved target binding
+ *
+ * @param binding target binding
+ */
+ void setTargetBinding(Binding binding);
+
+ /**
+ * Returns the interface contract defining the interface
+ *
+ * @return the interface contract
+ */
+ InterfaceContract getInterfaceContract();
+
+ /**
+ * Sets the interface contract defining the interface
+ *
+ * @param interfaceContract the interface contract
+ */
+ void setInterfaceContract(InterfaceContract interfaceContract);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointFactory.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointFactory.java
new file mode 100644
index 0000000000..93e6c4d630
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointFactory.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;
+
+
+
+/**
+ * A factory for the endpoint model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EndpointFactory {
+
+ /**
+ * Create a new endpoint model object
+ *
+ * @return a new endpoint
+ */
+ Endpoint createEndpoint();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
new file mode 100644
index 0000000000..3577a94d1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.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;
+
+/**
+ * Base interface for extensible assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Extensible {
+
+ /**
+ * 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();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java
new file mode 100644
index 0000000000..720a6801a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.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.assembly;
+
+/**
+ * Represents a component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Implementation extends ComponentType {
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java
new file mode 100644
index 0000000000..947fcd4c7c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.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.assembly;
+
+import java.util.List;
+
+/**
+ * Interface to be implemented by SCA artifacts that support configuration of 'operation' child
+ * elements for policies etc.
+ *
+ * @version $Rev$ $Date$
+ */
+
+public interface OperationsConfigurator {
+ List<ConfiguredOperation> getConfiguredOperations();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java
new file mode 100644
index 0000000000..98ff92f15b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.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.assembly;
+
+/**
+ * Represent a reference binding that supports optimized SCA local wiring between component
+ * references and services
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public interface OptimizableBinding extends Binding, Cloneable {
+
+ /**
+ * @param component
+ */
+ void setTargetComponent(Component component);
+
+ /**
+ * @param service
+ */
+ void setTargetComponentService(ComponentService service);
+
+ /**
+ * @param binding
+ */
+ void setTargetBinding(Binding binding);
+
+ /**
+ * @return
+ */
+ Binding getTargetBinding();
+
+ /**
+ * @return
+ */
+ Component getTargetComponent();
+
+ /**
+ * @return
+ */
+ ComponentService getTargetComponentService();
+
+ /**
+ * Clone the binding
+ * @return
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java
new file mode 100644
index 0000000000..683920da58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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, Cloneable {
+
+ /**
+ * 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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
new file mode 100644
index 0000000000..2eb1bf21b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.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;
+
+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 a boolean value, "false" by default, which indicates whether
+ * the configuration of this reference is a promotion override for
+ * another more deeply nested reference.
+ *
+ * @return true if the reference is a promotion override
+ */
+ boolean isPromotionOverride();
+
+ /**
+ * Sets a boolean value, "false" by default, which indicates whether
+ * the configuration of this reference is a promotion override for
+ * another more deeply nested reference.
+ *
+ * @param promotionOverride whether the reference is a promotion override
+ */
+ void setPromotionOverride(boolean promotionOverride);
+
+ /**
+ * Returns the targets of this reference.
+ *
+ * @return the targets of this reference.
+ */
+ List<ComponentService> getTargets();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
new file mode 100644
index 0000000000..2cf04277cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.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.assembly;
+
+/**
+ * Represents an SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCABinding extends Binding {
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
new file mode 100644
index 0000000000..020870cd34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.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;
+
+/**
+ * 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 {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java
new file mode 100644
index 0000000000..ee65e5746e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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, Extensible, IntentAttachPoint, PolicySetAttachPoint, Cloneable {
+
+ /**
+ * 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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/AutomaticBinding.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/AutomaticBinding.java
new file mode 100644
index 0000000000..97708f9ef5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/AutomaticBinding.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.assembly.builder;
+
+/**
+ * Represent a binding that has been added automatically to the model rather
+ * than being specified by the user through the composite file
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public interface AutomaticBinding extends Cloneable {
+
+ /**
+ * @param isAutomatic
+ */
+ void setIsAutomatic(boolean isAutomatic);
+
+ /**
+ * @return isAutomatic
+ */
+ boolean getIsAutomatic();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java
new file mode 100644
index 0000000000..7bac630d5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.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.builder;
+
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A builder that handles any build-time configuration needed by bindings.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BindingBuilder {
+
+ /**
+ * Configure a binding.
+ *
+ * @param component The component for the binding's service or reference
+ * @param contract The binding's service or reference
+ */
+ void build(Component component, AbstractContract contract, Binding binding, Monitor monitor);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilderExtension.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilderExtension.java
new file mode 100644
index 0000000000..37ad8af0b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilderExtension.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.assembly.builder;
+
+/**
+ * An extension that can be implemented by bindings to provide a binding builder.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BindingBuilderExtension {
+
+ /**
+ * Returns the binding builder.
+ *
+ * @return the binding builder
+ */
+ BindingBuilder getBuilder();
+
+ /**
+ * Sets the binding builder.
+ *
+ * @param builder the binding builder
+ */
+ void setBuilder(BindingBuilder builder);
+
+}
+
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java
new file mode 100644
index 0000000000..d2fae4d24a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.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.assembly.builder;
+
+import org.apache.tuscany.sca.assembly.Component;
+
+/**
+ * Interface for Component Pre Processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentPreProcessor {
+
+ void preProcess(Component component);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
new file mode 100644
index 0000000000..cf38894702
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 a composite.
+ *
+ * @param composite
+ * @throws CompositeBuilderException
+ */
+ void build(Composite composite) throws CompositeBuilderException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
new file mode 100644
index 0000000000..9743117174
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.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.builder;
+
+import org.apache.tuscany.sca.assembly.builder.impl.EndpointBuilderImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A default builder.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultEndpointBuilder extends EndpointBuilderImpl {
+ public DefaultEndpointBuilder (Monitor monitor){
+ super(monitor);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java
new file mode 100644
index 0000000000..20a17e1bd0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.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.builder;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Service;
+
+/**
+ * A builder that handles the configuration of the components inside a
+ * composite and the wiring of component references to component services.
+ *
+ * @version $Rev: 563358 $ $Date: 2007-08-07 01:26:27 +0100 (Tue, 07 Aug 2007) $
+ */
+public interface DomainBuilder {
+
+ /**
+ * Wire up the references and service in a domain returning a list
+ * of the composites that have changed
+ *
+ * @param domainLevelCompsite
+ * @return a list of change composites
+ * @throws CompositeBuilderException
+ */
+ List<Composite> wireDomain(Composite domainLevelComposite);
+
+ /**
+ * Locates the referenced service and updates the URI on the identified binding
+ *
+ * @param domainLevelComposite
+ * @param referenceName
+ * @param bindingClassName
+ * @param URI
+ */
+ void updateDomainLevelServiceURI(Composite domainLevelComposite, String referenceName, String bindingClassName, String URI);
+
+ /**
+ * Get the component name out of the reference name that might look like Component/Service
+ *
+ * @param referenceName
+ * @return
+ */
+ String getComponentNameFromReference(String referenceName);
+
+ /**
+ * Get the service name out of the reference name that might look like Component/Service
+ *
+ * @param referenceName
+ * @return
+ */
+ String getServiceNameFromReference(String referenceName);
+
+ /**
+ * Find the service object given a reference name
+ *
+ * @param composite
+ * @param referenceName
+ * @return
+ */
+ Service findServiceForReference(Composite composite, String referenceName);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java
new file mode 100644
index 0000000000..eb2977d87a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.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.Endpoint;
+
+/**
+ * A builder that handles the configuration of reference endpoints
+ * It collects together the logic so that it can be used at build time
+ * or later on during late binding scenarios
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EndpointBuilder {
+
+ /**
+ * Build an endpoint.
+ *
+ * @param endpoint
+ */
+ void build(Endpoint endpoint);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
new file mode 100644
index 0000000000..6f856986ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
@@ -0,0 +1,1337 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+
+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.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.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
+import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+/**
+ * Base class for Builder implementations that handles configuration.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseConfigurationBuilderImpl {
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ private static final String BINDING_SCA = "binding.sca";
+ private static final QName BINDING_SCA_QNAME = new QName(SCA10_NS, BINDING_SCA);
+
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private Monitor monitor;
+ private InterfaceContractMapper interfaceContractMapper;
+ private SCADefinitions policyDefinitions;
+ private DocumentBuilderFactory documentBuilderFactory;
+ private TransformerFactory transformerFactory;
+
+ protected BaseConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.scaBindingFactory = scaBindingFactory;
+ this.documentBuilderFactory = documentBuilderFactory;
+ this.transformerFactory = transformerFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.policyDefinitions = policyDefinitions;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Configure components in the composite.
+ *
+ * @param composite
+ * @param problems
+ */
+ protected void configureComponents(Composite composite) throws CompositeBuilderException {
+ configureComponents(composite, null);
+ configureSourcedProperties(composite, null);
+ //configureBindingURIs(composite, null, null);
+ }
+
+ /**
+ * Configure components in the composite.
+ *
+ * @param composite
+ * @param uri
+ * @param problems
+ */
+ private void configureComponents(Composite composite, String uri) {
+ String parentURI = uri;
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+
+ // Initialize component URI
+ String componentURI;
+ if (parentURI == null) {
+ componentURI = component.getName();
+ } else {
+ componentURI = URI.create(parentURI + '/').resolve(component.getName()).toString();
+ }
+ component.setURI(componentURI);
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // Process nested composite
+ configureComponents((Composite)implementation, componentURI);
+ }
+ }
+
+ // Initialize service bindings
+ List<Service> compositeServices = composite.getServices();
+ for (Service service : compositeServices) {
+ // Set default binding names
+
+ // Create default SCA binding
+ if (service.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ service.getBindings().add(scaBinding);
+ }
+/*
+ // Initialize binding names and URIs
+ for (Binding binding : service.getBindings()) {
+
+ // Binding name defaults to the service name
+ if (binding.getName() == null) {
+ binding.setName(service.getName());
+ }
+ }
+
+ if (service.getCallback() != null) {
+ for (Binding binding : service.getCallback().getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(service.getName());
+ }
+ }
+ }
+*/
+ }
+
+ // Initialize reference bindings
+ for (Reference reference : composite.getReferences()) {
+ // Create default SCA binding
+ if (reference.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ reference.getBindings().add(scaBinding);
+ }
+/*
+ // Set binding names
+ for (Binding binding : reference.getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(reference.getName());
+ }
+ }
+
+ if (reference.getCallback() != null) {
+ for (Binding binding : reference.getCallback().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())) {
+ error("DuplicateComponentName", component, composite.getName().toString(), component.getName());
+ } else {
+ components.put(component.getName(), component);
+ }
+
+ // Propagate the autowire flag from the composite to components
+ if (component.getAutowire() == null) {
+ component.setAutowire(composite.getAutowire());
+ }
+
+ if (component.getImplementation() instanceof ComponentPreProcessor) {
+ ((ComponentPreProcessor)component.getImplementation()).preProcess(component);
+ }
+
+ // Index properties, services and references
+ Map<String, Service> services = new HashMap<String, Service>();
+ Map<String, Reference> references = new HashMap<String, Reference>();
+ Map<String, Property> properties = new HashMap<String, Property>();
+ indexImplementationPropertiesServicesAndReferences(component,
+ services,
+ references,
+ properties);
+
+ // Index component services, references and properties
+ // Also check for duplicates
+ Map<String, ComponentService> componentServices =
+ new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences =
+ new HashMap<String, ComponentReference>();
+ Map<String, ComponentProperty> componentProperties =
+ new HashMap<String, ComponentProperty>();
+ indexComponentPropertiesServicesAndReferences(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);
+
+ // Configure or create callback services for component's references
+ // with callbacks
+ configureCallbackServices(component, componentServices);
+
+ // Configure or create callback references for component's services
+ // with callbacks
+ configureCallbackReferences(component, componentReferences);
+
+ // Create self references to the component's services
+// if (!(component.getImplementation() instanceof Composite)) {
+// createSelfReferences(component);
+// }
+
+ // Initialize service bindings
+ for (ComponentService componentService : component.getServices()) {
+
+ // Create default SCA binding
+ if (componentService.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ componentService.getBindings().add(scaBinding);
+ }
+/*
+ // Set binding names
+ for (Binding binding : componentService.getBindings()) {
+
+ // Binding name defaults to the service name
+ if (binding.getName() == null) {
+ binding.setName(componentService.getName());
+ }
+ }
+ if (componentService.getCallback() != null) {
+ for (Binding binding : componentService.getCallback().getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(componentService.getName());
+ }
+ }
+ }
+*/
+ }
+
+ // Initialize reference bindings
+ for (ComponentReference componentReference : component.getReferences()) {
+
+ // Create default SCA binding
+ if (componentReference.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ componentReference.getBindings().add(scaBinding);
+ }
+/*
+ // Set binding names
+ for (Binding binding : componentReference.getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(componentReference.getName());
+ }
+ }
+ if (componentReference.getCallback() != null) {
+ for (Binding binding : componentReference.getCallback().getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(componentReference.getName());
+ }
+ }
+ }
+*/
+ }
+ }
+ }
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model, String... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, String... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * 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("PropertyNotFound", component, component.getName(), componentProperty.getName());
+ }
+ }
+
+ // 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("PropertyMustSupplyIncompatible", component, component.getName(), componentProperty.getName());
+ }
+
+ // 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());
+ }
+
+ // Override the property value for the composite
+ if(component.getImplementation() instanceof Composite) {
+ property.setValue(componentProperty.getValue());
+ }
+
+ // Check that a value is supplied
+ if (componentProperty.getValue() == null && property.isMustSupply()) {
+ warning("PropertyMustSupplyNull", component, component.getName(), componentProperty.getName());
+ }
+
+ // Check that a a component property does not override the
+ // many attribute
+ if (!property.isMany() && componentProperty.isMany()) {
+
+ warning("PropertyOverrideManyAttribute", component, component.getName(), componentProperty.getName());
+ }
+
+ // 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("NoTypeForComponentProperty", component, component.getName(), componentProperty.getName());
+ }
+ }
+ }
+ }
+
+ /**
+ * 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()) {
+ if (componentReference.getReference() != null || componentReference.isCallback()) {
+ continue;
+ }
+ Reference reference = references.get(componentReference.getName());
+ if (reference != null) {
+ componentReference.setReference(reference);
+ } else {
+ if (!componentReference.getName().startsWith("$self$.")) {
+ error("ReferenceNotFound", component, component.getName(), componentReference.getName());
+ }
+ }
+ }
+
+ // 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.setIsCallback(reference.isCallback());
+ 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 (!ReferenceConfigurationUtil.isValidMultiplicityOverride(reference.getMultiplicity(),
+ componentReference
+ .getMultiplicity())) {
+ warning("ReferenceIncompatibleMultiplicity", component, component.getName(), componentReference.getName());
+ }
+ } else {
+ componentReference.setMultiplicity(reference.getMultiplicity());
+ }
+
+ // Reconcile interface
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ if (componentReference.getInterfaceContract() != null) {
+ if (interfaceContract != null && !componentReference.getInterfaceContract().equals(reference
+ .getInterfaceContract())) {
+ if (!interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(),
+ interfaceContract)) {
+ warning("ReferenceIncompatibleComponentInterface", component, component.getName(), componentReference.getName());
+ }
+ }
+ } else {
+ componentReference.setInterfaceContract(interfaceContract);
+ }
+
+ // Reconcile bindings
+ if (componentReference.getBindings().isEmpty()) {
+ componentReference.getBindings().addAll(reference.getBindings());
+ }
+
+ // Reconcile callback bindings
+ if (componentReference.getCallback() == null) {
+ componentReference.setCallback(reference.getCallback());
+ if (componentReference.getCallback() == null) {
+ // Create an empty callback to avoid null check
+ componentReference.setCallback(assemblyFactory.createCallback());
+ }
+
+ } else if (componentReference.getCallback().getBindings().isEmpty() && reference
+ .getCallback() != null) {
+ componentReference.getCallback().getBindings().addAll(reference.getCallback()
+ .getBindings());
+ }
+
+ // Propagate autowire setting from the component
+ if (componentReference.getAutowire() == null) {
+ componentReference.setAutowire(component.getAutowire());
+ }
+
+ // Reconcile targets
+ if (componentReference.getTargets().isEmpty()) {
+ componentReference.getTargets().addAll(reference.getTargets());
+ }
+ }
+ }
+ }
+
+ /**
+ * 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()) {
+ if (componentService.getService() != null || componentService.isCallback()) {
+ continue;
+ }
+ Service service = services.get(componentService.getName());
+ if (service != null) {
+ componentService.setService(service);
+ } else {
+ warning("ServiceNotFoundForComponentService", component, component.getName(), componentService.getName());
+ }
+ }
+
+ // 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.setIsCallback(service.isCallback());
+ String name = service.getName();
+ componentService.setName(name);
+ componentService.setService(service);
+ component.getServices().add(componentService);
+ componentServices.put(name, componentService);
+ }
+ }
+ }
+
+ //Reconcile each component service with its service
+ for (ComponentService componentService : component.getServices()) {
+ Service service = componentService.getService();
+ if (service != null) {
+ // Reconcile interface
+ InterfaceContract interfaceContract = service.getInterfaceContract();
+ if (componentService.getInterfaceContract() != null) {
+ if (interfaceContract != null && !componentService.getInterfaceContract().equals(interfaceContract)) {
+ if (!interfaceContractMapper.isCompatible(componentService.getInterfaceContract(),
+ interfaceContract)) {
+ warning("ServiceIncompatibleComponentInterface", component, component.getName(), componentService.getName());
+ }
+ }
+ } else {
+ componentService.setInterfaceContract(interfaceContract);
+ }
+
+ // Reconcile bindings
+ if (componentService.getBindings().isEmpty()) {
+ componentService.getBindings().addAll(service.getBindings());
+ }
+
+ // Reconcile callback bindings
+ if (componentService.getCallback() == null) {
+ componentService.setCallback(service.getCallback());
+ if (componentService.getCallback() == null) {
+ // Create an empty callback to avoid null check
+ componentService.setCallback(assemblyFactory.createCallback());
+ }
+ } else if (componentService.getCallback().getBindings().isEmpty() && service
+ .getCallback() != null) {
+ componentService.getCallback().getBindings().addAll(service.getCallback()
+ .getBindings());
+ }
+ }
+ }
+ }
+
+ private void indexComponentPropertiesServicesAndReferences(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("DuplicateComponentServiceName", component, component.getName(), componentService.getName());
+ } else {
+ componentServices.put(componentService.getName(), componentService);
+ }
+ }
+ for (ComponentReference componentReference : component.getReferences()) {
+ if (componentReferences.containsKey(componentReference.getName())) {
+ warning("DuplicateComponentReferenceName", component, component.getName(), componentReference.getName());
+ } else {
+ componentReferences.put(componentReference.getName(), componentReference);
+ }
+ }
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ if (componentProperties.containsKey(componentProperty.getName())) {
+ warning("DuplicateComponentPropertyName", component, component.getName(), componentProperty.getName());
+ } else {
+ componentProperties.put(componentProperty.getName(), componentProperty);
+ }
+ }
+
+ }
+
+ private void indexImplementationPropertiesServicesAndReferences(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("NoComponentImplementation", component, component.getName());
+
+ } else if (implementation.isUnresolved()) {
+
+ // The implementation must be fully resolved
+ warning("UnresolvedComponentImplementation", component, component.getName(), implementation.getURI());
+
+ } else {
+
+ // Index properties, services and references, also check for
+ // duplicates
+ for (Property property : implementation.getProperties()) {
+ if (properties.containsKey(property.getName())) {
+ warning("DuplicateImplementationPropertyName", component, component.getName(), property.getName());
+ } else {
+ properties.put(property.getName(), property);
+ }
+ }
+ for (Service service : implementation.getServices()) {
+ if (services.containsKey(service.getName())) {
+ warning("DuplicateImplementationServiceName", component, component.getName(), service.getName());
+ } else {
+ services.put(service.getName(), service);
+ }
+ }
+ for (Reference reference : implementation.getReferences()) {
+ if (references.containsKey(reference.getName())) {
+ warning("DuplicateImplementationReferenceName", component, component.getName(), reference.getName());
+ } else {
+ references.put(reference.getName(), reference);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * For all the references with callbacks, create a corresponding callback
+ * service.
+ *
+ * @param component
+ */
+ private void configureCallbackServices(Component component,
+ Map<String, ComponentService> componentServices) {
+ for (ComponentReference reference : component.getReferences()) {
+ if (reference.getInterfaceContract() != null && // can be null in
+ // unit tests
+ reference.getInterfaceContract().getCallbackInterface() != null) {
+ ComponentService service =
+ componentServices.get(reference.getName());
+ if (service == null) {
+ service = createCallbackService(component, reference);
+ }
+ if (reference.getCallback() != null) {
+ if (service.getBindings().isEmpty()) {
+ service.getBindings().addAll(reference.getCallback().getBindings());
+ }
+ }
+ reference.setCallbackService(service);
+ }
+ }
+ }
+
+ /**
+ * Create a callback service for a component reference
+ *
+ * @param component
+ * @param reference
+ */
+ private ComponentService createCallbackService(Component component, ComponentReference reference) {
+ ComponentService componentService = assemblyFactory.createComponentService();
+ componentService.setIsCallback(true);
+ componentService.setName(reference.getName());
+ try {
+ InterfaceContract contract =
+ (InterfaceContract)reference.getInterfaceContract().clone();
+ contract.setInterface(contract.getCallbackInterface());
+ contract.setCallbackInterface(null);
+ componentService.setInterfaceContract(contract);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ Reference implReference = reference.getReference();
+ if (implReference != null) {
+ Service implService = assemblyFactory.createService();
+ implService.setName(implReference.getName());
+ try {
+ InterfaceContract implContract =
+ (InterfaceContract)implReference.getInterfaceContract().clone();
+ implContract.setInterface(implContract.getCallbackInterface());
+ implContract.setCallbackInterface(null);
+ implService.setInterfaceContract(implContract);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ componentService.setService(implService);
+ }
+ component.getServices().add(componentService);
+ return componentService;
+ }
+
+ /**
+ * For all the services with callbacks, create a corresponding callback
+ * reference.
+ *
+ * @param component
+ */
+ private void configureCallbackReferences(Component component,
+ Map<String, ComponentReference> componentReferences) {
+ for (ComponentService service : component.getServices()) {
+ if (service.getInterfaceContract() != null && // can be null in
+ // unit tests
+ service.getInterfaceContract().getCallbackInterface() != null) {
+ ComponentReference reference =
+ componentReferences.get(service.getName());
+ if (reference == null) {
+ reference = createCallbackReference(component, service);
+ }
+ if (service.getCallback() != null) {
+ if (reference.getBindings().isEmpty()) {
+ reference.getBindings().addAll(service.getCallback().getBindings());
+ }
+ }
+ service.setCallbackReference(reference);
+ }
+ }
+ }
+
+ /**
+ * Create a callback reference for a component service
+ *
+ * @param component
+ * @param service
+ */
+ private ComponentReference createCallbackReference(Component component, ComponentService service) {
+ ComponentReference componentReference = assemblyFactory.createComponentReference();
+ componentReference.setIsCallback(true);
+ componentReference.setName(service.getName());
+ try {
+ InterfaceContract contract = (InterfaceContract)service.getInterfaceContract().clone();
+ contract.setInterface(contract.getCallbackInterface());
+ contract.setCallbackInterface(null);
+ componentReference.setInterfaceContract(contract);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ Service implService = service.getService();
+ if (implService != null) {
+ Reference implReference = assemblyFactory.createReference();
+ implReference.setName(implService.getName());
+ try {
+ InterfaceContract implContract =
+ (InterfaceContract)implService.getInterfaceContract().clone();
+ implContract.setInterface(implContract.getCallbackInterface());
+ implContract.setCallbackInterface(null);
+ implReference.setInterfaceContract(implContract);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ componentReference.setReference(implReference);
+ }
+ component.getReferences().add(componentReference);
+ return componentReference;
+ }
+
+ /**
+ * @param composite
+ */
+ private void configureSourcedProperties(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 {
+ PropertyConfigurationUtil.sourceComponentProperties(compositeProperties, component,
+ documentBuilderFactory, transformerFactory);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Implementation impl = component.getImplementation();
+ if (impl instanceof Composite) {
+ configureSourcedProperties((Composite)impl, component.getProperties());
+ }
+ }
+ }
+
+ private ComponentProperty getComponentPropertyByName(String propertyName, List<ComponentProperty> properties) {
+ if (properties != null) {
+ for (ComponentProperty aProperty : properties) {
+ if (aProperty.getName().equals(propertyName)) {
+ return aProperty;
+ }
+ }
+ }
+ return null;
+ }
+
+ private SCABinding createSCABinding() {
+ SCABinding scaBinding = scaBindingFactory.createSCABinding();
+
+ // mark the bindings that are added automatically so that they can
+ // be disregarded for overriding purposes
+ if (scaBinding instanceof AutomaticBinding){
+ ((AutomaticBinding)scaBinding).setIsAutomatic(true);
+ }
+
+ if ( policyDefinitions != null ) {
+ for ( IntentAttachPointType attachPointType : policyDefinitions.getBindingTypes() ) {
+ if ( attachPointType.getName().equals(BINDING_SCA_QNAME)) {
+ ((IntentAttachPoint)scaBinding).setType(attachPointType);
+ }
+ }
+ }
+
+ return scaBinding;
+ }
+
+ /**
+ * Called by CompositeBindingURIBuilderImpl
+ *
+ * @param composite the composite to be configured
+ */
+ protected void configureBindingURIsAndNames(Composite composite) throws CompositeBuilderException {
+ configureBindingURIs(composite, null, null);
+ configureBindingNames(composite);
+ }
+
+ /**
+ * Fully resolve the binding URIs based on available information. This includes information
+ * from the ".composite" files, from resources associated with the binding, e.g. WSDL files,
+ * from any associated policies and from the default information for each binding type.
+ *
+ * @param composite the composite to be configured
+ * @param defaultBindings list of default binding configurations
+ */
+ protected void configureBindingURIs(Composite composite, List<Binding> defaultBindings) throws CompositeBuilderException {
+ configureBindingURIs(composite, null, defaultBindings);
+ }
+
+ /**
+ * Fully resolve the binding URIs based on available information. This includes information
+ * from the ".composite" files, from resources associated with the binding, e.g. WSDL files,
+ * from any associated policies and from the default information for each binding type.
+ *
+ * NOTE: This method repeats some of the processing performed by the configureComponents()
+ * method above. The duplication is needed because NodeConfigurationServiceImpl
+ * calls this method without previously calling configureComponents(). In the
+ * normal builder sequence used by CompositeBuilderImpl, both of these methods
+ * are called.
+ *
+ * TODO: Share the URL calculation algorithm with the configureComponents() method above
+ * although keeping the configureComponents() methods signature as is because when
+ * a composite is actually build in a node the node default information is currently
+ * available
+ *
+ * @param composite the composite to be configured
+ * @param uri the path to the composite provided through any nested composite component implementations
+ * @param defaultBindings list of default binding configurations
+ */
+ private void configureBindingURIs(Composite composite, String uri, List<Binding> defaultBindings) throws CompositeBuilderException {
+
+ String parentComponentURI = uri;
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+
+ // Initialize component URI
+ String componentURI;
+ if (parentComponentURI == null) {
+ componentURI = component.getName();
+ } else {
+ componentURI = URI.create(parentComponentURI + '/').resolve(component.getName()).toString();
+ }
+ component.setURI(componentURI);
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // Process nested composite
+ configureBindingURIs((Composite)implementation, componentURI, defaultBindings);
+ }
+ }
+
+ // Initialize composite service binding URIs
+ List<Service> compositeServices = composite.getServices();
+ for (Service service : compositeServices) {
+ // Set default binding names
+
+ // Create default SCA binding
+ if (service.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ service.getBindings().add(scaBinding);
+ }
+
+ // Initialize binding names and URIs
+ for (Binding binding : service.getBindings()) {
+ constructBindingName(service, binding);
+ constructBindingURI(parentComponentURI, composite, service, binding, defaultBindings);
+ }
+ }
+
+ // Initialize component service binding URIs
+ for (Component component : composite.getComponents()) {
+
+ // Index properties, services and references
+ Map<String, Service> services = new HashMap<String, Service>();
+ Map<String, Reference> references = new HashMap<String, Reference>();
+ Map<String, Property> properties = new HashMap<String, Property>();
+ indexImplementationPropertiesServicesAndReferences(component,
+ services,
+ references,
+ properties);
+
+ // Index component services, references and properties
+ // Also check for duplicates
+ Map<String, ComponentService> componentServices =
+ new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences =
+ new HashMap<String, ComponentReference>();
+ Map<String, ComponentProperty> componentProperties =
+ new HashMap<String, ComponentProperty>();
+ indexComponentPropertiesServicesAndReferences(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);
+
+ for (ComponentService service : component.getServices()) {
+
+ // Create default SCA binding
+ if (service.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ service.getBindings().add(scaBinding);
+ }
+
+ // Initialize binding names and URIs
+ for (Binding binding : service.getBindings()) {
+
+ constructBindingName(service, binding);
+ constructBindingURI(component, service, binding, defaultBindings);
+ }
+ }
+ }
+ }
+
+ /**
+ * Add default names for callback bindings and reference bindings. Needs to be
+ * separate from configureBindingURIs() because configureBindingURIs() is called
+ * by NodeConfigurationServiceImpl as well as by CompositeBuilderImpl.
+ */
+ private void configureBindingNames(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // Process nested composite
+ configureBindingNames((Composite)implementation);
+ }
+ }
+
+ // Initialize composite service callback binding names
+ for (Service service : composite.getServices()) {
+
+ if (service.getCallback() != null) {
+ for (Binding binding : service.getCallback().getBindings()) {
+ constructBindingName(service, binding);
+ }
+ }
+ }
+
+ // Initialize composite reference binding names
+ for (Reference reference : composite.getReferences()) {
+
+ for (Binding binding : reference.getBindings()) {
+ constructBindingName(reference, binding);
+ }
+
+ if (reference.getCallback() != null) {
+ for (Binding binding : reference.getCallback().getBindings()) {
+ constructBindingName(reference, binding);
+ }
+ }
+ }
+
+ // Initialize component service and reference binding names
+ for (Component component : composite.getComponents()) {
+
+ // Initialize component service callback binding names
+ for (ComponentService service : component.getServices()) {
+
+ if (service.getCallback() != null) {
+ for (Binding binding : service.getCallback().getBindings()) {
+ constructBindingName(service, binding);
+ }
+ }
+ }
+
+ // Initialize component reference binding names
+ for (ComponentReference reference : component.getReferences()) {
+
+ // Initialize binding names
+ for (Binding binding : reference.getBindings()) {
+ constructBindingName(reference, binding);
+ }
+
+ if (reference.getCallback() != null) {
+ for (Binding binding : reference.getCallback().getBindings()) {
+ constructBindingName(reference, binding);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * If a binding name is not provided by the user, construct it based on the service
+ * or reference name
+ *
+ * @param contract the service or reference
+ * @param binding
+ */
+ private void constructBindingName(Contract contract, Binding binding) {
+
+ // set the default binding name if one is required
+ // if there is no name on the binding then set it to the service or reference name
+ if (binding.getName() == null){
+ binding.setName(contract.getName());
+ }
+
+ // Check that multiple bindings do not have the same name
+ for (Binding otherBinding : contract.getBindings()) {
+ if (otherBinding == binding) {
+ // Skip the current binding
+ continue;
+ }
+ if (binding.getClass() != otherBinding.getClass()) {
+ // Look for a binding of the same type
+ continue;
+ }
+ if (binding.getName().equals(otherBinding.getName())) {
+ warning(contract instanceof Service ? "MultipleBindingsForService" : "MultipleBindingsForReference",
+ binding, contract.getName(), binding.getName());
+ }
+ }
+ }
+
+ /**
+ * URI construction for composite bindings based on Assembly Specification section 1.7.2, This method
+ * assumes that the component URI part of the binding URI is formed from the part to the
+ * composite in question and just calls the generic constructBindingURI method with this
+ * information
+ *
+ * @param parentComponentURI
+ * @param composite
+ * @param service
+ * @param binding
+ * @param defaultBindings
+ */
+ private void constructBindingURI(String parentComponentURI, Composite composite, Service service, Binding binding, List<Binding> defaultBindings)
+ throws CompositeBuilderException{
+ // This is a composite service so there is no component to provide a component URI
+ // The path to this composite (through nested composites) is used.
+ boolean includeBindingName = composite.getServices().size() != 1;
+ constructBindingURI(parentComponentURI, service, binding, includeBindingName, defaultBindings);
+ }
+
+ /**
+ * URI construction for component bindings based on Assembly Specification section 1.7.2. This method
+ * calculates the component URI part based on component information before calling the generic
+ * constructBindingURI method
+ *
+ * @param component the component that holds the service
+ * @param service the service that holds the binding
+ * @param binding the binding for which the URI is being constructed
+ * @param defaultBindings the list of default binding configurations
+ */
+ private void constructBindingURI(Component component, Service service, Binding binding, List<Binding> defaultBindings)
+ throws CompositeBuilderException{
+ boolean includeBindingName = component.getServices().size() != 1;
+ constructBindingURI(component.getURI(), service, binding, includeBindingName, defaultBindings);
+ }
+
+ /**
+ * Generic URI construction for bindings based on Assembly Specification section 1.7.2
+ *
+ * @param componentURIString the string version of the URI part that comes from the component name
+ * @param service the service in question
+ * @param binding the binding for which the URI is being constructed
+ * @param includeBindingName when set true the serviceBindingURI part should be used
+ * @param defaultBindings the list of default binding configurations
+ * @throws CompositeBuilderException
+ */
+ private void constructBindingURI(String componentURIString, Service service, Binding binding, boolean includeBindingName, List<Binding> defaultBindings)
+ throws CompositeBuilderException{
+
+ try {
+ // calculate the service binding URI
+ URI bindingURI;
+ if (binding.getURI() != null){
+ bindingURI = new URI(binding.getURI());
+
+ // if the user has provided an absolute binding URI then use it
+ if (bindingURI.isAbsolute()){
+ binding.setURI(bindingURI.toString());
+ return;
+ }
+ } else {
+ bindingURI = null;
+ }
+
+ // Get the service binding name
+ URI bindingName;
+ if (binding.getName() != null) {
+ bindingName = new URI(binding.getName());
+ } else {
+ bindingName = new URI("");
+ }
+
+ // calculate the component URI
+ URI componentURI;
+ if (componentURIString != null) {
+ componentURI = new URI(addSlashToPath(componentURIString));
+ } else {
+ componentURI = null;
+ }
+
+ // if the user has provided an absolute component URI then use it
+ if (componentURI != null && componentURI.isAbsolute()){
+ binding.setURI(constructBindingURI(null, componentURI, bindingURI, includeBindingName, bindingName));
+ return;
+ }
+
+ // calculate the base URI
+
+ // get the protocol for this binding/URI
+/* some code that allows binding specific code to run. Being discussed on ML
+ BindingURICalculator uriCalculator = bindingURICalcualtorExtensionPoint.getBindingURICalculator(binding);
+
+ if (uriCalculator != null){
+ String protocol = uriCalculator.getProtocol(binding);
+
+ // find the default binding with the right protocol
+ Binding defaultBinding = nodeInfo.getBindingDefault(binding, protocol);
+
+ if (defaultBinding != null){
+ baseURI = new URI(defaultBinding.getURI());
+ } else {
+ baseURI = null;
+ }
+
+ } else {
+ baseURI = null;
+ }
+*/
+ // as a simpler alternative to the above commented out code.
+ URI baseURI = null;
+ if (defaultBindings != null) {
+ for (Binding defaultBinding : defaultBindings){
+ if (binding.getClass() == defaultBinding.getClass()){
+ baseURI = new URI(addSlashToPath(defaultBinding.getURI()));
+ break;
+ }
+ }
+ }
+
+ binding.setURI(constructBindingURI(baseURI, componentURI, bindingURI, includeBindingName, bindingName));
+ } catch (URISyntaxException ex) {
+ error("URLSyntaxException", binding, componentURIString, service.getName(), binding.getName());
+ }
+ }
+
+ /**
+ * Use to ensure that URI paths end in "/" as here we want to maintain the
+ * last path element of an base URI when other URI are resolved against it. This is
+ * not the default behaviour of URI resolution as defined in RFC 2369
+ *
+ * @param path the path string to which the "/" is to be added
+ * @return the resulting path with a "/" added if it not already there
+ */
+ private static String addSlashToPath(String path){
+ if (path.endsWith("/") || path.endsWith("#")){
+ return path;
+ } else {
+ return path + "/";
+ }
+ }
+
+ /**
+ * Concatenate binding URI parts together based on Assembly Specification section 1.7.2
+ *
+ * @param baseURI the base of the binding URI
+ * @param componentURI the middle part of the binding URI derived from the component name
+ * @param bindingURI the end part of the binding URI
+ * @param includeBindingName when set true the binding name part should be used
+ * @param bindingName the binding name
+ * @return the resulting URI as a string
+ */
+ private static String constructBindingURI(URI baseURI, URI componentURI, URI bindingURI, boolean includeBindingName, URI bindingName){
+ String uriString;
+
+ if (baseURI == null) {
+ if (componentURI == null){
+ if (bindingURI != null ) {
+ uriString = bindingURI.toString();
+ } else {
+ uriString = bindingName.toString();
+ }
+ } else {
+ if (bindingURI != null ) {
+ uriString = componentURI.resolve(bindingURI).toString();
+ } else {
+ if (includeBindingName) {
+ uriString = componentURI.resolve(bindingName).toString();
+ } else {
+ uriString = componentURI.toString();
+ }
+ }
+ }
+ } else {
+ if (componentURI == null) {
+ if (bindingURI != null ) {
+ uriString = basedURI(baseURI, bindingURI).toString();
+ } else {
+ if (includeBindingName) {
+ uriString = basedURI(baseURI, bindingName).toString();
+ } else {
+ uriString = baseURI.toString();
+ }
+ }
+ } else {
+ if (bindingURI != null ) {
+ uriString = basedURI(baseURI, componentURI.resolve(bindingURI)).toString();
+ } else {
+ if (includeBindingName) {
+ uriString = basedURI(baseURI, componentURI.resolve(bindingName)).toString();
+ } else {
+ uriString = basedURI(baseURI, componentURI).toString();
+ }
+ }
+ }
+ }
+
+ // tidy up by removing any trailing "/"
+ if (uriString.endsWith("/")){
+ uriString = uriString.substring(0, uriString.length()-1);
+ }
+
+ URI uri = URI.create(uriString);
+ if (!uri.isAbsolute()) {
+ uri = URI.create("/").resolve(uri);
+ }
+ return uri.toString();
+ }
+
+ /**
+ * Combine a URI with a base URI.
+ *
+ * @param baseURI
+ * @param uri
+ * @return
+ */
+ private static URI basedURI(URI baseURI, URI uri) {
+ if (uri.getScheme() != null) {
+ return uri;
+ }
+ String str = uri.toString();
+ if (str.startsWith("/")) {
+ str = str.substring(1);
+ }
+ return URI.create(baseURI.toString() + str).normalize();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
new file mode 100644
index 0000000000..0c2d02ab48
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
@@ -0,0 +1,1149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+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.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+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.assembly.builder.DefaultEndpointBuilder;
+import org.apache.tuscany.sca.assembly.builder.EndpointBuilder;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
+
+/**
+ * A composite builder that handles wiring inside a composite.
+ *
+ * @version $Rev$ $Date$
+ */
+class BaseWireBuilderImpl {
+
+ private Monitor monitor;
+ private AssemblyFactory assemblyFactory;
+ private EndpointFactory endpointFactory;
+ private InterfaceContractMapper interfaceContractMapper;
+ private EndpointBuilder endpointBuilder;
+
+
+ protected BaseWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.endpointFactory = endpointFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.monitor = monitor;
+ this.endpointBuilder = new DefaultEndpointBuilder(monitor);
+
+ }
+
+ /**
+ * Wire component references to component services and connect promoted
+ * services/references to component services/references inside a composite.
+ *
+ * @param composite
+ */
+ protected void wireComponentReferences(Composite composite) {
+
+ // Wire nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ wireComponentReferences((Composite)implementation);
+ }
+ }
+
+ // Index components, services and references
+ Map<String, Component> components = new HashMap<String, Component>();
+ Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
+ indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
+
+ // Connect composite services and references to the component
+ // services and references that they promote
+ //connectCompositeServices(composite, components, componentServices);
+ //connectCompositeReferences(composite, componentReferences);
+
+ // Compute the policies before connecting component references
+ //computePolicies(composite);
+
+ // Connect component references as described in wires
+ connectWires(composite, componentServices, componentReferences);
+
+ // Connect component references to their targets
+ connectComponentReferences(composite, components, componentServices, componentReferences);
+
+ // Validate that references are wired or promoted, according
+ // to their multiplicity
+ for (ComponentReference componentReference : componentReferences.values()) {
+ if (!ReferenceConfigurationUtil.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 && !componentReference.isCallback()) {
+ warning("ReferenceWithoutTargets", composite, composite.getName().toString(), componentReference.getName());
+ }
+ } else {
+ warning("TooManyReferenceTargets", composite, componentReference.getName());
+ }
+ }
+ }
+
+ // Finally clear the original reference target lists as we now have
+ // bindings to represent the targets
+ for (ComponentReference componentReference : componentReferences.values()) {
+ componentReference.getTargets().clear();
+ }
+ }
+
+ /**
+ * Index components, services and references inside a composite.
+ * @param composite
+ * @param components
+ * @param componentServices
+ * @param componentReferences
+ */
+ private void indexComponentsServicesAndReferences(Composite composite,
+ Map<String, Component> components,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences) {
+
+ for (Component component : composite.getComponents()) {
+
+ // Index components by name
+ components.put(component.getName(), component);
+
+ ComponentService nonCallbackService = null;
+ int nonCallbackServices = 0;
+ for (ComponentService componentService : component.getServices()) {
+
+ // Index component services by component name / service name
+ String uri = component.getName() + '/' + componentService.getName();
+ componentServices.put(uri, componentService);
+
+ boolean promotedService = false;
+ if (componentService.getName() != null && componentService.getName().indexOf("$promoted$") > -1) {
+ promotedService = true;
+ }
+
+ // count how many non-callback, non-promoted services there are
+ // if there is only one the component name also acts as the service name
+ if ((!componentService.isCallback()) && (!promotedService)) {
+
+ // Check how many non callback non-promoted services we have
+ if (nonCallbackServices == 0) {
+ nonCallbackService = componentService;
+ }
+ nonCallbackServices++;
+ }
+
+ }
+
+ if (nonCallbackServices == 1) {
+ // If we have a single non callback service, index it by
+ // component name as well
+ componentServices.put(component.getName(), nonCallbackService);
+ }
+
+ // Index references by component name / reference name
+ for (ComponentReference componentReference : component.getReferences()) {
+ String uri = component.getName() + '/' + componentReference.getName();
+ componentReferences.put(uri, componentReference);
+ }
+ }
+ }
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model, String... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = null;
+ problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Connect composite references and services to the reference and services that they promote.
+ *
+ * @param composite
+ * @param componentServices
+ * @param problems
+ */
+ protected void connectCompositeReferencesAndServices(Composite composite){
+ // Wire nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ connectCompositeReferencesAndServices((Composite)implementation);
+ }
+ }
+
+ // Index components, services and references
+ Map<String, Component> components = new HashMap<String, Component>();
+ Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
+ indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
+
+ // Connect composite services and references to the component
+ // services and references that they promote
+ connectCompositeServices(composite, components, componentServices);
+ connectCompositeReferences(composite, componentReferences);
+ }
+
+ /**
+ * Connect composite services to the component services that they promote.
+ *
+ * @param composite
+ * @param componentServices
+ * @param problems
+ */
+ private void connectCompositeServices(Composite composite,
+ Map<String, Component> components,
+ 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()) {
+
+ String promotedComponentName = compositeService.getPromotedComponent().getName();
+ String promotedServiceName;
+ if (componentService.getName() != null) {
+ promotedServiceName = promotedComponentName + '/' + componentService.getName();
+ } else {
+ promotedServiceName = promotedComponentName;
+ }
+ ComponentService promotedService = componentServices.get(promotedServiceName);
+ if (promotedService != null) {
+
+ // Point to the resolved component
+ Component promotedComponent = components.get(promotedComponentName);
+ compositeService.setPromotedComponent(promotedComponent);
+
+ // 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
+ InterfaceContract compositeServiceInterfaceContract = compositeService.getInterfaceContract();
+ InterfaceContract promotedServiceInterfaceContract = promotedService.getInterfaceContract();
+ if (compositeServiceInterfaceContract == null) {
+ compositeService.setInterfaceContract(promotedServiceInterfaceContract);
+ } else if (promotedServiceInterfaceContract != null) {
+ // Check the compositeServiceInterfaceContract and promotedServiceInterfaceContract
+ boolean isCompatible = interfaceContractMapper.isCompatible(compositeServiceInterfaceContract, promotedServiceInterfaceContract);
+ if(!isCompatible){
+ warning("ServiceInterfaceNotSubSet", compositeService, promotedServiceName);
+ }
+ }
+
+ } else {
+ warning("PromotedServiceNotFound", composite, composite.getName().toString(), promotedServiceName);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * 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
+
+ InterfaceContract compositeReferenceInterfaceContract = compositeReference.getInterfaceContract();
+ InterfaceContract componentReferenceInterfaceContract = componentReference.getInterfaceContract();
+ if (compositeReferenceInterfaceContract == null) {
+ compositeReference.setInterfaceContract(componentReferenceInterfaceContract);
+ } else if (componentReferenceInterfaceContract != null) {
+ // Check the compositeInterfaceContract and componentInterfaceContract
+ boolean isCompatible = interfaceContractMapper.isCompatible(compositeReferenceInterfaceContract, componentReferenceInterfaceContract);
+ if (!isCompatible) {
+ warning("ReferenceInterfaceNotSubSet", compositeReference, componentReferenceName);
+ }
+ }
+ } else {
+ warning("PromotedReferenceNotFound", composite, composite.getName().toString(), componentReferenceName);
+ }
+ }
+ }
+ }
+ }
+
+ private List<Endpoint> createComponentReferenceTargets(Composite composite,
+ Map<String, Component> components,
+ Map<String, ComponentService> componentServices,
+ ComponentReference componentReference) {
+
+ List<Endpoint> endpoints = new ArrayList<Endpoint>();
+
+ if (componentReference.getAutowire() == Boolean.TRUE) {
+
+ // Find suitable targets in the current composite for an
+ // autowired reference
+ Multiplicity multiplicity = componentReference.getMultiplicity();
+ for (Component targetComponent : composite.getComponents()) {
+ // prevent autowire connecting to self
+ boolean skipSelf = false;
+ for (ComponentReference targetComponentReference : targetComponent.getReferences()) {
+ if (componentReference == targetComponentReference){
+ skipSelf = true;
+ }
+ }
+
+ if (!skipSelf){
+ for (ComponentService targetComponentService : targetComponent.getServices()) {
+ if (componentReference.getInterfaceContract() == null ||
+ interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+
+ Endpoint endpoint = endpointFactory.createEndpoint();
+ endpoint.setTargetName(targetComponent.getName());
+ endpoint.setSourceComponent(null); // TODO - fixed up at start
+ endpoint.setSourceComponentReference(componentReference);
+ endpoint.setInterfaceContract(componentReference.getInterfaceContract());
+ endpoint.setTargetComponent(targetComponent);
+ endpoint.setTargetComponentService(targetComponentService);
+ endpoint.getCandidateBindings().addAll(componentReference.getBindings());
+ endpoints.add(endpoint);
+
+ if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) {
+ if (endpoints.size() == 0) {
+ warning("NoComponentReferenceTarget", componentReference, componentReference.getName());
+ }
+ }
+
+ } else if (!componentReference.getTargets().isEmpty()) {
+
+ // Check if the component reference does not mix the use of endpoints specified via
+ // binding elements with target endpoints specified via the target attribute
+ for (Binding binding : componentReference.getBindings()) {
+ if (binding.getURI() != null) {
+ warning("ReferenceEndPointMixWithTarget", composite, componentReference.getName());
+ }
+ }
+
+ // Resolve targets specified on the component reference
+ for (ComponentService componentService : componentReference.getTargets()) {
+
+ // Resolve the target component and service
+ String name = componentService.getName();
+ ComponentService targetComponentService = componentServices.get(name);
+ Component targetComponent;
+ int s = name.indexOf('/');
+ if (s == -1) {
+ targetComponent = components.get(name);
+ } else {
+ targetComponent = components.get(name.substring(0, s));
+ }
+
+ if (targetComponentService != null) {
+
+ // Check that the target component service provides
+ // a superset of the component reference interface
+ if (componentReference.getInterfaceContract() == null ||
+ interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+
+ Endpoint endpoint = endpointFactory.createEndpoint();
+ endpoint.setTargetName(targetComponent.getName());
+ endpoint.setSourceComponent(null); // TODO - fixed up at start
+ endpoint.setSourceComponentReference(componentReference);
+ endpoint.setInterfaceContract(componentReference.getInterfaceContract());
+ endpoint.setTargetComponent(targetComponent);
+ endpoint.setTargetComponentService(targetComponentService);
+ endpoint.getCandidateBindings().addAll(componentReference.getBindings());
+ endpoints.add(endpoint);
+
+ // mark the reference target as resolved. Used later when we are looking to
+ // see if an sca binding is associated with a resolved target or not
+ componentService.setUnresolved(false);
+ } else {
+ warning("ReferenceIncompatibleInterface", composite, composite.getName().toString(),
+ componentReference.getName(), componentService.getName());
+ }
+ } else {
+ // add all the reference bindings into the target so that they
+ // can be used for comparison when the target is resolved at runtime
+ componentService.getBindings().addAll(componentReference.getBindings());
+
+ Endpoint endpoint = endpointFactory.createEndpoint();
+ endpoint.setTargetName(name);
+ endpoint.setSourceComponent(null); // TODO - fixed up at start
+ endpoint.setSourceComponentReference(componentReference);
+ endpoint.setInterfaceContract(componentReference.getInterfaceContract());
+ endpoint.getCandidateBindings().addAll(componentReference.getBindings());
+ endpoints.add(endpoint);
+
+ // The bindings will be cloned back into the reference when the
+ // target is finally resolved.
+ warning("ComponentReferenceTargetNotFound", composite,
+ composite.getName().toString(), componentService.getName());
+ }
+ }
+ } else if (componentReference.getReference() != null) {
+
+ // Resolve targets from the corresponding reference in the
+ // componentType
+ for (ComponentService componentService : componentReference.getReference().getTargets()) {
+
+ // Resolve the target component and service
+ String name = componentService.getName();
+ ComponentService targetComponentService = componentServices.get(name);
+ Component targetComponent;
+ int s = name.indexOf('/');
+ if (s == -1) {
+ targetComponent = components.get(name);
+ } else {
+ targetComponent = components.get(name.substring(0, s));
+ }
+
+ if (targetComponentService != null) {
+
+ // Check that the target component service provides
+ // a superset of
+ // the component reference interface
+ if (componentReference.getInterfaceContract() == null ||
+ interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+
+ Endpoint endpoint = endpointFactory.createEndpoint();
+ endpoint.setTargetName(targetComponent.getName());
+ endpoint.setSourceComponent(null); // TODO - fixed up at start
+ endpoint.setSourceComponentReference(componentReference);
+ endpoint.setInterfaceContract(componentReference.getInterfaceContract());
+ endpoint.setTargetComponent(targetComponent);
+ endpoint.setTargetComponentService(targetComponentService);
+ endpoint.getCandidateBindings().addAll(componentReference.getBindings());
+ endpoints.add(endpoint);
+
+ // mark the reference target as resolved. Used later when we are looking to
+ // see if an sca binding is associated with a resolved target or not
+ componentService.setUnresolved(false);
+ } else {
+ warning("ComponentIncompatibleInterface", composite,
+ componentReference.getName(), componentService.getName());
+ }
+ } else {
+ // add all the reference bindings into the target so that they
+ // can be used for comparison when the target is resolved at runtime
+ componentService.getBindings().addAll(componentReference.getBindings());
+
+ // The bindings will be cloned back into the reference when the
+ // target is finally resolved.
+
+ Endpoint endpoint = endpointFactory.createEndpoint();
+ endpoint.setTargetName(name);
+ endpoint.setSourceComponent(null); // TODO - fixed up at start
+ endpoint.setSourceComponentReference(componentReference);
+ endpoint.setInterfaceContract(componentReference.getInterfaceContract());
+ endpoint.getCandidateBindings().addAll(componentReference.getBindings());
+ endpoints.add(endpoint);
+
+ warning("ComponentReferenceTargetNotFound", composite,
+ composite.getName().toString(), componentService.getName());
+ }
+ }
+ }
+
+
+ // if no endpoints have found so far retrieve any target names that are in binding URIs
+ if (endpoints.isEmpty()){
+ for (Binding binding : componentReference.getBindings()) {
+
+ String uri = binding.getURI();
+
+ // user hasn't put a uri on the binding so it's not a target name
+ if (uri == null) {
+ continue;
+ }
+
+ // user might have put a local target name in the uri so get
+ // the path part and see if it refers to a target we know about
+ // - if it does the reference binding will be matched with a service binding
+ // - if it doesn't it is assumed to be an external reference
+ Component targetComponent = null;
+ ComponentService targetComponentService = null;
+ String path = null;
+
+ try {
+ path = URI.create(uri).getPath();
+ } catch(Exception ex){
+ // just assume that no target is identified if
+ // a URI related exception is thrown
+ }
+
+ if (path != null) {
+ if (path.startsWith("/")) {
+ path = path.substring(1);
+ }
+
+ // Resolve the target component and service
+ targetComponentService = componentServices.get(path);
+ int s = path.indexOf('/');
+ if (s == -1) {
+ targetComponent = components.get(path);
+ } else {
+ targetComponent = components.get(path.substring(0, s));
+ }
+ }
+
+ // if the path of the binding URI matches a component in the
+ // composite then configure an endpoint with this component as the target
+ // if not then the binding URI will be assumed to reference an external service
+ if (targetComponentService != null) {
+
+ // Check that the target component service provides
+ // a superset of the component reference interface
+ if (componentReference.getInterfaceContract() == null ||
+ interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+
+ Endpoint endpoint = endpointFactory.createEndpoint();
+ endpoint.setTargetName(targetComponent.getName());
+ endpoint.setSourceComponent(null); // TODO - fixed up at start
+ endpoint.setSourceComponentReference(componentReference);
+ endpoint.setInterfaceContract(componentReference.getInterfaceContract());
+ endpoint.setTargetComponent(targetComponent);
+ endpoint.setTargetComponentService(targetComponentService);
+ endpoint.getCandidateBindings().add(binding);
+ endpoints.add(endpoint);
+ } else {
+ warning("ReferenceIncompatibleInterface",
+ composite,
+ composite.getName().toString(),
+ componentReference.getName(),
+ uri);
+ }
+ } else {
+
+ // create endpoints for manually configured bindings
+ Endpoint endpoint = endpointFactory.createEndpoint();
+ endpoint.setTargetName(uri);
+ endpoint.setSourceComponent(null); // TODO - fixed up at start
+ endpoint.setSourceComponentReference(componentReference);
+ endpoint.setInterfaceContract(componentReference.getInterfaceContract());
+ endpoint.setSourceBinding(binding);
+ endpoints.add(endpoint);
+ }
+ }
+ }
+
+ return endpoints;
+ }
+
+
+ /**
+ * Connect references to their targets.
+ *
+ * @param composite
+ * @param componentServices
+ * @param componentReferences
+ * @param problems
+ */
+ private void connectComponentReferences(Composite composite,
+ Map<String, Component> components,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences){
+
+ for (ComponentReference componentReference : componentReferences.values()) {
+
+ List<Endpoint> endpoints = createComponentReferenceTargets(composite,
+ components,
+ componentServices,
+ componentReference);
+
+ componentReference.getEndpoints().addAll(endpoints);
+
+ // the result of calculating the endpoints is either that bindings have been
+ // configured manually using a URI or that targets have been provided and the
+ // endpoint remains unresolved. So all endpoints should be either resved or uresolved.
+ boolean endpointsRequireAutomaticResolution = false;
+ for(Endpoint endpoint : endpoints){
+ endpointsRequireAutomaticResolution = endpoint.isUnresolved();
+ }
+
+ // build each endpoint
+ if (endpointsRequireAutomaticResolution) {
+
+ for(Endpoint endpoint : endpoints){
+ endpointBuilder.build(endpoint);
+ }
+
+ // TODO - The following step ensures that the reference binding list remains
+ // as the record of resolved targets for now. This needs fixing so
+ // that the endpoint takes on this responsibility.
+ componentReference.getBindings().clear();
+
+ if (componentReference.getCallback() != null){
+ componentReference.getCallback().getBindings().clear();
+ }
+
+ for(Endpoint endpoint : endpoints){
+ if (endpoint.isUnresolved() == false){
+ componentReference.getBindings().add(endpoint.getSourceBinding());
+
+ if (componentReference.getCallback() != null){
+ componentReference.getCallback().getBindings().add(endpoint.getSourceCallbackBinding());
+ }
+ }
+ }
+
+ } else {
+ // do nothing as no targets have been specified so the bindings
+ // in the reference binding list are assumed to be manually configured
+ }
+
+
+/*
+ // Select the reference bindings matching the target service bindings
+ List<Binding> selectedBindings = new ArrayList<Binding>();
+ List<Binding> selectedCallbackBindings = null;
+
+ // Handle callback
+ boolean bidirectional = false;
+
+ if (componentReference.getInterfaceContract() != null && componentReference.getInterfaceContract().getCallbackInterface() != null) {
+ bidirectional = true;
+ selectedCallbackBindings = new ArrayList<Binding>();
+ }
+
+ for (Target target : targets) {
+
+ Component targetComponent = target.getComponent();
+ ComponentService targetComponentService = target.getService();
+ if (targetComponentService.getService() instanceof CompositeService) {
+ CompositeService compositeService = (CompositeService) targetComponentService.getService();
+ // Find the promoted component service
+ targetComponentService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+ }
+
+ try {
+ PolicyConfigurationUtil.determineApplicableBindingPolicySets(componentReference, targetComponentService);
+ } catch ( Exception e ) {
+ warning("Policy related exception: " + e, e);
+ //throw new RuntimeException(e);
+ }
+
+ // Match the binding against the bindings of the target service
+ Binding selected = BindingConfigurationUtil.resolveBindings(componentReference, targetComponent, targetComponentService);
+ if (selected == null) {
+ warning("NoMatchingBinding", componentReference, componentReference.getName(), targetComponentService.getName());
+ } else {
+ selectedBindings.add(selected);
+ }
+ if (bidirectional) {
+ Binding selectedCallback = BindingConfigurationUtil.resolveCallbackBindings(componentReference, targetComponent, targetComponentService);
+ if (selectedCallback != null) {
+ selectedCallbackBindings.add(selectedCallback);
+ }
+ }
+ }
+*/
+
+ // Need to tidy up the reference binding list and add in the bindings that
+ // have been selected above. The situation so far...
+ // Wired reference (1 or more targets are specified)
+ // Binding.uri = null - remove as it's left over from target resolution
+ // the binding will have been moved to the target from where
+ // it will be resolved later
+ // Binding.uri != null - the selected and resolved reference binding
+ // Unwired reference (0 targets)
+ // Binding.uri = null - Either a callback reference or the reference is yet to be wired
+ // by the implementation so leave the binding where it is
+ // Binding.uri != null - from the composite file so leave it
+/*
+ if ((componentReference.getTargets().size() > 0) ||
+ (!targets.isEmpty())) {
+
+ // Add all the effective bindings
+ componentReference.getBindings().clear();
+ componentReference.getBindings().addAll(selectedBindings);
+ if (bidirectional) {
+ componentReference.getCallback().getBindings().clear();
+ componentReference.getCallback().getBindings().addAll(selectedCallbackBindings);
+ }
+
+ // add in sca bindings to represent all unresolved targets. The sca binding
+ // will try to resolve the target at a later date.
+ for (ComponentService service : componentReference.getTargets()) {
+ if (service.isUnresolved()) {
+ SCABinding scaBinding = null;
+
+ // find the sca binding amongst the candidate binding list. We want to
+ // find this one and clone it as it may have been configured with
+ // policies
+ for (Binding binding : service.getBindings()) {
+
+ if (binding instanceof SCABinding) {
+ try {
+ scaBinding = (SCABinding)((OptimizableBinding)binding).clone();
+ } catch (CloneNotSupportedException ex){
+ // we know it is supported on the SCA binding
+ }
+ break;
+ }
+ }
+
+ if (scaBinding != null) {
+ // configure the cloned SCA binding for this reference target
+ scaBinding.setName(service.getName());
+
+ // this service object holds the list of candidate bindings which
+ // can be used for later matching
+ ((OptimizableBinding)scaBinding).setTargetComponentService(service);
+ componentReference.getBindings().add(scaBinding);
+ } else {
+ // not sure we need to raise a warning here as a warning will already been
+ // thrown previously to indicate the reason why there is no sca binding
+ // warning("NoSCABindingAvailableForUnresolvedService", componentReference, componentReference.getName(), service.getName());
+ }
+ }
+ }
+ }
+
+*/
+ // Connect the optimizable bindings to their target component and
+ // service
+/*
+ for (Binding binding : componentReference.getBindings()) {
+ if (!(binding instanceof OptimizableBinding)) {
+ continue;
+ }
+ OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
+ if (optimizableBinding.getTargetComponentService() != null) {
+ continue;
+ }
+ String uri = optimizableBinding.getURI();
+ if (uri == null) {
+ continue;
+ }
+ uri = URI.create(uri).getPath();
+ if (uri.startsWith("/")) {
+ uri = uri.substring(1);
+ }
+
+ // Resolve the target component and service
+ ComponentService targetComponentService = componentServices.get(uri);
+ Component targetComponent;
+ int s = uri.indexOf('/');
+ if (s == -1) {
+ targetComponent = components.get(uri);
+ } else {
+ targetComponent = components.get(uri.substring(0, s));
+ }
+
+ if (targetComponentService != null) {
+
+ // Check that the target component service provides
+ // a superset of the component reference interface
+ if (componentReference.getInterfaceContract() == null ||
+ interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+
+ } else {
+ warning("ReferenceIncompatibleInterface",
+ composite,
+ composite.getName().toString(),
+ componentReference.getName(),
+ uri);
+ }
+ optimizableBinding.setTargetComponent(targetComponent);
+ optimizableBinding.setTargetComponentService(targetComponentService);
+ optimizableBinding.setTargetBinding(targetComponentService.getBinding(optimizableBinding.getClass()));
+ }
+ }
+*/
+ }
+ }
+
+ /**
+ * 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("WireSourceNotFound", composite, source.getName());
+ }
+ } 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("WireTargetNotFound", composite, source.getName());
+ }
+ } 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);
+ resolvedReference.getTargets().add(wire.getTarget());
+ } else {
+ warning("WireIncompatibleInterface", composite, source.getName(), target.getName());
+ }
+ }
+ }
+
+ // Clear the list of wires
+ composite.getWires().clear();
+ }
+
+ private void addPoliciesFromPromotedService(CompositeService compositeService) {
+ //inherit intents and policies from promoted service
+ PolicyComputationUtils.addInheritedIntents(compositeService.getPromotedService().getRequiredIntents(),
+ compositeService.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(compositeService.getPromotedService().getPolicySets(),
+ compositeService.getPolicySets(), true);
+ addInheritedOperationConfigurations(compositeService.getPromotedService(), compositeService);
+ }
+
+ private void addPoliciesFromPromotedReference(CompositeReference compositeReference) {
+ for ( Reference promotedReference : compositeReference.getPromotedReferences() ) {
+ PolicyComputationUtils.addInheritedIntents(promotedReference.getRequiredIntents(),
+ compositeReference.getRequiredIntents());
+
+ PolicyComputationUtils.addInheritedPolicySets(promotedReference.getPolicySets(),
+ compositeReference.getPolicySets(), true);
+ addInheritedOperationConfigurations(promotedReference, compositeReference);
+ }
+ }
+
+
+ protected void computePolicies(Composite composite) {
+
+ // compute policies recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ computePolicies((Composite)implementation);
+ }
+ }
+
+ for (Component component : composite.getComponents()) {
+
+ // Inherit default policies from the component to component-level contracts.
+ // This must be done BEFORE computing implementation policies because the
+ // implementation policy computer removes from the component any
+ // intents and policy sets that don't apply to implementations.
+ PolicyConfigurationUtil.inheritDefaultPolicies(component, component.getServices());
+ PolicyConfigurationUtil.inheritDefaultPolicies(component, component.getReferences());
+
+ Implementation implemenation = component.getImplementation();
+ try {
+ PolicyConfigurationUtil.computeImplementationIntentsAndPolicySets(implemenation, component);
+ } catch ( Exception e ) {
+ error("PolicyRelatedException", implemenation, e);
+ //throw new RuntimeException(e);
+ }
+
+ for (ComponentService componentService : component.getServices()) {
+ Service service = componentService.getService();
+ if (service != null) {
+ // reconcile intents and policysets from componentType
+ PolicyComputationUtils.addInheritedIntents(service.getRequiredIntents(), componentService.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(service.getPolicySets(), componentService.getPolicySets(), true);
+
+ //reconcile intents and policysets for operations
+ boolean notFound;
+ List<ConfiguredOperation> opsFromComponentType = new ArrayList<ConfiguredOperation>();
+ for ( ConfiguredOperation ctsConfOp : service.getConfiguredOperations() ) {
+ notFound = true;
+ for ( ConfiguredOperation csConfOp : componentService.getConfiguredOperations() ) {
+ if ( csConfOp.getName().equals(ctsConfOp.getName()) ) {
+ PolicyComputationUtils.addInheritedIntents(ctsConfOp.getRequiredIntents(), csConfOp.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(ctsConfOp.getPolicySets(), csConfOp.getPolicySets(), true);
+ notFound = false;
+ }
+ }
+
+ if ( notFound ) {
+ opsFromComponentType.add(ctsConfOp);
+ }
+ }
+ componentService.getConfiguredOperations().addAll(opsFromComponentType);
+ }
+
+ try {
+ //compute the intents for operations under service element
+ PolicyConfigurationUtil.computeIntentsForOperations(componentService);
+ //compute intents and policyset for each binding
+ //addInheritedOpConfOnBindings(componentService);
+ PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(componentService);
+ PolicyConfigurationUtil.determineApplicableBindingPolicySets(componentService, null);
+
+ } catch ( Exception e ) {
+ error("PolicyRelatedException", componentService, e);
+ //throw new RuntimeException(e);
+ }
+ }
+
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference reference = componentReference.getReference();
+ if (reference != null) {
+ // reconcile intents and policysets
+ PolicyComputationUtils.addInheritedIntents(reference.getRequiredIntents(), componentReference.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(reference.getPolicySets(), componentReference.getPolicySets(), true);
+ }
+
+
+ try {
+ //compute the intents for operations under reference element
+ PolicyConfigurationUtil.computeIntentsForOperations(componentReference);
+ //compute intents and policyset for each binding
+ //addInheritedOpConfOnBindings(componentReference);
+ PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(componentReference);
+ PolicyConfigurationUtil.determineApplicableBindingPolicySets(componentReference, null);
+
+
+ if ( componentReference.getCallback() != null ) {
+ PolicyComputationUtils.addInheritedIntents(componentReference.getRequiredIntents(),
+ componentReference.getCallback().getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(componentReference.getPolicySets(),
+ componentReference.getCallback().getPolicySets(),
+ false);
+ }
+ } catch ( Exception e ) {
+ error("PolicyRelatedException", componentReference, e);
+ //throw new RuntimeException(e);
+ }
+ }
+ }
+
+ PolicyConfigurationUtil.inheritDefaultPolicies(composite, composite.getServices());
+ PolicyConfigurationUtil.inheritDefaultPolicies(composite, composite.getReferences());
+
+ //compute policies for composite service bindings
+ for (Service service : composite.getServices()) {
+ addPoliciesFromPromotedService((CompositeService)service);
+ try {
+ //compute the intents for operations under service element
+ PolicyConfigurationUtil.computeIntentsForOperations(service);
+ //add or merge service operations to the binding
+ //addInheritedOpConfOnBindings(service);
+ PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(service);
+ PolicyConfigurationUtil.determineApplicableBindingPolicySets(service, null);
+ } catch ( Exception e ) {
+ error("PolicyRelatedException", service, e);
+ //throw new RuntimeException(e);
+ }
+
+ }
+
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compReference = (CompositeReference)reference;
+ addPoliciesFromPromotedReference(compReference);
+ try {
+ //compute the intents for operations under service element
+ PolicyConfigurationUtil.computeIntentsForOperations(reference);
+ //addInheritedOpConfOnBindings(reference);
+
+ if (compReference.getCallback() != null) {
+ PolicyComputationUtils.addInheritedIntents(compReference.getRequiredIntents(),
+ compReference.getCallback().getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(compReference.getPolicySets(),
+ compReference.getCallback().getPolicySets(),
+ false);
+ }
+
+ PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(reference);
+ PolicyConfigurationUtil.determineApplicableBindingPolicySets(reference, null);
+ } catch ( Exception e ) {
+ error("PolicyRelatedException", reference, e);
+ //throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+ private void addInheritedOperationConfigurations(OperationsConfigurator source,
+ OperationsConfigurator target) {
+ boolean found = false;
+
+ List<ConfiguredOperation> additionalOperations = new ArrayList<ConfiguredOperation>();
+ for ( ConfiguredOperation sourceConfOp : source.getConfiguredOperations() ) {
+ for ( ConfiguredOperation targetConfOp : target.getConfiguredOperations() ) {
+ if ( sourceConfOp.getName().equals(targetConfOp.getName())) {
+ PolicyComputationUtils.addInheritedIntents(sourceConfOp.getRequiredIntents(),
+ targetConfOp.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(sourceConfOp.getPolicySets(),
+ targetConfOp.getPolicySets(), true);
+ found = true;
+ break;
+ }
+ }
+
+ if ( !found ) {
+ additionalOperations.add(sourceConfOp);
+ }
+ }
+
+ if ( !additionalOperations.isEmpty() ) {
+ target.getConfiguredOperations().addAll(additionalOperations);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
new file mode 100644
index 0000000000..4016d02a36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * This class encapsulates utility methods to deal with binding definitions
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class BindingConfigurationUtil {
+ private static boolean hasCompatiblePolicySets(Binding refBinding, Binding svcBinding) {
+ boolean isCompatible = true;
+ if ( refBinding instanceof PolicySetAttachPoint && svcBinding instanceof PolicySetAttachPoint ) {
+ //TODO : need to add more compatibility checks at the policy attachment levels
+ for ( PolicySet svcPolicySet : ((PolicySetAttachPoint)svcBinding).getPolicySets() ) {
+ isCompatible = false;
+ for ( PolicySet refPolicySet : ((PolicySetAttachPoint)refBinding).getPolicySets() ) {
+ if ( svcPolicySet.equals(refPolicySet) ) {
+ isCompatible = true;
+ break;
+ }
+ }
+ //if there exists no matching policy set in the reference binding
+ if ( !isCompatible ) {
+ return isCompatible;
+ }
+ }
+ }
+ return isCompatible;
+ }
+
+
+ static Binding matchBinding(Component targetComponent, ComponentService targetComponentService, List<Binding> source, List<Binding> target) {
+ List<Binding> matched = new ArrayList<Binding>();
+ // Find the corresponding bindings from the service side
+ for (Binding binding : source) {
+ for (Binding serviceBinding : target) {
+ if (binding.getClass() == serviceBinding.getClass() &&
+ hasCompatiblePolicySets(binding, serviceBinding)) {
+
+ try {
+ Binding cloned = (Binding)binding.clone();
+
+ //Customise the binding name to make it unique
+ // regardless of how many bindings or targets there are
+ if ( targetComponent != null){
+ cloned.setName(binding.getName() + "#" + targetComponent.getName() + "/" + serviceBinding.getName());
+ } else {
+ cloned.setName(binding.getName() + "#" + serviceBinding.getName());
+ }
+
+ // Set the binding URI to the URI of the target service
+ // that has been matched
+ if (binding.getURI() == null) {
+ cloned.setURI(serviceBinding.getURI());
+ }
+
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding endpoint = ((OptimizableBinding)cloned);
+ endpoint.setTargetComponent(targetComponent);
+ endpoint.setTargetComponentService(targetComponentService);
+ endpoint.setTargetBinding(serviceBinding);
+ }
+
+ matched.add(cloned);
+ break;
+ } catch (Exception ex) {
+ // do nothing
+ }
+ }
+ }
+ }
+ if (matched.isEmpty()) {
+ // No matching binding
+ return null;
+ } else {
+ for (Binding binding : matched) {
+ // If binding.sca is present, use it
+ if (SCABinding.class.isInstance(binding)) {
+ return binding;
+ }
+ }
+ // Use the first one
+ return matched.get(0);
+ }
+ }
+
+ /**
+ * Choose a binding for the reference based on the bindings available on the
+ * service
+ *
+ * @param reference The component reference
+ * @param service The component service
+ * @return Resolved binding
+ */
+ static Binding resolveBindings(ComponentReference reference, Component component, ComponentService service) {
+ List<Binding> source = reference.getBindings();
+ List<Binding> target = service.getBindings();
+
+ return matchBinding(component, service, source, target);
+
+ }
+
+
+ /**
+ * @param reference
+ * @param service
+ * @return
+ */
+ static Binding resolveCallbackBindings(ComponentReference reference, Component component, ComponentService service) {
+ List<Binding> source = reference.getCallback().getBindings();
+ List<Binding> target = service.getCallback().getBindings();
+
+ return matchBinding(component, service, source, target);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
new file mode 100644
index 0000000000..0643421a45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.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.assembly.builder.impl;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that handles the configuration of components.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentConfigurationBuilderImpl extends BaseConfigurationBuilderImpl implements CompositeBuilder {
+
+ @Deprecated
+ public ComponentConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+ super(assemblyFactory, scaBindingFactory,
+ null, null,
+ interfaceContractMapper, policyDefinitions, monitor);
+ }
+
+ public ComponentConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+ super(assemblyFactory, scaBindingFactory,
+ documentBuilderFactory, transformerFactory,
+ interfaceContractMapper, policyDefinitions, monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ configureComponents(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java
new file mode 100644
index 0000000000..4913705e91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.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.assembly.builder.impl;
+
+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.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that performs any additional building steps that
+ * component reference bindings may need. Used for WSDL generation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentReferenceBindingBuilderImpl implements CompositeBuilder {
+ private Monitor monitor;
+
+ public ComponentReferenceBindingBuilderImpl(Monitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ buildReferenceBindings(composite);
+ }
+
+ private void buildReferenceBindings(Composite composite) {
+
+ // find all the component reference bindings (starting at top level)
+ for (Component component : composite.getComponents()) {
+ for (ComponentReference componentReference : component.getReferences()) {
+ for (Binding binding : componentReference.getBindings()) {
+ if (binding instanceof BindingBuilderExtension) {
+ ((BindingBuilderExtension)binding).getBuilder().build(component, componentReference, binding, monitor);
+ }
+ }
+ }
+ }
+
+ // build bindings recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ buildReferenceBindings((Composite)implementation);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
new file mode 100644
index 0000000000..c0702c87b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.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.assembly.builder.impl;
+
+import java.util.List;
+
+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.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that handles the creation of promoted composite services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentReferencePromotionWireBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+ private EndpointFactory endpointFactory;
+ private Monitor monitor;
+
+ public ComponentReferencePromotionWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, Monitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.endpointFactory = endpointFactory;
+ this.monitor = monitor;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ wireCompositeReferences(composite);
+ }
+
+ /**
+ * Wire composite references in nested composites.
+ *
+ * @param composite
+ * @param problems
+ */
+ private 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 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()) {
+ Reference implReference = componentReference.getReference();
+ if (implReference != null && implReference instanceof CompositeReference) {
+
+ // If the component reference is wired, it is a promotion override
+ if (!componentReference.getEndpoints().isEmpty()) {
+ componentReference.setPromotionOverride(true);
+ }
+
+ // If the component reference is a promotion override, override the
+ // configuration of the promoted reference
+ if (componentReference.isPromotionOverride()) {
+ CompositeReference compositeReference = (CompositeReference)implReference;
+ List<ComponentReference> promotedReferences =
+ ReferenceConfigurationUtil.getPromotedComponentReferences(compositeReference);
+ for (ComponentReference promotedReference : promotedReferences) {
+ ReferenceConfigurationUtil.reconcileReferenceBindings(
+ componentReference, promotedReference, assemblyFactory, endpointFactory, monitor);
+ if (componentReference.getInterfaceContract() != null && // can be null in unit tests
+ componentReference.getInterfaceContract().getCallbackInterface() != null) {
+ SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
+ if (promotedReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().clear();
+ } else {
+ promotedReference.setCallback(assemblyFactory.createCallback());
+ }
+ if (scaCallbackBinding != null) {
+ promotedReference.getCallback().getBindings().add(scaCallbackBinding);
+ }
+ if (componentReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().addAll(componentReference
+ .getCallback().getBindings());
+ }
+ }
+
+ // Wire the promoted reference to the actual non-composite component services
+ if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE) {
+ // 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();
+ // Find the promoted component service
+ ComponentService componentService =
+ ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+ 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);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
new file mode 100644
index 0000000000..927330b139
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.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.assembly.builder.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that wires component references.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentReferenceWireBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
+
+ public ComponentReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
+ super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ wireComponentReferences(composite);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java
new file mode 100644
index 0000000000..12ea86eac3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.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.builder.impl;
+
+import org.apache.tuscany.sca.assembly.Binding;
+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.Implementation;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
+import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that performs any additional building steps that
+ * component service bindings may need. Used for WSDL generation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentServiceBindingBuilderImpl implements CompositeBuilder {
+ private Monitor monitor;
+
+ public ComponentServiceBindingBuilderImpl(Monitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ buildServiceBindings(composite);
+ }
+
+ private void buildServiceBindings(Composite composite) {
+
+ // build bindings recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ buildServiceBindings((Composite)implementation);
+ }
+ }
+
+ // find all the component service bindings
+ for (Component component : composite.getComponents()) {
+ for (ComponentService componentService : component.getServices()) {
+ for (Binding binding : componentService.getBindings()) {
+ if (binding instanceof BindingBuilderExtension) {
+ BindingBuilder builder = ((BindingBuilderExtension)binding).getBuilder();
+ if (builder != null) {
+ builder.build(component, componentService, binding, monitor);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java
new file mode 100644
index 0000000000..d73286f7ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.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.assembly.builder.impl;
+
+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.Service;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+
+/**
+ * A composite builder that handles the creation of promoted services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentServicePromotionBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+
+ public ComponentServicePromotionBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Process nested composites recursively
+ configureNestedCompositeServices(composite);
+ }
+
+ private void configureNestedCompositeServices(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // First process nested composites
+ configureNestedCompositeServices((Composite)implementation);
+
+ // Process the component services declared on components in this composite
+ for (ComponentService componentService : component.getServices()) {
+ Service implService = componentService.getService();
+ if (implService != null && implService instanceof CompositeService) {
+ CompositeService compositeService = (CompositeService)implService;
+
+ // Get the innermost promoted service
+ ComponentService promotedService =
+ ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+ if (promotedService != null) {
+ Component promotedComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
+
+ // Create a new component service to represent this
+ // component service on the promoted component
+ ComponentService newComponentService = assemblyFactory.createComponentService();
+ newComponentService.setName("$promoted$" + component.getName() + "$slash$" + componentService.getName());
+ promotedComponent.getServices().add(newComponentService);
+ newComponentService.setService(promotedService.getService());
+ newComponentService.getBindings().addAll(componentService.getBindings());
+ newComponentService.setInterfaceContract(componentService.getInterfaceContract());
+
+ if (componentService.getInterfaceContract() != null &&
+ componentService.getInterfaceContract().getCallbackInterface() != null) {
+ newComponentService.setCallback(assemblyFactory.createCallback());
+ newComponentService.getCallback().getBindings()
+ .addAll(componentService.getCallback().getBindings());
+ }
+
+ // Change the composite service to now promote the
+ // newly created component service directly
+ compositeService.setPromotedComponent(promotedComponent);
+ compositeService.setPromotedService(newComponentService);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
new file mode 100644
index 0000000000..85af173c0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.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.assembly.builder.impl;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that handles the configuration of binding URIs.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBindingURIBuilderImpl extends BaseConfigurationBuilderImpl implements CompositeBuilder {
+
+ @Deprecated
+ public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+ super(assemblyFactory, scaBindingFactory,
+ null, null,
+ interfaceContractMapper, policyDefinitions, monitor);
+ }
+
+ public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+ super(assemblyFactory, scaBindingFactory,
+ documentBuilderFactory, transformerFactory,
+ interfaceContractMapper, policyDefinitions, monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ configureBindingURIsAndNames(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
new file mode 100644
index 0000000000..282fe032ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.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.assembly.builder.impl;
+
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultEndpointFactory;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * 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 static final Logger logger = Logger.getLogger(CompositeBuilderImpl.class.getName());
+ private CompositeBuilder compositeIncludeBuilder;
+ private CompositeBuilder componentReferenceWireBuilder;
+ private CompositeBuilder componentReferencePromotionWireBuilder;
+ private CompositeBuilder compositeReferenceWireBuilder;
+ private CompositeBuilder compositeCloneBuilder;
+ private CompositeBuilder componentConfigurationBuilder;
+ private CompositeBuilder compositeServiceConfigurationBuilder;
+ private CompositeBuilder compositeReferenceConfigurationBuilder;
+ private CompositeBuilder compositeBindingURIBuilder;
+ private CompositeBuilder componentServicePromotionBuilder;
+ private CompositeBuilder compositeServicePromotionBuilder;
+ private CompositeBuilder compositePromotionBuilder;
+ private CompositeBuilder compositePolicyBuilder;
+ private CompositeBuilder componentServiceBindingBuilder;
+ private CompositeBuilder componentReferenceBindingBuilder;
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param endpointFactory
+ * @param intentAttachPointTypeFactory
+ * @param interfaceContractMapper
+ * @param policyDefinitions
+ * @param monitor
+ */
+ @Deprecated
+ public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ EndpointFactory endpointFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+ this(assemblyFactory, endpointFactory, scaBindingFactory, intentAttachPointTypeFactory,
+ null, null, interfaceContractMapper, policyDefinitions, monitor);
+ }
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param endpointFactory
+ * @param intentAttachPointTypeFactory
+ * @param interfaceContractMapper
+ * @param policyDefinitions
+ * @param monitor
+ */
+ @Deprecated
+ public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ Monitor monitor) {
+ this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
+ null, null, interfaceContractMapper, null, monitor);
+ }
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param intentAttachPointTypeFactory
+ * @param documentBuilderFactory
+ * @param transformerFactory
+ * @param interfaceContractMapper
+ * @param monitor
+ */
+ public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ Monitor monitor) {
+ this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
+ documentBuilderFactory, transformerFactory, interfaceContractMapper, null, monitor);
+ }
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param endpointFactory
+ * @param intentAttachPointTypeFactory
+ * @param interfaceContractMapper
+ * @param policyDefinitions
+ * @param monitor
+ */
+ public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ EndpointFactory endpointFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+
+ if (endpointFactory == null){
+ endpointFactory = new DefaultEndpointFactory();
+ }
+
+ compositeIncludeBuilder = new CompositeIncludeBuilderImpl(monitor);
+ componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
+ compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
+ compositeCloneBuilder = new CompositeCloneBuilderImpl(monitor);
+ componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
+ compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(assemblyFactory);
+ compositeReferenceConfigurationBuilder = new CompositeReferenceConfigurationBuilderImpl(assemblyFactory);
+ compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
+ componentServicePromotionBuilder = new ComponentServicePromotionBuilderImpl(assemblyFactory);
+ compositeServicePromotionBuilder = new CompositeServicePromotionBuilderImpl(assemblyFactory);
+ compositePromotionBuilder = new CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ compositePolicyBuilder = new CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ componentServiceBindingBuilder = new ComponentServiceBindingBuilderImpl(monitor);
+ componentReferenceBindingBuilder = new ComponentReferenceBindingBuilderImpl(monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Collect and fuse includes
+ compositeIncludeBuilder.build(composite);
+
+ // Expand nested composites
+ compositeCloneBuilder.build(composite);
+
+ // Configure all components
+ componentConfigurationBuilder.build(composite);
+
+ // Connect composite services/references to promoted services/references
+ compositePromotionBuilder.build(composite);
+
+ // Compute the policies across the model hierarchy
+ compositePolicyBuilder.build(composite);
+
+ // Configure composite services
+ compositeServiceConfigurationBuilder.build(composite);
+
+ // Configure composite references
+ compositeReferenceConfigurationBuilder.build(composite);
+
+ // Configure binding URIs
+ compositeBindingURIBuilder.build(composite);
+
+ // Create promoted component services
+ componentServicePromotionBuilder.build(composite);
+
+ // Create promoted composite services
+ compositeServicePromotionBuilder.build(composite);
+
+ // Build component service binding-related information
+ componentServiceBindingBuilder.build(composite);
+
+ // Wire the components
+ componentReferenceWireBuilder.build(composite);
+
+ // Wire the promoted component references
+ componentReferencePromotionWireBuilder.build(composite);
+
+ // Wire the composite references
+ compositeReferenceWireBuilder.build(composite);
+
+ // Build component reference binding-related information
+ componentReferenceBindingBuilder.build(composite);
+
+ // Fuse nested composites
+ //FIXME do this later
+ //cloneBuilder.fuseCompositeImplementations(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
new file mode 100644
index 0000000000..5779ddbc78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that clones nested composites.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeCloneBuilderImpl implements CompositeBuilder {
+
+ public CompositeCloneBuilderImpl(Monitor monitor) {
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ expandCompositeImplementations(composite);
+ }
+
+ /**
+ * Expand composite component implementations.
+ *
+ * @param composite
+ * @param problems
+ */
+ private void expandCompositeImplementations(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);
+ expandCompositeImplementations(clone);
+ }
+ }
+ }
+
+ /**
+ * Collect all nested composite implementations in a graph of composites.
+ *
+ * @param composite
+ * @param nested
+ */
+ private void collectNestedComposites(Composite composite, List<Composite> nested) {
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ Composite nestedComposite = (Composite)implementation;
+ nested.add(nestedComposite);
+ collectNestedComposites(nestedComposite, nested);
+ }
+ }
+ }
+
+ /**
+ * Fuse nested composites into a top level composite.
+ *
+ * @param composite
+ */
+ private void fuseCompositeImplementations(Composite composite) {
+
+ // First collect all nested composites
+ List<Composite> nested = new ArrayList<Composite>();
+ collectNestedComposites(composite, nested);
+
+ // Then add all the non-composite components they contain
+ for (Composite nestedComposite : nested) {
+ for (Component component: nestedComposite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (!(implementation instanceof Composite)) {
+ composite.getComponents().add(component);
+ }
+ }
+ }
+
+ // Clear the initial list of composite components
+ for (Iterator<Component> i = composite.getComponents().iterator(); i.hasNext();) {
+ Component component = i.next();
+ if (component.getImplementation() instanceof Composite) {
+ i.remove();
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java
new file mode 100644
index 0000000000..539ad8d137
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * Implementation of a CompositeBuilder.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeIncludeBuilderImpl implements CompositeBuilder {
+
+ private Monitor monitor;
+
+ public CompositeIncludeBuilderImpl(Monitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ fuseIncludes(composite);
+ }
+
+ private void warning(String message, Object model, String... messageParameters) {
+ if (monitor != null){
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Collect all includes in a graph of includes.
+ *
+ * @param composite
+ * @param includes
+ */
+ private void collectIncludes(Composite composite, List<Composite> includes, Set<Composite> visited) {
+ for (Composite include : composite.getIncludes()) {
+ if (visited.contains(include)) {
+ warning("CompositeAlreadyIncluded", composite, include.getName().toString());
+ continue;
+ }
+
+ includes.add(include);
+ visited.add(include);
+ collectIncludes(include, includes, visited);
+ }
+ }
+
+ /**
+ * Copy a list of includes into a composite.
+ *
+ * @param composite
+ */
+ private void fuseIncludes(Composite composite) {
+
+ // First collect all includes
+ List<Composite> includes = new ArrayList<Composite>();
+ Set<Composite> visited = new HashSet<Composite>();
+ visited.add(composite);
+ collectIncludes(composite, includes, visited);
+ // 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();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
new file mode 100644
index 0000000000..76ed861167
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.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.assembly.builder.impl;
+
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that computes policy sets based on attached intents and policy sets.
+ * Useful if you want to build the model without making any runtime decisions such as
+ * reference/services matching
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositePolicyBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
+
+ public CompositePolicyBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
+ super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ computePolicies(composite);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
new file mode 100644
index 0000000000..5a6437b3a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.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.builder.impl;
+
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that makes the connections between composite services and references
+ * and the services and references that they promote
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositePromotionBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
+
+ public CompositePromotionBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
+ super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ connectCompositeReferencesAndServices(composite);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
new file mode 100644
index 0000000000..41462b151d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.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.assembly.builder.impl;
+
+import java.util.List;
+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.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+
+/**
+ * A composite builder that handles the configuration of composite references.
+ *
+ * @version $Rev: 651179 $ $Date: 2008-04-24 08:21:13 +0100 (Thu, 24 Apr 2008) $
+ */
+public class CompositeReferenceConfigurationBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+
+ public CompositeReferenceConfigurationBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Process nested composites recursively
+ configureNestedCompositeReferences(composite);
+
+ // Process top level composite references
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+
+ // Get the next lower level promoted reference
+ List<ComponentReference> promotedRefs = compositeReference.getPromotedReferences();
+ if (!promotedRefs.isEmpty()) {
+ if (promotedRefs.size() == 1) {
+ ComponentReference promotedReference = promotedRefs.get(0);
+
+ // Set the bindings using the top level bindings to override the lower level bindings
+ if (bindingsSpecifiedManually(compositeReference.getBindings())) {
+ compositeReference.setPromotionOverride(true);
+ } else if (bindingsSpecifiedManually(promotedReference.getBindings()) ) {
+ compositeReference.getBindings().clear();
+ for (Binding binding : promotedReference.getBindings()) {
+ try {
+ compositeReference.getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted reference
+ }
+ }
+ }
+ if (compositeReference.getInterfaceContract() != null &&
+ compositeReference.getInterfaceContract().getCallbackInterface() != null) {
+ if (compositeReference.getCallback() != null &&
+ bindingsSpecifiedManually(compositeReference.getCallback().getBindings())) {
+ compositeReference.setPromotionOverride(true);
+ } else if (promotedReference.getCallback() != null &&
+ bindingsSpecifiedManually(promotedReference.getCallback().getBindings())) {
+ if (compositeReference.getCallback() != null) {
+ compositeReference.getCallback().getBindings().clear();
+ } else {
+ compositeReference.setCallback(assemblyFactory.createCallback());
+ }
+ for (Binding binding : promotedReference.getCallback().getBindings()) {
+ try {
+ compositeReference.getCallback().getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted reference
+ }
+ }
+ }
+ }
+ } else {
+ // This composite reference promotes multiple component references.
+ // Because the component reference bindings can all be different, we don't
+ // copy any of them up to this composite reference, which will therefore always
+ // have its own binding, even if it's only the default SCA binding.
+ if (bindingsSpecifiedManually(compositeReference.getBindings()) ||
+ (compositeReference.getCallback() != null &&
+ bindingsSpecifiedManually(compositeReference.getCallback().getBindings()))) {
+ compositeReference.setPromotionOverride(true);
+ }
+ }
+ }
+ }
+ }
+
+ private void configureNestedCompositeReferences(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // First process nested composites
+ configureNestedCompositeReferences((Composite)implementation);
+
+ // Process the component references declared on components in this composite
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference implReference = componentReference.getReference();
+ if (implReference != null && implReference instanceof CompositeReference) {
+ CompositeReference compositeReference = (CompositeReference)implReference;
+
+ // Get the next lower level promoted reference
+ List<ComponentReference> promotedRefs = compositeReference.getPromotedReferences();
+ if (!promotedRefs.isEmpty()) {
+ if (promotedRefs.size() == 1) {
+ ComponentReference promotedReference = promotedRefs.get(0);
+
+ // Set the bindings using the top level bindings to override the lower level bindings
+ if (!bindingsSpecifiedManually(compositeReference.getBindings()) &&
+ bindingsSpecifiedManually(promotedReference.getBindings()) ) {
+ compositeReference.getBindings().clear();
+ for (Binding binding : promotedReference.getBindings()) {
+ try {
+ compositeReference.getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted reference
+ }
+ }
+ }
+ if (bindingsSpecifiedManually(componentReference.getBindings())) {
+ componentReference.setPromotionOverride(true);
+ } else if (bindingsSpecifiedManually(compositeReference.getBindings()) ) {
+ componentReference.getBindings().clear();
+ componentReference.getBindings().addAll(compositeReference.getBindings());
+ }
+ if (componentReference.getInterfaceContract() != null &&
+ componentReference.getInterfaceContract().getCallbackInterface() != null) {
+ if (!(compositeReference.getCallback() != null &&
+ bindingsSpecifiedManually(compositeReference.getCallback().getBindings())) &&
+ promotedReference.getCallback() != null &&
+ bindingsSpecifiedManually(promotedReference.getCallback().getBindings())) {
+ if (compositeReference.getCallback() != null) {
+ compositeReference.getCallback().getBindings().clear();
+ } else {
+ compositeReference.setCallback(assemblyFactory.createCallback());
+ }
+ compositeReference.getCallback().getBindings().addAll(
+ promotedReference.getCallback().getBindings());
+ }
+ if (componentReference.getCallback() != null &&
+ bindingsSpecifiedManually(componentReference.getCallback().getBindings())) {
+ componentReference.setPromotionOverride(true);
+ } else if (compositeReference.getCallback() != null &&
+ bindingsSpecifiedManually(compositeReference.getCallback().getBindings())) {
+ if (componentReference.getCallback() != null) {
+ componentReference.getCallback().getBindings().clear();
+ } else {
+ componentReference.setCallback(assemblyFactory.createCallback());
+ }
+ for (Binding binding : compositeReference.getCallback().getBindings()) {
+ try {
+ componentReference.getCallback().getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted reference
+ }
+ }
+ }
+ }
+ } else {
+ // This component reference promotes multiple lower-level component references.
+ // Because the lower-level component reference bindings can all be different,
+ // we don't copy any of them up to this component reference, which will therefore
+ // always have its own binding, even if it's only the default SCA binding.
+ if (bindingsSpecifiedManually(componentReference.getBindings()) ||
+ (componentReference.getCallback() != null &&
+ bindingsSpecifiedManually(componentReference.getCallback().getBindings()))) {
+ componentReference.setPromotionOverride(true);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * If the bindings are specified in the composite file return true as they should
+ * otherwise return false
+ *
+ * @param bindings
+ * @return true if the bindings were specified manually
+ */
+ private boolean bindingsSpecifiedManually(List<Binding> bindings) {
+
+ if (bindings.size() > 1) {
+ return true;
+ } else if (bindings.size() == 1 &&
+ bindings.get(0) instanceof AutomaticBinding &&
+ ((AutomaticBinding)bindings.get(0)).getIsAutomatic()) {
+ return false;
+ } else if (bindings.size() == 1) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java
new file mode 100644
index 0000000000..8aa1897311
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.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.assembly.builder.impl;
+
+import java.util.List;
+
+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.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that wires composite references.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeReferenceWireBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+ private EndpointFactory endpointFactory;
+ private Monitor monitor;
+
+ public CompositeReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, Monitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.endpointFactory = endpointFactory;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Wire composite references in a deployment composite.
+ *
+ * @param composite
+ */
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Process composite references declared in this composite
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+
+ // If the composite reference is a promotion override, override the
+ // configuration of the promoted reference.
+ //FIXME: Policy configuration or wiring of domain-level composite references
+ // doesn't cause a promotion override, unless the composite reference has
+ // additional bindings. Do we need to detect this and force an override?
+ if (compositeReference.isPromotionOverride()) {
+ List<ComponentReference> promotedReferences =
+ ReferenceConfigurationUtil.getPromotedComponentReferences(compositeReference);
+ for (ComponentReference promotedReference : promotedReferences) {
+ ReferenceConfigurationUtil.reconcileReferenceBindings(
+ compositeReference, promotedReference, assemblyFactory, endpointFactory, monitor);
+ if (compositeReference.getInterfaceContract() != null && // can be null in unit tests
+ compositeReference.getInterfaceContract().getCallbackInterface() != null) {
+ SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
+ if (promotedReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().clear();
+ } else {
+ promotedReference.setCallback(assemblyFactory.createCallback());
+ }
+ if (scaCallbackBinding != null) {
+ promotedReference.getCallback().getBindings().add(scaCallbackBinding);
+ }
+ if (compositeReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().addAll(compositeReference.getCallback()
+ .getBindings());
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java
new file mode 100644
index 0000000000..3aa9f3bf85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.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.assembly.builder.impl;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that performs any additional building steps that
+ * composite service bindings may need. Used for WSDL generation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeServiceBindingBuilderImpl implements CompositeBuilder {
+ private Monitor monitor;
+
+ public CompositeServiceBindingBuilderImpl(Monitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ buildServiceBindings(composite);
+ }
+
+ private void buildServiceBindings(Composite composite) {
+
+ // build bindings recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ buildServiceBindings((Composite)implementation);
+ }
+ }
+
+ // find all the composite service bindings
+ for (Service service : composite.getServices()) {
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof BindingBuilderExtension) {
+ Component component = ServiceConfigurationUtil.getPromotedComponent((CompositeService)service);
+ ((BindingBuilderExtension)binding).getBuilder().build(component, service, binding, monitor);
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
new file mode 100644
index 0000000000..a3f31ea2fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.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.assembly.builder.impl;
+
+import java.util.List;
+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.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+
+/**
+ * A composite builder that handles the configuration of composite services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeServiceConfigurationBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+
+ public CompositeServiceConfigurationBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Process nested composites recursively
+ configureNestedCompositeServices(composite);
+
+ // Process top level composite services
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+
+ // Get the next lower level promoted service
+ ComponentService promotedService = compositeService.getPromotedService();
+ if (promotedService != null) {
+
+ // Set the bindings using the top level bindings to override the lower level bindings
+ if (!bindingsSpecifiedManually(compositeService.getBindings()) &&
+ bindingsSpecifiedManually(promotedService.getBindings())) {
+ compositeService.getBindings().clear();
+ for (Binding binding : promotedService.getBindings()) {
+ try {
+ compositeService.getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted service
+ }
+ }
+ }
+ if (compositeService.getInterfaceContract() != null &&
+ compositeService.getInterfaceContract().getCallbackInterface() != null) {
+ if (!(compositeService.getCallback() != null &&
+ bindingsSpecifiedManually(compositeService.getCallback().getBindings())) &&
+ promotedService.getCallback() != null &&
+ bindingsSpecifiedManually(promotedService.getCallback().getBindings())) {
+ if (compositeService.getCallback() != null) {
+ compositeService.getCallback().getBindings().clear();
+ } else {
+ compositeService.setCallback(assemblyFactory.createCallback());
+ }
+ for (Binding binding : promotedService.getCallback().getBindings()) {
+ try {
+ compositeService.getCallback().getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted service
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void configureNestedCompositeServices(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // First process nested composites
+ configureNestedCompositeServices((Composite)implementation);
+
+ // Process the component services declared on components in this composite
+ for (ComponentService componentService : component.getServices()) {
+ Service implService = componentService.getService();
+ if (implService != null && implService instanceof CompositeService) {
+ CompositeService compositeService = (CompositeService)implService;
+
+ // Get the next lower level promoted service
+ ComponentService promotedService = compositeService.getPromotedService();
+ if (promotedService != null) {
+
+ // Set the bindings using the top level bindings to override the lower level bindings
+ if (!bindingsSpecifiedManually(compositeService.getBindings()) &&
+ bindingsSpecifiedManually(promotedService.getBindings()) ) {
+ compositeService.getBindings().clear();
+ for (Binding binding : promotedService.getBindings()) {
+ try {
+ compositeService.getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted service
+ }
+ }
+ }
+ if (!bindingsSpecifiedManually(componentService.getBindings()) &&
+ bindingsSpecifiedManually(compositeService.getBindings()) ) {
+ componentService.getBindings().clear();
+ componentService.getBindings().addAll(compositeService.getBindings());
+ }
+ if (componentService.getInterfaceContract() != null &&
+ componentService.getInterfaceContract().getCallbackInterface() != null) {
+ if (!(compositeService.getCallback() != null &&
+ bindingsSpecifiedManually(compositeService.getCallback().getBindings())) &&
+ promotedService.getCallback() != null &&
+ bindingsSpecifiedManually(promotedService.getCallback().getBindings())) {
+ if (compositeService.getCallback() != null) {
+ compositeService.getCallback().getBindings().clear();
+ } else {
+ compositeService.setCallback(assemblyFactory.createCallback());
+ }
+ for (Binding binding : promotedService.getCallback().getBindings()) {
+ try {
+ compositeService.getCallback().getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted service
+ }
+ }
+ }
+ if (!(componentService.getCallback() != null &&
+ bindingsSpecifiedManually(componentService.getCallback().getBindings())) &&
+ compositeService.getCallback() != null &&
+ bindingsSpecifiedManually(compositeService.getCallback().getBindings())) {
+ if (componentService.getCallback() != null) {
+ componentService.getCallback().getBindings().clear();
+ } else {
+ componentService.setCallback(assemblyFactory.createCallback());
+ }
+ componentService.getCallback().getBindings().addAll(
+ compositeService.getCallback().getBindings());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * If the bindings are specified in the composite file return true as they should
+ * otherwise return false
+ *
+ * @param bindings
+ * @return true if the bindings were specified manually
+ */
+ private boolean bindingsSpecifiedManually(List<Binding> bindings) {
+
+ if (bindings.size() > 1) {
+ return true;
+ } else if (bindings.size() == 1 &&
+ bindings.get(0) instanceof AutomaticBinding &&
+ ((AutomaticBinding)bindings.get(0)).getIsAutomatic()) {
+ return false;
+ } else if (bindings.size() == 1) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java
new file mode 100644
index 0000000000..ea0e88ac24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.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.builder.impl;
+
+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.Service;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+
+/**
+ * A composite builder that handles the creation of promoted composite services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeServicePromotionBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+
+ public CompositeServicePromotionBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Process top level composite services
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+
+ // Get the innermost promoted service
+ ComponentService promotedService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+ if (promotedService != null) {
+ Component promotedComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
+
+ // Create a new component service to represent this composite
+ // service on the promoted component
+ ComponentService newComponentService = assemblyFactory.createComponentService();
+ newComponentService.setName("$promoted$" + compositeService.getName());
+ promotedComponent.getServices().add(newComponentService);
+ newComponentService.setService(promotedService.getService());
+ newComponentService.getBindings().addAll(compositeService.getBindings());
+ newComponentService.setInterfaceContract(compositeService.getInterfaceContract());
+ if (compositeService.getInterfaceContract() != null &&
+ compositeService.getInterfaceContract().getCallbackInterface() != null) {
+ newComponentService.setCallback(assemblyFactory.createCallback());
+ newComponentService.getCallback().getBindings()
+ .addAll(compositeService.getCallback().getBindings());
+ }
+
+ // Change the composite service to now promote the newly
+ // created component service directly
+ compositeService.setPromotedComponent(promotedComponent);
+ compositeService.setPromotedService(newComponentService);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
new file mode 100644
index 0000000000..1698b1a9c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.assembly.builder.impl;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.builder.EndpointBuilder;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * A factory for the Endpoint model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class EndpointBuilderImpl implements EndpointBuilder {
+
+ private Monitor monitor;
+
+ public EndpointBuilderImpl (Monitor monitor){
+ this.monitor = monitor;
+ }
+
+ private void warning(String message, Object model, String... messageParameters) {
+ if (monitor != null){
+ Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null){
+ Problem problem = null;
+ problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Resolve an endpoint against the provided target information and the
+ * set of candidate bindings.
+ */
+ public void build(Endpoint endpoint) {
+
+ // If this endpoint is not fully configured then don't try and resolve it
+ if (endpoint.getTargetComponentService() == null){
+ return;
+ }
+
+ // Does the reference expect callbacks
+ boolean bidirectional = false;
+
+ if (endpoint.getSourceComponentReference().getInterfaceContract() != null &&
+ endpoint.getSourceComponentReference().getInterfaceContract().getCallbackInterface() != null) {
+ bidirectional = true;
+ }
+
+ // if the target service is a promoted service then find the
+ // service it promotes
+ if (endpoint.getTargetComponentService().getService() instanceof CompositeService) {
+ CompositeService compositeService = (CompositeService) endpoint.getTargetComponentService().getService();
+ // Find the promoted component service
+ ComponentService promotedComponentService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+ if (promotedComponentService != null && !promotedComponentService.isUnresolved()) {
+ endpoint.setTargetComponentService(promotedComponentService);
+ }
+ }
+
+ try {
+ PolicyConfigurationUtil.determineApplicableBindingPolicySets(endpoint.getSourceComponentReference(),
+ endpoint.getTargetComponentService());
+ } catch ( Exception e ) {
+ error("PolicyRelatedException", endpoint, e);
+ }
+
+
+ // Match the binding against the bindings of the target service
+ Binding resolvedBinding = BindingConfigurationUtil.matchBinding(endpoint.getTargetComponent(),
+ endpoint.getTargetComponentService(),
+ endpoint.getCandidateBindings(),
+ endpoint.getTargetComponentService().getBindings());
+ if (resolvedBinding == null) {
+ warning("NoMatchingBinding",
+ endpoint.getSourceComponentReference(),
+ endpoint.getSourceComponentReference().getName(),
+ endpoint.getTargetComponentService().getName());
+ } else {
+ endpoint.setSourceBinding(resolvedBinding);
+ }
+
+ if (bidirectional) {
+ Binding resolvedCallbackBinding = BindingConfigurationUtil.matchBinding(endpoint.getTargetComponent(),
+ endpoint.getTargetComponentService(),
+ endpoint.getSourceComponentReference().getCallback().getBindings(),
+ endpoint.getTargetComponentService().getCallback().getBindings());
+ if (resolvedBinding == null) {
+ warning("NoMatchingCallbackBinding",
+ endpoint.getSourceComponentReference(),
+ endpoint.getSourceComponentReference().getName(),
+ endpoint.getTargetComponentService().getName());
+ } else {
+ endpoint.setSourceCallbackBinding(resolvedCallbackBinding);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java
new file mode 100644
index 0000000000..944cf2cf36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.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.builder.impl;
+
+/**
+ * Exception to be throw for invalid policy intents / policysets
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyConfigurationException extends Exception {
+ private static final long serialVersionUID = 506979037642587755L;
+
+ public PolicyConfigurationException(String message) {
+ super(message);
+ }
+
+ public PolicyConfigurationException(Throwable e) {
+ super(e);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
new file mode 100644
index 0000000000..c0bc18dfaf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
@@ -0,0 +1,752 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
+
+/**
+ * This class contains policy computation methods common to computing implementation and binding policies
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class PolicyConfigurationUtil {
+
+ private static List<Intent> computeInheritableIntents(IntentAttachPointType attachPointType,
+ List<Intent> inheritableIntents) throws PolicyValidationException {
+ List<Intent> validInheritableIntents = new ArrayList<Intent>();
+
+ //expand profile intents in inherited intents
+ PolicyComputationUtils.expandProfileIntents(inheritableIntents);
+
+ //validate if inherited intent applies to the attachpoint (binding / implementation) and
+ //only add such intents to the attachpoint (binding / implementation)
+ for (Intent intent : inheritableIntents) {
+ if ( !intent.isUnresolved() ) {
+ for (QName constrained : intent.getConstrains()) {
+ if ( PolicyValidationUtils.isConstrained(constrained, attachPointType)) {
+ validInheritableIntents.add(intent);
+ break;
+ }
+ }
+ } else {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName() + "' is not defined in this domain");
+ }
+ }
+
+ return validInheritableIntents;
+ }
+
+ private static void normalizeIntents(IntentAttachPoint intentAttachPoint) {
+ //expand profile intents specified in the attachpoint (binding / implementation)
+ PolicyComputationUtils.expandProfileIntents(intentAttachPoint.getRequiredIntents());
+
+ //remove duplicates and ...
+ //where qualified form of intent exists retain it and remove the qualifiable intent
+ filterDuplicatesAndQualifiableIntents(intentAttachPoint);
+ }
+
+ private static void trimInherentlyProvidedIntents(IntentAttachPointType attachPointType, List<Intent>intents) {
+ //exclude intents that are inherently supported by the
+ //attachpoint-type (binding-type / implementation-type)
+ List<Intent> requiredIntents = new ArrayList<Intent>(intents);
+ for ( Intent intent : requiredIntents ) {
+ if ( isProvidedInherently(attachPointType, intent) ) {
+ intents.remove(intent);
+ }
+ }
+ }
+
+
+ static void computeIntentsForOperations(IntentAttachPoint intentAttachPoint) throws PolicyValidationException {
+ if ( intentAttachPoint instanceof OperationsConfigurator ) {
+ computeIntentsForOperations((OperationsConfigurator)intentAttachPoint,
+ intentAttachPoint,
+ intentAttachPoint.getRequiredIntents());
+ }
+ }
+
+ private static void computeIntentsForOperations(OperationsConfigurator opConfigurator,
+ IntentAttachPoint intentAttachPoint,
+ List<Intent> parentIntents) throws PolicyValidationException {
+ IntentAttachPointType attachPointType = intentAttachPoint.getType();
+
+ boolean found = false;
+ for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
+ //expand profile intents specified on operations
+ PolicyComputationUtils.expandProfileIntents(confOp.getRequiredIntents());
+
+ //validateIntents(confOp, attachPointType);
+
+ //add intents specified for parent intent attach point (binding / implementation)
+ //wherever its not overridden in the operation
+ Intent tempIntent = null;
+ List<Intent> attachPointOpIntents = new ArrayList<Intent>();
+ for (Intent anIntent : parentIntents) {
+ found = false;
+
+ tempIntent = anIntent;
+ while ( tempIntent instanceof QualifiedIntent ) {
+ tempIntent = ((QualifiedIntent)tempIntent).getQualifiableIntent();
+ }
+
+ for ( Intent opIntent : confOp.getRequiredIntents() ) {
+ if ( opIntent.getName().getLocalPart().startsWith(tempIntent.getName().getLocalPart())) {
+ found = true;
+ break;
+ }
+ }
+
+ if ( !found ) {
+ boolean conflict = false;
+ for (Intent excluded : anIntent.getExcludedIntents()) {
+ if (confOp.getRequiredIntents().contains(excluded)) {
+ conflict = true;
+ break;
+ }
+ }
+ if (!conflict) {
+ attachPointOpIntents.add(anIntent);
+ }
+ }
+ }
+
+ confOp.getRequiredIntents().addAll(attachPointOpIntents);
+
+ //remove duplicates and ...
+ //where qualified form of intent exists retain it and remove the qualifiable intent
+ filterDuplicatesAndQualifiableIntents(confOp);
+
+ //exclude intents that are inherently supported by the parent
+ //attachpoint-type (binding-type / implementation-type)
+ if ( attachPointType != null ) {
+ List<Intent> requiredIntents = new ArrayList<Intent>(confOp.getRequiredIntents());
+ for ( Intent intent : requiredIntents ) {
+ if ( isProvidedInherently(attachPointType, intent) ) {
+ confOp.getRequiredIntents().remove(intent);
+ }
+ }
+ }
+ }
+ }
+
+ private static List<PolicySet> computeInheritablePolicySets(List<PolicySet> inheritablePolicySets,
+ List<PolicySet> applicablePolicySets)
+ throws PolicyValidationException {
+ List<PolicySet> validInheritablePolicySets = new ArrayList<PolicySet>();
+ for (PolicySet policySet : inheritablePolicySets) {
+ if ( !policySet.isUnresolved() ) {
+ if ( applicablePolicySets.contains(policySet) ) {
+ validInheritablePolicySets.add(policySet);
+ }
+ } else {
+ throw new PolicyValidationException("Policy Set '" + policySet.getName()
+ + "' is not defined in this domain ");
+ }
+ }
+
+ return validInheritablePolicySets;
+ }
+
+ private static void normalizePolicySets(PolicySetAttachPoint policySetAttachPoint ) {
+ //get rid of duplicate entries
+ HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ policySetAttachPoint.getPolicySets().clear();
+ policySetAttachPoint.getPolicySets().addAll(policySetTable.values());
+
+ //expand profile intents
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ PolicyComputationUtils.expandProfileIntents(policySet.getProvidedIntents());
+ }
+ }
+
+ private static void computePolicySetsForOperations(List<PolicySet> applicablePolicySets,
+ PolicySetAttachPoint policySetAttachPoint)
+ throws PolicyValidationException {
+ if ( policySetAttachPoint instanceof OperationsConfigurator ) {
+ computePolicySetsForOperations(applicablePolicySets,
+ (OperationsConfigurator)policySetAttachPoint,
+ policySetAttachPoint);
+ }
+
+ }
+
+ private static void computePolicySetsForOperations(List<PolicySet> applicablePolicySets,
+ OperationsConfigurator opConfigurator,
+ PolicySetAttachPoint policySetAttachPoint)
+ throws PolicyValidationException {
+ //String appliesTo = null;
+ //String scdlFragment = "";
+ HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
+ IntentAttachPointType attachPointType = policySetAttachPoint.getType();
+
+ for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
+ //validate policysets specified for the attachPoint
+ for (PolicySet policySet : confOp.getPolicySets()) {
+ if ( !policySet.isUnresolved() ) {
+ //appliesTo = policySet.getAppliesTo();
+
+ //if (!PolicyValidationUtils.isPolicySetApplicable(scdlFragment, appliesTo, attachPointType)) {
+ if (!applicablePolicySets.contains(policySet)) {
+ throw new PolicyValidationException("Policy Set '" + policySet.getName()
+ + " specified for operation " + confOp.getName()
+ + "' does not constrain extension type "
+ + attachPointType.getName());
+
+ }
+ } else {
+ throw new PolicyValidationException("Policy Set '" + policySet.getName()
+ + " specified for operation " + confOp.getName()
+ + "' is not defined in this domain ");
+ }
+ }
+
+ //get rid of duplicate entries
+ for ( PolicySet policySet : confOp.getPolicySets() ) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ confOp.getPolicySets().clear();
+ confOp.getPolicySets().addAll(policySetTable.values());
+ policySetTable.clear();
+
+ //expand profile intents
+ for ( PolicySet policySet : confOp.getPolicySets() ) {
+ PolicyComputationUtils.expandProfileIntents(policySet.getProvidedIntents());
+ }
+ }
+ }
+
+
+ private static void trimProvidedIntents(List<Intent> requiredIntents, List<PolicySet> policySets) {
+ for ( PolicySet policySet : policySets ) {
+ trimProvidedIntents(requiredIntents, policySet);
+ }
+ }
+
+ private static void determineApplicableDomainPolicySets(List<PolicySet> applicablePolicySets,
+ PolicySetAttachPoint policySetAttachPoint,
+ IntentAttachPointType intentAttachPointType) {
+
+ if (policySetAttachPoint.getRequiredIntents().size() > 0) {
+
+ // form a list of all intents required by the attach point
+ List<Intent> combinedTargetIntents = new ArrayList<Intent>();
+ combinedTargetIntents.addAll(policySetAttachPoint.getRequiredIntents());
+ for (PolicySet targetPolicySet : policySetAttachPoint.getPolicySets()) {
+ combinedTargetIntents.addAll(PolicyComputationUtils.findAndExpandProfileIntents(targetPolicySet.getProvidedIntents()));
+ }
+
+ //since the set of applicable policysets for this attachpoint is known
+ //we only need to check in that list if there is a policyset that matches
+ for (PolicySet policySet : applicablePolicySets) {
+ // do not use the policy set if it provides intents that conflict with required intents
+ boolean conflict = false;
+ List<Intent> providedIntents = PolicyComputationUtils.findAndExpandProfileIntents(policySet.getProvidedIntents());
+ checkConflict: for (Intent intent : providedIntents) {
+ for (Intent excluded : intent.getExcludedIntents()) {
+ if (combinedTargetIntents.contains(excluded)) {
+ conflict = true;
+ break checkConflict;
+ }
+ }
+ }
+ if (conflict)
+ continue;
+ int prevSize = policySetAttachPoint.getRequiredIntents().size();
+ trimProvidedIntents(policySetAttachPoint.getRequiredIntents(), policySet);
+ // if any intent was trimmed off, then this policyset must
+ // be attached to the intent attachpoint's policyset
+ if (prevSize != policySetAttachPoint.getRequiredIntents().size()) {
+ policySetAttachPoint.getPolicySets().add(policySet);
+ }
+ }
+ }
+ }
+
+ private static boolean isProvidedInherently(IntentAttachPointType attachPointType, Intent intent) {
+ return ( attachPointType != null &&
+ (( attachPointType.getAlwaysProvidedIntents() != null &&
+ attachPointType.getAlwaysProvidedIntents().contains(intent) ) ||
+ ( attachPointType.getMayProvideIntents() != null &&
+ attachPointType.getMayProvideIntents().contains(intent) )
+ ) );
+ }
+
+ private static void trimProvidedIntents(List<Intent> requiredIntents, PolicySet policySet) {
+ for ( Intent providedIntent : policySet.getProvidedIntents() ) {
+ if ( requiredIntents.contains(providedIntent) ) {
+ requiredIntents.remove(providedIntent);
+ }
+ }
+
+ for ( Intent mappedIntent : policySet.getMappedPolicies().keySet() ) {
+ if ( requiredIntents.contains(mappedIntent) ) {
+ requiredIntents.remove(mappedIntent);
+ }
+ }
+ }
+
+ private static void filterDuplicatesAndQualifiableIntents(IntentAttachPoint intentAttachPoint) {
+ //remove duplicates
+ Map<QName, Intent> intentsTable = new HashMap<QName, Intent>();
+ for ( Intent intent : intentAttachPoint.getRequiredIntents() ) {
+ intentsTable.put(intent.getName(), intent);
+ }
+
+ //where qualified form of intent exists retain it and remove the qualifiable intent
+ Map<QName, Intent> intentsTableCopy = new HashMap<QName, Intent>(intentsTable);
+ //if qualified form of intent exists remove the unqualified form
+ for ( Intent intent : intentsTableCopy.values() ) {
+ if ( intent instanceof QualifiedIntent ) {
+ QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
+ if ( intentsTable.get(qualifiedIntent.getQualifiableIntent().getName()) != null ) {
+ intentsTable.remove(qualifiedIntent.getQualifiableIntent().getName());
+ }
+ }
+ }
+ intentAttachPoint.getRequiredIntents().clear();
+ intentAttachPoint.getRequiredIntents().addAll(intentsTable.values());
+ }
+
+ private static void validateIntents(ConfiguredOperation confOp, IntentAttachPointType attachPointType) throws PolicyValidationException {
+ boolean found = false;
+ if ( attachPointType != null ) {
+ //validate intents specified against the parent (binding / implementation)
+ found = false;
+ for (Intent intent : confOp.getRequiredIntents()) {
+ if ( !intent.isUnresolved() ) {
+ for (QName constrained : intent.getConstrains()) {
+ if (PolicyValidationUtils.isConstrained(constrained, attachPointType)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName()
+ + " specified for operation " + confOp.getName()
+ + "' does not constrain extension type "
+ + attachPointType.getName());
+ }
+ } else {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName()
+ + " specified for operation " + confOp.getName()
+ + "' is not defined in this domain ");
+ }
+ }
+ }
+ }
+
+ static void computeBindingIntentsAndPolicySets(Contract contract) throws PolicyValidationException {
+ for (Binding binding : contract.getBindings()) {
+ if (binding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
+ computeIntents((IntentAttachPoint)binding, contract.getRequiredIntents());
+
+ aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(),
+ policiedBinding.getApplicablePolicySets());
+
+ computePolicySets(policiedBinding, contract.getPolicySets());
+
+ PolicyComputationUtils.checkForMutuallyExclusiveIntents(
+ policiedBinding.getRequiredIntents(),
+ policiedBinding.getPolicySets(),
+ policiedBinding.getType(),
+ contract.getName());
+
+ if ( binding instanceof OperationsConfigurator &&
+ contract instanceof OperationsConfigurator ) {
+ //add or merge service operations to the binding
+ addInheritedOpConfOnBindings((OperationsConfigurator)contract,
+ (OperationsConfigurator)binding,
+ (PolicySetAttachPoint)binding);
+
+ computeIntentsForOperations((IntentAttachPoint)binding);
+ computePolicySetsForOperations(contract.getApplicablePolicySets(),
+ policiedBinding);
+
+ for ( ConfiguredOperation confOp : ((OperationsConfigurator)binding).getConfiguredOperations() ) {
+ PolicyComputationUtils.checkForMutuallyExclusiveIntents(
+ confOp.getRequiredIntents(),
+ confOp.getPolicySets(),
+ policiedBinding.getType(),
+ contract.getName() + "." + confOp.getName());
+ }
+
+ }
+ }
+ }
+
+ if ( contract.getCallback() != null ) {
+ for (Binding binding : contract.getCallback().getBindings()) {
+ if (binding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
+ computeIntents((IntentAttachPoint)binding, contract.getCallback().getRequiredIntents());
+
+ aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(),
+ policiedBinding.getApplicablePolicySets());
+
+ computePolicySets(policiedBinding, contract.getCallback().getPolicySets());
+
+ PolicyComputationUtils.checkForMutuallyExclusiveIntents(
+ policiedBinding.getRequiredIntents(),
+ policiedBinding.getPolicySets(),
+ policiedBinding.getType(),
+ contract.getName() + " callback");
+
+ }
+ }
+ }
+ }
+
+ private static void computeIntents(IntentAttachPoint policiedBinding, List<Intent> inheritedIntents)
+ throws PolicyValidationException {
+ //since the parent component could also contain intents that apply to implementation
+ //and binding elements within, we filter out only those that apply to this binding type
+ List<Intent> prunedIntents = computeInheritableIntents(policiedBinding.getType(),
+ inheritedIntents);
+ policiedBinding.getRequiredIntents().addAll(prunedIntents);
+
+ normalizeIntents(policiedBinding);
+ }
+
+ private static void computePolicySets(PolicySetAttachPoint policiedBinding,
+ List<PolicySet> inheritedPolicySets) throws PolicyValidationException {
+
+ List<PolicySet> prunedPolicySets = computeInheritablePolicySets(inheritedPolicySets,
+ policiedBinding.getApplicablePolicySets());
+ policiedBinding.getPolicySets().addAll(prunedPolicySets);
+ normalizePolicySets(policiedBinding);
+ }
+
+ static void determineApplicableBindingPolicySets(Contract source, Contract target) throws PolicyConfigurationException {
+ List<Intent> intentsCopy = null;
+ for (Binding aBinding : source.getBindings()) {
+ if (aBinding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)aBinding;
+ IntentAttachPointType bindingType = policiedBinding.getType();
+
+
+ intentsCopy = new ArrayList<Intent>(policiedBinding.getRequiredIntents());
+ // add the target component's intents to the reference binding
+ if (target != null) {
+ for (Intent intent : target.getRequiredIntents()) {
+ if (!policiedBinding.getRequiredIntents().contains(intent)) {
+ for (QName constrained : intent.getConstrains()) {
+ if (bindingType != null && bindingType.getName().getNamespaceURI()
+ .equals(constrained.getNamespaceURI())
+ && bindingType.getName().getLocalPart().startsWith(constrained
+ .getLocalPart())) {
+ policiedBinding.getRequiredIntents().add(intent);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ //trim intents specified in operations. First check for policysets specified on the operation
+ //and then in the parent implementation
+ if ( aBinding instanceof OperationsConfigurator ) {
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)aBinding;
+
+ for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
+ List<Intent> opsIntentsCopy = new ArrayList<Intent>(confOp.getRequiredIntents());
+
+ trimInherentlyProvidedIntents(policiedBinding.getType(),
+ confOp.getRequiredIntents());
+ trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets());
+ trimProvidedIntents(confOp.getRequiredIntents(), policiedBinding.getPolicySets());
+
+ determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
+ confOp,
+ policiedBinding.getType());
+
+ if (confOp.getRequiredIntents().size() > 0) {
+ throw new PolicyConfigurationException("The following are unfulfilled intents for operations configured in "
+ + "binding - " + aBinding.getName() + "\nUnfulfilled Intents = " +
+ confOp.getRequiredIntents());
+ }
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the bindings may need the original set of intents we copy that back
+ confOp.getRequiredIntents().clear();
+ confOp.getRequiredIntents().addAll(opsIntentsCopy);
+
+ }
+ }
+
+ trimInherentlyProvidedIntents(policiedBinding.getType(),
+ policiedBinding.getRequiredIntents());
+ trimProvidedIntents(policiedBinding.getRequiredIntents(), policiedBinding
+ .getPolicySets());
+
+ // determine additional policysets that match remaining intents
+ // TODO: resolved to domain policy registry and attach suitable
+ // policy sets to the binding
+ // for now using the SCA Definitions instead of registry
+ // if there are intents that are not provided by any policy set
+ // throw a warning
+ determineApplicableDomainPolicySets(source, policiedBinding);
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the bindings may need the original set of intents we copy that back
+ policiedBinding.getRequiredIntents().clear();
+ policiedBinding.getRequiredIntents().addAll(intentsCopy);
+
+ }
+ }
+ }
+
+ private static void determineApplicableDomainPolicySets(Contract contract,
+ PolicySetAttachPoint policiedBinding)
+ throws PolicyConfigurationException {
+ //if ( domainPolicySets != null) {
+ determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
+ policiedBinding,
+ policiedBinding.getType());
+
+ if ( policiedBinding.getRequiredIntents().size() > 0 ) {
+ if ( contract instanceof Service ) {
+ throw new PolicyConfigurationException("The following are unfulfilled intents for " +
+ "binding in service - " + contract.getName() + "\nUnfulfilled Intents = " +
+ policiedBinding.getRequiredIntents());
+ } else {
+ throw new PolicyConfigurationException("The are unfulfilled intents for " +
+ "binding in reference - " + contract.getName() + "\nUnfulfilled Intents = " +
+ policiedBinding.getRequiredIntents());
+ }
+ }
+ //}
+ }
+
+ private static void addInheritedOpConfOnBindings(OperationsConfigurator source,
+ OperationsConfigurator target,
+ PolicySetAttachPoint attachPoint) throws PolicyValidationException {
+ boolean found = false;
+
+ List<ConfiguredOperation> additionalOperations = new ArrayList<ConfiguredOperation>();
+ for ( ConfiguredOperation sourceConfOp : source.getConfiguredOperations() ) {
+ for ( ConfiguredOperation targetConfOp : target.getConfiguredOperations() ) {
+ if ( sourceConfOp.getName().equals(targetConfOp.getName())) {
+ List<Intent> prunedIntents = computeInheritableIntents(attachPoint.getType(),
+ sourceConfOp.getRequiredIntents());
+ PolicyComputationUtils.addInheritedIntents(prunedIntents,
+ targetConfOp.getRequiredIntents());
+
+ List<PolicySet> prunedPolicySets = computeInheritablePolicySets(sourceConfOp.getPolicySets(),
+ attachPoint.getApplicablePolicySets());
+ PolicyComputationUtils.addInheritedPolicySets(prunedPolicySets, targetConfOp.getPolicySets(), true);
+ found = true;
+ break;
+ }
+ }
+
+ if ( !found ) {
+ additionalOperations.add(sourceConfOp);
+ }
+ }
+
+ if ( !additionalOperations.isEmpty() ) {
+ target.getConfiguredOperations().addAll(additionalOperations);
+ }
+ }
+
+ private static void aggregateAndPruneApplicablePolicySets(List<PolicySet> source, List<PolicySet> target) {
+ target.addAll(source);
+ //strip duplicates
+ Hashtable<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
+ for ( PolicySet policySet : target ) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ target.clear();
+ target.addAll(policySetTable.values());
+ }
+
+ static <C extends Contract> void inheritDefaultPolicies(Base parent, List<C> contracts) {
+
+ for (Contract contract : contracts) {
+
+ // The contract inherits default policies from the parent composite/component.
+ if ( parent instanceof PolicySetAttachPoint ) {
+ PolicyComputationUtils.addDefaultPolicies(
+ ((PolicySetAttachPoint)parent).getRequiredIntents(),
+ ((PolicySetAttachPoint)parent).getPolicySets(),
+ contract.getRequiredIntents(),
+ contract.getPolicySets());
+ }
+
+ // The contract's configured operations inherit default policies from the contract.
+ for ( ConfiguredOperation confOp : contract.getConfiguredOperations() ) {
+ PolicyComputationUtils.addDefaultPolicies(
+ contract.getRequiredIntents(),
+ contract.getPolicySets(),
+ confOp.getRequiredIntents(),
+ confOp.getPolicySets());
+ }
+
+ // The contract's callback inherits default policies from the contract.
+ if (contract.getCallback() != null) {
+ PolicyComputationUtils.addDefaultPolicies(
+ contract.getRequiredIntents(),
+ contract.getPolicySets(),
+ contract.getCallback().getRequiredIntents(),
+ contract.getCallback().getPolicySets());
+ }
+
+ }
+ }
+
+ static void computeImplementationIntentsAndPolicySets(Implementation implementation, Component parent)
+ throws PolicyValidationException, PolicyConfigurationException {
+ if ( implementation instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)implementation;
+ //since for an implementation the component has its policy intents and policysets its possible
+ //that there are some intents there that does not constrain the implementation.. so prune
+ List<Intent> prunedIntents = computeInheritableIntents(policiedImplementation.getType(),
+ parent.getRequiredIntents());
+ parent.getRequiredIntents().clear();
+ parent.getRequiredIntents().addAll(prunedIntents);
+ normalizeIntents(parent);
+
+ computeIntentsForOperations((OperationsConfigurator)parent,
+ (IntentAttachPoint)implementation,
+ parent.getRequiredIntents());
+
+
+ List<PolicySet> prunedPolicySets = computeInheritablePolicySets(parent.getPolicySets(),
+ parent.getApplicablePolicySets());
+ parent.getPolicySets().clear();
+ parent.getPolicySets().addAll(prunedPolicySets);
+ normalizePolicySets(parent);
+
+ PolicyComputationUtils.checkForMutuallyExclusiveIntents(
+ parent.getRequiredIntents(),
+ parent.getPolicySets(),
+ policiedImplementation.getType(),
+ parent.getName());
+
+ computePolicySetsForOperations(parent.getApplicablePolicySets(),
+ (OperationsConfigurator)parent,
+ (PolicySetAttachPoint)implementation);
+
+ for ( ConfiguredOperation confOp : ((OperationsConfigurator)parent).getConfiguredOperations() ) {
+ PolicyComputationUtils.checkForMutuallyExclusiveIntents(
+ confOp.getRequiredIntents(),
+ confOp.getPolicySets(),
+ policiedImplementation.getType(),
+ parent.getName() + "." + confOp.getName());
+ }
+
+ determineApplicableImplementationPolicySets(parent);
+
+ }
+ }
+
+ private static void determineApplicableImplementationPolicySets(Component component) throws PolicyConfigurationException {
+ List<Intent> intentsCopy = null;
+ if ( component.getImplementation() instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)component.getImplementation();
+
+ //trim intents specified in operations. First check for policysets specified on the operation
+ //and then in the parent implementation
+ if ( component instanceof OperationsConfigurator ) {
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
+
+ for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
+ intentsCopy = new ArrayList<Intent>(confOp.getRequiredIntents());
+ trimInherentlyProvidedIntents(policiedImplementation.getType(),
+ confOp.getRequiredIntents());
+ trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets());
+ trimProvidedIntents(confOp.getRequiredIntents(), component.getPolicySets());
+
+ determineApplicableDomainPolicySets(component.getApplicablePolicySets(),
+ confOp,
+ policiedImplementation.getType());
+
+ if (confOp.getRequiredIntents().size() > 0) {
+ throw new PolicyConfigurationException("The following are unfulfilled intents for operations configured in "
+ + "component implementation - " + component.getName() + "\nUnfulfilled Intents = " +
+ confOp.getRequiredIntents());
+ }
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the implementation may need the original set of intents we copy that back
+ confOp.getRequiredIntents().clear();
+ confOp.getRequiredIntents().addAll(intentsCopy);
+ }
+ }
+
+ intentsCopy = new ArrayList<Intent>(component.getRequiredIntents());
+ trimInherentlyProvidedIntents(policiedImplementation.getType(),
+ component.getRequiredIntents());
+ trimProvidedIntents(component.getRequiredIntents(), component.getPolicySets());
+
+ //determine additional policysets that match remaining intents
+ //if there are intents that are not provided by any policy set throw a warning
+ //TODO: resolved to domain policy registry and attach suitable policy sets to the implementation
+ //...for now using the SCA Definitions instead of registry
+ //if ( domainPolicySets != null) {
+ determineApplicableDomainPolicySets(component.getApplicablePolicySets(),
+ component,
+ policiedImplementation.getType());
+
+ if (component.getRequiredIntents().size() > 0) {
+ throw new PolicyConfigurationException("The following are unfulfilled intents for component implementation - " + component
+ .getName() + "\nUnfulfilled Intents = " + component.getRequiredIntents());
+ }
+ //}
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the bindings may need the original set of intents we copy that back
+ component.getRequiredIntents().clear();
+ component.getRequiredIntents().addAll(intentsCopy);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java
new file mode 100644
index 0000000000..e85aec8cea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.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.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+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$
+ */
+class PrintUtil {
+ private boolean useGetters = false;
+ private PrintWriter out;
+ private int indent;
+
+ public PrintUtil(PrintWriter out, boolean useGetters) {
+ this.out = out;
+ this.useGetters = useGetters;
+ }
+
+ 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
+ ValueAccessor accessor = useGetters ? new PropertyAccessor(object) : new FieldAccessor(object);
+ for (int i = 0; i < accessor.size(); i++) {
+ try {
+
+ // Get the value of each property
+ Object value = accessor.getValue(i);
+ 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(accessor.getName(i) + "= [");
+
+ // 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 (!accessor.getName(i).equals("class")) {
+ if (!(Boolean.FALSE.equals(value))) {
+ indent++;
+ indent();
+ out.println(accessor.getName(i) + "=" + value.toString());
+ indent--;
+ }
+ }
+ } else if (value instanceof Node) {
+ indent++;
+ indent();
+ out.println(accessor.getName(i) + "=" + value.toString());
+ indent--;
+ } else {
+
+ // Print an object, recursively
+ indent++;
+ indent();
+ out.println(accessor.getName(i) + "= {");
+ indent++;
+ print(value, printed);
+ indent--;
+ indent();
+ out.println("}");
+ indent--;
+ }
+ }
+ }
+ } catch (Exception e) {
+ }
+ }
+ indent();
+ out.println("}");
+ } catch (Exception e) {
+ indent();
+ out.println(e);
+ }
+ }
+ }
+
+ public static interface ValueAccessor {
+ int size();
+
+ String getName(int i);
+
+ Object getValue(int i) throws Exception;
+ }
+
+ /**
+ * Java field reflection based value accessor
+ */
+ private static class FieldAccessor implements ValueAccessor {
+
+ private Object object;
+ private List<Field> fields;
+
+ public FieldAccessor(Object object) {
+ this.fields = getAllFields(object.getClass());
+ this.object = object;
+ }
+
+ public String getName(int i) {
+ return fields.get(i).getName();
+ }
+
+ public Object getValue(int i) throws Exception {
+ return fields.get(i).get(object);
+ }
+
+ public int size() {
+ return fields.size();
+ }
+
+ }
+
+ /**
+ * JavaBean-based value accessor
+ */
+ private static class PropertyAccessor implements ValueAccessor {
+
+ private Object object;
+ private PropertyDescriptor[] fields;
+
+ public PropertyAccessor(Object object) throws IntrospectionException {
+ BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass());
+ this.fields = beanInfo.getPropertyDescriptors();
+ this.object = object;
+ }
+
+ public String getName(int i) {
+ return fields[i].getName();
+ }
+
+ public Object getValue(int i) throws Exception {
+ Method getter = fields[i].getReadMethod();
+ if (getter != null) {
+ return getter.invoke(object);
+ }
+ return null;
+ }
+
+ public int size() {
+ return fields.length;
+ }
+
+ }
+
+ /**
+ * Returns a collection of fields declared by a class
+ * or one of its supertypes
+ */
+ private static List<Field> getAllFields(Class<?> clazz) {
+ return getAllFields(clazz, new ArrayList<Field>());
+ }
+
+ /**
+ * Recursively evaluates the type hierarchy to return all fields
+ */
+ private static List<Field> getAllFields(Class<?> clazz, List<Field> fields) {
+ if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) {
+ return fields;
+ }
+ fields = getAllFields(clazz.getSuperclass(), fields);
+ Field[] declaredFields = clazz.getDeclaredFields();
+ for (final Field field : declaredFields) {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ field.setAccessible(true); // ignore Java accessibility
+ return null;
+ }
+ });
+ fields.add(field);
+ }
+ return fields;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java
new file mode 100644
index 0000000000..03f24dfae8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.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.assembly.builder.impl;
+
+import java.util.logging.Formatter;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+
+import org.apache.tuscany.sca.monitor.Problem;
+
+/**
+ * Reports a composite assembly problem.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProblemImpl implements Problem {
+
+ private String sourceClassName;
+ private String bundleName;
+ private Severity severity;
+ private Object problemObject;
+ private String messageId;
+ private Object[] messageParams;
+ private Exception cause;
+
+ /**
+ * Construct a new problem
+ *
+ * @param sourceClassName the class name reporting the problem
+ * @param bundleName the name of the message bundle to use
+ * @param severity the severity of the problem
+ * @param problemObject the model object for which the problem is being reported
+ * @param messageId the id of the problem message
+ * @param messageParams the parameters of the problem message
+ */
+ public ProblemImpl(String sourceClassName, String bundleName, Severity severity, Object problemObject, String messageId, Object... messageParams ) {
+ this.sourceClassName = sourceClassName;
+ this.bundleName = bundleName;
+ this.severity = severity;
+ this.problemObject = problemObject;
+ this.messageId = messageId;
+ this.messageParams = messageParams;
+ }
+
+ /**
+ * Construct a new problem
+ *
+ * @param sourceClassName the class name reporting the problem
+ * @param bundleName the name of the message bundle to use
+ * @param severity the severity of the problem
+ * @param problemObject the model object for which the problem is being reported
+ * @param messageId the id of the problem message
+ * @param cause the exception which caused the problem
+ */
+ public ProblemImpl(String sourceClassName, String bundleName, Severity severity, Object problemObject, String messageId, Exception cause) {
+ this.sourceClassName = sourceClassName;
+ this.bundleName = bundleName;
+ this.severity = severity;
+ this.problemObject = problemObject;
+ this.messageId = messageId;
+ this.cause = cause;
+ }
+
+ public String getSourceClassName() {
+ return sourceClassName;
+ }
+
+ public String getBundleName() {
+ return bundleName;
+ }
+
+ public Severity getSeverity() {
+ return severity;
+ }
+
+ public Object getProblemObject() {
+ return problemObject;
+ }
+
+ public String getMessageId() {
+ return messageId;
+ }
+
+ public Object[] getMessageParams() {
+ return messageParams;
+ }
+
+ public Exception getCause() {
+ return cause;
+ }
+
+ @Override
+ public String toString() {
+ Logger logger = Logger.getLogger(sourceClassName, bundleName);
+
+ LogRecord record = new LogRecord(Level.INFO, messageId);
+
+ if (cause == null){
+ record.setParameters(messageParams);
+
+ } else {
+ Object[] params = new String[1];
+ params[0] = cause.toString();
+ record.setParameters(params);
+ }
+ record.setResourceBundle(logger.getResourceBundle());
+ record.setSourceClassName(sourceClassName);
+
+ Formatter formatter = new SimpleFormatter();
+
+ return formatter.formatMessage(record);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java
new file mode 100644
index 0000000000..0105d4af50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.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.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.net.URLConnection;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
+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.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+
+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.Element;
+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.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class PropertyConfigurationUtil {
+
+ private static Document evaluate(Document node, XPathExpression expression, DocumentBuilderFactory documentBuilderFactory)
+ throws XPathExpressionException, ParserConfigurationException {
+
+ Node value = node.getDocumentElement();
+ Node result = (Node)expression.evaluate(value, XPathConstants.NODE);
+ if (result == null) {
+ return null;
+ }
+
+ // TODO: How to wrap the result into a Document?
+ Document document = documentBuilderFactory.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;
+ }
+ }
+
+ private static Document loadFromFile(String file, TransformerFactory transformerFactory) throws MalformedURLException, IOException,
+ TransformerException, ParserConfigurationException {
+ URI uri = URI.create(file);
+ // URI resolution for relative URIs is done when the composite is resolved.
+ URL url = uri.toURL();
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ InputStream is = null;
+ try {
+ is = connection.getInputStream();
+
+ Source streamSource = new SAXSource(new InputSource(is));
+ DOMResult result = new DOMResult();
+ javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
+ transformer.transform(streamSource, result);
+
+ Document document = (Document)result.getNode();
+
+ // TUSCANY-2377, Add a fake value element so it's consistent with
+ // the DOM tree loaded from inside SCDL
+ Element root = document.createElementNS(null, "value");
+ root.appendChild(document.getDocumentElement());
+ document.appendChild(root);
+ return document;
+ } finally {
+ if (is != null) {
+ is.close();
+ }
+ }
+ }
+
+ static void sourceComponentProperties(Map<String, Property> compositeProperties,
+ Component componentDefinition,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory) 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();
+
+ // FIXME: How to deal with namespaces?
+ Document node = evaluate(compositePropDefValues, aProperty.getSourceXPathExpression(), documentBuilderFactory);
+
+ 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(), transformerFactory));
+
+ }
+ }
+ }
+
+ private static class DOMNamespaceContext implements NamespaceContext {
+ private Node node;
+
+ /**
+ * @param node
+ */
+ public DOMNamespaceContext(Node node) {
+ super();
+ this.node = node;
+ }
+
+ public String getNamespaceURI(String prefix) {
+ if (prefix == null) {
+ throw new IllegalArgumentException("Prefix is null");
+ } else if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
+ return XMLConstants.XML_NS_URI;
+ } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
+ return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+ }
+ String ns = node.lookupNamespaceURI(prefix);
+ return ns == null ? XMLConstants.NULL_NS_URI : ns;
+ }
+
+ public String getPrefix(String namespaceURI) {
+ if (namespaceURI == null) {
+ throw new IllegalArgumentException("Namespace URI is null");
+ } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
+ return XMLConstants.XML_NS_PREFIX;
+ } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
+ return XMLConstants.XMLNS_ATTRIBUTE;
+ }
+ return node.lookupPrefix(namespaceURI);
+ }
+
+ public Iterator<?> getPrefixes(String namespaceURI) {
+ // Not implemented
+ if (namespaceURI == null) {
+ throw new IllegalArgumentException("Namespace URI is null");
+ } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
+ return Arrays.asList(XMLConstants.XML_NS_PREFIX).iterator();
+ } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
+ return Arrays.asList(XMLConstants.XMLNS_ATTRIBUTE).iterator();
+ }
+ String prefix = getPrefix(namespaceURI);
+ if (prefix == null) {
+ return Collections.emptyList().iterator();
+ }
+ return Arrays.asList(prefix).iterator();
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java
new file mode 100644
index 0000000000..23d547efaf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * This class encapsulates utility methods to deal with reference definitions
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class ReferenceConfigurationUtil {
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private static void warning(Monitor monitor, String message, Object model, String... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(ReferenceConfigurationUtil.class.getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ 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 OptimizableBinding) || binding.getURI()!=null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ break;
+ case ONE_N:
+ if (count < 1) {
+ if (count == 0) {
+ for (Binding binding: bindings) {
+ if (!(binding instanceof OptimizableBinding) || binding.getURI()!=null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ break;
+ }
+ return true;
+ }
+
+ /**
+ * Follow a reference promotion chain down to the innermost (non composite)
+ * component references.
+ *
+ * @param compositeReference
+ * @return
+ */
+ static List<ComponentReference> getPromotedComponentReferences(CompositeReference compositeReference) {
+ List<ComponentReference> componentReferences = new ArrayList<ComponentReference>();
+ collectPromotedComponentReferences(compositeReference, componentReferences);
+ return componentReferences;
+ }
+
+ /**
+ * Follow a reference promotion chain down to the innermost (non composite)
+ * component references.
+ *
+ * @param compositeReference
+ * @param componentReferences
+ * @return
+ */
+ private static 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);
+ }
+ }
+ }
+
+ /**
+ * Override the bindings for a promoted reference from an outer component
+ * reference
+ *
+ * @param reference
+ * @param promotedReference
+ */
+ static void reconcileReferenceBindings(Reference reference,
+ ComponentReference promotedReference,
+ AssemblyFactory assemblyFactory,
+ EndpointFactory endpointFactory,
+ Monitor monitor) {
+
+ if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE ||
+ promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) {
+
+ // if necessary override the promoted endpoints (and bindings) with the top level bindings
+ if (reference.getBindings().size() > 0 ){
+
+ List<Binding> bindingsToCopyDown = new ArrayList<Binding>();
+ List<Endpoint> endpointsToCopyDown = new ArrayList<Endpoint>();
+
+ for (Binding binding : reference.getBindings()) {
+ if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
+ bindingsToCopyDown.add(binding);
+
+ if (reference instanceof ComponentReference){
+ for (Endpoint endpoint : ((ComponentReference)reference).getEndpoints()){
+ if ( endpoint.getSourceBinding() == binding){
+ endpointsToCopyDown.add(endpoint);
+ break;
+ }
+ }
+ } else {
+ // create a new endpoint to represent this promoted binding
+ Endpoint endpoint = endpointFactory.createEndpoint();
+ endpoint.setTargetName(binding.getURI());
+ endpoint.setSourceComponent(null); // TODO - fixed up at start
+ endpoint.setSourceComponentReference(promotedReference);
+ endpoint.setInterfaceContract(reference.getInterfaceContract());
+ endpoint.setSourceBinding(binding);
+ endpointsToCopyDown.add(endpoint);
+ }
+ }
+ }
+
+ if (bindingsToCopyDown.size() > 0) {
+ promotedReference.getBindings().clear();
+ promotedReference.getBindings().addAll(bindingsToCopyDown);
+
+ promotedReference.getEndpoints().clear();
+ promotedReference.getEndpoints().addAll(endpointsToCopyDown);
+ }
+ }
+
+ if (promotedReference.getBindings().size() > 1) {
+ warning(monitor, "ComponentReferenceMoreWire", promotedReference, promotedReference.getName());
+ }
+ } else {
+ // if necessary merge the promoted endpoints (and bindings) with the top level bindings
+ if (reference.getBindings().size() > 0 ){
+
+ for (Binding binding : reference.getBindings()) {
+ if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
+ promotedReference.getBindings().add(binding);
+
+ if (reference instanceof ComponentReference){
+ for (Endpoint endpoint : ((ComponentReference)reference).getEndpoints()){
+ if ( endpoint.getSourceBinding() == binding){
+ promotedReference.getEndpoints().add(endpoint);
+ break;
+ }
+ }
+ } else {
+ // create a new endpoint to represent this promoted binding
+ Endpoint endpoint = endpointFactory.createEndpoint();
+ endpoint.setTargetName(binding.getURI());
+ endpoint.setSourceComponent(null); // TODO - fixed up at start
+ endpoint.setSourceComponentReference(promotedReference);
+ endpoint.setInterfaceContract(reference.getInterfaceContract());
+ endpoint.setSourceBinding(binding);
+ promotedReference.getEndpoints().add(endpoint);
+ }
+ }
+ }
+ }
+ }
+
+ Set<Binding> callbackBindings = new HashSet<Binding>();
+ if (promotedReference.getCallback() != null) {
+ callbackBindings.addAll(promotedReference.getCallback().getBindings());
+ }
+ if (reference.getCallback() != null) {
+ callbackBindings.addAll(reference.getCallback().getBindings());
+ }
+ promotedReference.setCallback(assemblyFactory.createCallback());
+ for (Binding binding : callbackBindings) {
+ if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
+ promotedReference.getCallback().getBindings().add(binding);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java
new file mode 100644
index 0000000000..41a8b3f8ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.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.assembly.builder.impl;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Service;
+
+/**
+ * This class encapsulates utility methods to deal with service definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class ServiceConfigurationUtil {
+
+ /**
+ * Follow a service promotion chain down to the inner most (non composite)
+ * component service.
+ *
+ * @param topCompositeService
+ * @return
+ */
+ static 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 service promotion chain down to the innermost (non-composite) component.
+ *
+ * @param compositeService
+ * @return
+ */
+ static Component getPromotedComponent(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 getPromotedComponent((CompositeService)service);
+
+ } else {
+
+ // Found a non-composite service
+ return compositeService.getPromotedComponent();
+ }
+ } else {
+
+ // No promoted service
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java
new file mode 100644
index 0000000000..b7c63dc2b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.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.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;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+/**
+ * Represents an abstract property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractPropertyImpl extends ExtensibleImpl 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>();
+
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ /**
+ * 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 IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
new file mode 100644
index 0000000000..016a9a5b05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.ConfiguredOperation;
+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;
+
+/**
+ * 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 ConfiguredOperation createConfiguredOperation() {
+ return new ConfiguredOperationImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java
new file mode 100644
index 0000000000..553e600bc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.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.impl;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+/**
+ * Convenience base class for assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseImpl implements Base {
+ private boolean unresolved;
+
+ /**
+ * Constructs a new base model object.
+ */
+ protected BaseImpl() {
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java
new file mode 100644
index 0000000000..4082d81fdb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.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.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.ConfiguredOperation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackImpl extends ExtensibleImpl implements Callback {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ protected CallbackImpl() {
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
new file mode 100644
index 0000000000..34429a6703
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.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.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.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a component.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentImpl extends ExtensibleImpl implements Component, Cloneable, OperationsConfigurator {
+ 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;
+ private IntentAttachPointType type;
+ private List<ConfiguredOperation> configuredImplOperations = new ArrayList<ConfiguredOperation>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ /**
+ * 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 == null) ? false : autowire.booleanValue();
+ }
+
+ public void setAutowire(Boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Boolean getAutowire() {
+ return autowire;
+ }
+
+ public IntentAttachPointType getType() {
+ return type;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.type = type;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredImplOperations;
+ }
+
+ public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
+ this.configuredImplOperations = configuredOperations;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
new file mode 100644
index 0000000000..e2e7b59896
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.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.impl;
+
+import javax.xml.xpath.XPathExpression;
+
+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;
+ private XPathExpression sourceXPathExpression;
+
+ /**
+ * Constructs a new component property.
+ */
+ protected ComponentPropertyImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ // FIXME getValue should not delegate to property.getValue()
+ // Doing this violates the setValue/getValue semantics, as you
+ // can call setValue() then get a different value from getValue()
+ @Override
+ 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;
+ }
+
+ public XPathExpression getSourceXPathExpression() {
+ return sourceXPathExpression;
+ }
+
+ public void setSourceXPathExpression(XPathExpression sourceXPathExpression) {
+ this.sourceXPathExpression = sourceXPathExpression;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java
new file mode 100644
index 0000000000..488023090c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.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.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * 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>();
+ private ComponentService callbackService;
+ private List<Endpoint> endpoints = new ArrayList<Endpoint>();
+
+ /**
+ * 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 == null) ? false : autowire.booleanValue();
+ }
+
+ public void setAutowire(Boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Boolean getAutowire() {
+ return autowire;
+ }
+
+ public List<CompositeReference> promotedAs() {
+ return promotedAs;
+ }
+
+ public ComponentService getCallbackService() {
+ return callbackService;
+ }
+
+ public void setCallbackService(ComponentService callbackService) {
+ this.callbackService = callbackService;
+ }
+
+ public List<Endpoint> getEndpoints(){
+ return endpoints;
+ }
+
+ /**
+ * Use endpoint information to work out what the interface contract for the
+ * binding is.
+ */
+ @Override
+ public InterfaceContract getInterfaceContract(Binding binding){
+ InterfaceContract interfaceContract = null;
+
+ for (Endpoint theEndpoint : endpoints){
+ if (theEndpoint.getSourceBinding() == binding){
+ interfaceContract = theEndpoint.getInterfaceContract();
+ }
+ }
+
+ if (interfaceContract == null){
+ interfaceContract = getInterfaceContract();
+ }
+ return interfaceContract;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java
new file mode 100644
index 0000000000..0c78a2505f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.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.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.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>();
+ private ComponentReference callbackReference;
+
+ /**
+ * 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;
+ }
+
+ public ComponentReference getCallbackReference() {
+ return callbackReference;
+ }
+
+ public void setCallbackReference(ComponentReference callbackReference) {
+ this.callbackReference = callbackReference;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
new file mode 100644
index 0000000000..bbe665d52f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.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.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;
+
+/**
+ * Represents a component type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeImpl extends ExtensibleImpl 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>();
+ /**
+ * 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;
+ }
+
+ @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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
new file mode 100644
index 0000000000..a0ec95023a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.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.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.ComponentReference;
+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.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+
+/**
+ * Implementation of a Composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeImpl extends ImplementationImpl 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()) {
+ Component clonedComponent = (Component)component.clone();
+ for (Service service : clone.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ // Force the promoted component/service to be rebuilt against the clone
+ if (compositeService.getPromotedComponent() != null) {
+ compositeService.getPromotedComponent().setUnresolved(true);
+ }
+ if (compositeService.getPromotedService() != null) {
+ compositeService.getPromotedService().setUnresolved(true);
+ }
+ }
+ for (Reference reference : clone.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ for (ComponentReference ref : compositeReference.getPromotedReferences()) {
+ // Force the promoted reference to be rebuilt against the clone
+ ref.setUnresolved(true);
+ }
+ }
+
+ clone.components.add(clonedComponent);
+ }
+ 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 isLocal() {
+ return local;
+ }
+
+ public void setLocal(boolean local) {
+ this.local = local;
+ }
+
+ public boolean isAutowire() {
+ return (autowire == null) ? false : autowire.booleanValue();
+ }
+
+ public void setAutowire(Boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Boolean getAutowire() {
+ return autowire;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ @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;
+ }
+ }
+
+ @Override
+ public String toString(){
+ return getName().toString();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
new file mode 100644
index 0000000000..6777a96982
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.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 org.apache.tuscany.sca.assembly.Component;
+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;
+ private Component promotedComponent;
+
+ /**
+ * 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;
+ }
+
+ public Component getPromotedComponent() {
+ return promotedComponent;
+ }
+
+ public void setPromotedComponent(Component promotedComponent) {
+ this.promotedComponent = promotedComponent;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java
new file mode 100644
index 0000000000..1373ce511b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.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.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents an Operation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConfiguredOperationImpl extends BaseImpl implements ConfiguredOperation {
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ private String name;
+ private String contractName;
+
+ /**
+ * Constructs a new Operation.
+ */
+ protected ConfiguredOperationImpl() {
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public String getContractName() {
+ return contractName;
+ }
+
+ public void setContractName(String contractName) {
+ this.contractName = contractName;
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java
new file mode 100644
index 0000000000..d5701df74e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.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.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.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+/**
+ * Represents a constraining type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeImpl extends ExtensibleImpl 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;
+ }
+
+ @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;
+ }
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java
new file mode 100644
index 0000000000..491c835246
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+/**
+ * Implementation of a Contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContractImpl extends ExtensibleImpl implements AbstractContract {
+ private InterfaceContract interfaceContract;
+ private String name;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+
+ private boolean isCallback = false;
+
+ /**
+ * 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;
+ }
+
+ public boolean isCallback() {
+ return isCallback;
+ }
+
+ public void setIsCallback(boolean isCallback) {
+ this.isCallback = isCallback;
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
+ this.configuredOperations = configuredOperations;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointFactoryImpl.java
new file mode 100644
index 0000000000..ece51cbe9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointFactoryImpl.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.impl;
+
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+
+/**
+ * A factory for the Endpoint model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class EndpointFactoryImpl implements EndpointFactory {
+
+ public EndpointFactoryImpl (){
+
+ }
+
+ public Endpoint createEndpoint() {
+ return new EndpointImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
new file mode 100644
index 0000000000..5748abb07d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.Endpoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * The assembly model object for an endpoint.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EndpointImpl implements Endpoint {
+
+ private String targetName;
+
+ private Component sourceComponent;
+ private ComponentReference sourceComponentReference;
+ private Binding resolvedBinding;
+ private Binding resolvedCallbackBinding;
+
+ private List<Binding> candidateBindings = new ArrayList<Binding>();
+
+ private Component targetComponent;
+ private ComponentService targetComponentService;
+ private Binding targetBinding;
+ private Binding targetCallbackBinding;
+
+ private InterfaceContract interfaceContract;
+
+ protected EndpointImpl() {
+ }
+
+ public boolean isUnresolved() {
+ return resolvedBinding == null;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // do nothing as the status is determined by having
+ // a resolved source binding
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public String getTargetName(){
+ return targetName;
+ }
+
+ public void setTargetName(String targetName){
+ this.targetName = targetName;
+ }
+
+ public Component getSourceComponent() {
+ return sourceComponent;
+ }
+
+ public void setSourceComponent(Component sourceComponent) {
+ this.sourceComponent = sourceComponent;
+ }
+
+ public ComponentReference getSourceComponentReference() {
+ return sourceComponentReference;
+ }
+
+ public void setSourceComponentReference(ComponentReference sourceComponentReference) {
+ this.sourceComponentReference = sourceComponentReference;
+ }
+
+ public Binding getSourceBinding() {
+ return resolvedBinding;
+ }
+
+ public void setSourceBinding(Binding resolvedBinding) {
+ this.resolvedBinding = resolvedBinding;
+ }
+
+ public Binding getSourceCallbackBinding(){
+ return resolvedCallbackBinding;
+ }
+
+ public void setSourceCallbackBinding(Binding resolvedCallbackBinding){
+ this.resolvedCallbackBinding = resolvedCallbackBinding;
+ }
+
+ public List<Binding> getCandidateBindings() {
+ return candidateBindings;
+ }
+
+ public Component getTargetComponent() {
+ return targetComponent;
+ }
+
+ public void setTargetComponent(Component targetComponent) {
+ this.targetComponent = targetComponent;
+ }
+
+ public ComponentService getTargetComponentService() {
+ return targetComponentService;
+ }
+
+ public void setTargetComponentService(ComponentService targetComponentService) {
+ this.targetComponentService = targetComponentService;
+ }
+
+ public Binding getTargetBinding() {
+ return targetBinding;
+ }
+
+ public void setTargetBinding(Binding targetBinding) {
+ this.targetBinding = targetBinding;
+ }
+
+ public Binding getTargetCallbackBinding(){
+ return targetCallbackBinding;
+ }
+
+ public void setTargetCallbackBinding(Binding targetCallbackBinding){
+ this.targetCallbackBinding = targetCallbackBinding;
+ }
+
+ public InterfaceContract getInterfaceContract() {
+ return interfaceContract;
+ }
+
+ public void setInterfaceContract(InterfaceContract interfaceContract) {
+ this.interfaceContract = interfaceContract;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
new file mode 100644
index 0000000000..9a7ca09e43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Extensible;
+
+/**
+ * Convenience base class for extensible assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ExtensibleImpl extends BaseImpl implements Extensible {
+ private List<Object> extensions = new ArrayList<Object>();
+
+ /**
+ * Constructs a new base model object.
+ */
+ protected ExtensibleImpl() {
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
new file mode 100644
index 0000000000..aa75922489
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Base implementation class of Implementation model interface
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ImplementationImpl extends ComponentTypeImpl implements Implementation, PolicySetAttachPoint,
+ OperationsConfigurator {
+
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+ private IntentAttachPointType type;
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+ protected ImplementationImpl() {
+ super();
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return type;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.type = type;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java
new file mode 100644
index 0000000000..0c1051199f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.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.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>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ /**
+ * Constructs a new property.
+ */
+ protected PropertyImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
new file mode 100644
index 0000000000..1800222bfb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.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.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.interfacedef.InterfaceContract;
+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;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private boolean promotionOverride;
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * 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 <B> B getCallbackBinding(Class<B> bindingClass) {
+ if (callback != null) {
+ for (Binding binding : callback.getBindings()) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isWiredByImpl() {
+ return wiredByImpl;
+ }
+
+ public void setWiredByImpl(boolean wiredByImpl) {
+ this.wiredByImpl = wiredByImpl;
+ }
+
+ public boolean isPromotionOverride() {
+ return promotionOverride;
+ }
+
+ public void setPromotionOverride(boolean promotionOverride) {
+ this.promotionOverride = promotionOverride;
+ }
+
+ 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;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ /**
+ * By default return the interface contract for the reference
+ */
+ public InterfaceContract getInterfaceContract(Binding binding){
+ return getInterfaceContract();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
new file mode 100644
index 0000000000..8d745cb7e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.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.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.interfacedef.InterfaceContract;
+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;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * 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 <B> B getCallbackBinding(Class<B> bindingClass) {
+ if (callback != null) {
+ for (Binding binding : callback.getBindings()) {
+ 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;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ /**
+ * By default return the interface contract for the service
+ */
+ public InterfaceContract getInterfaceContract(Binding binding){
+ return getInterfaceContract();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java
new file mode 100644
index 0000000000..1a7abc8564
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.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.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.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireImpl extends ExtensibleImpl implements Wire, Cloneable {
+ private ComponentReference source;
+ private ComponentService target;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * 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;
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory
new file mode 100644
index 0000000000..859c4bde4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory
@@ -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.
+
+org.apache.tuscany.sca.assembly.DefaultAssemblyFactory \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EndpointFactory b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EndpointFactory
new file mode 100644
index 0000000000..8dbff76ad9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EndpointFactory
@@ -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.
+
+org.apache.tuscany.sca.assembly.DefaultEndpointFactory \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/assembly-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/assembly-validation-messages.properties
new file mode 100644
index 0000000000..6aeda18aab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/assembly-validation-messages.properties
@@ -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.
+#
+#
+DuplicateComponentName = Duplicate component name: Composite = {0} Component = {1}
+DuplicateComponentServiceName = Duplicate component service name: Component = {0} Service = {1}
+DuplicateComponentReferenceName = Duplicate component reference name: Component = {0} Reference = {1}
+DuplicateComponentPropertyName = Duplicate component property name: Component = {0} Property = {1}
+NoComponentImplementation = No implementation for component: Component = {0}
+ServiceNotFoundForComponentService = Service not found for component service: Component = {0} Service = {1}
+UnresolvedComponentImplementation = Component implementation not found: Component = {0} Uri = {1}
+DuplicateImplementationPropertyName = Duplicate property name: Component = {0} Property = {1}
+DuplicateImplementationServiceName = Duplicate service name: Component = {0} Service = {1}
+DuplicateImplementationReferenceName = Duplicate reference name: Component = {0} Reference = {1}
+PropertyNotFound = Property not found for component property: Component = {0} Property = {1}
+PropertyMustSupplyIncompatible = Component property mustSupply attribute incompatible with property: Component = {0} Property = {1}
+PropertyMustSupplyNull = No value configured on a mustSupply property: Component = {0} Property = {1}
+PropertyOverrideManyAttribute = Component property many attribute incompatible with property: Component = {0} Property = {1}
+ReferenceNotFound = Reference not found for component reference: Component = {0} Reference = {1}
+ReferenceIncompatibleMultiplicity = Component reference multiplicity incompatible with reference multiplicity: Component = {0} Reference = {1}
+ReferenceIncompatibleInterface = Incompatible interfaces on component reference and target: Composite = {0} Reference = {1} Service = {2}
+ReferenceIncompatibleComponentInterface = Component reference interface incompatible with reference interface: Component = {0} Reference = {1}
+ServiceIncompatibleComponentInterface = Component service interface incompatible with service interface: Component = {0} Service = {1}
+MultipleBindingsForService = Multiple bindings with the same name for a service: Service = {0} Binding name = {1}
+MultipleBindingsForReference = Multiple bindings with the same name for a reference: Reference = {0} Binding name = {1}
+ReferenceWithoutTargets = No targets for reference: Composite = {0} Reference = {1}
+PromotedReferenceNotFound = Promoted component reference not found: Composite = {0} Reference = {1}
+PromotedServiceNotFound = Promoted component service not found: Composite = {0} Service = {1}
+ComponentReferenceTargetNotFound = Component reference target not found, it might be a remote service running elsewhere in the SCA Domain: Composite = {0} Service = {1}
+NoSCABindingAvailableForUnresolvedService = A local service cannot be found for reference {0} target {1} and there is no SCA binding available to represent the unresolved target
+NoMatchingBinding = Component reference {0} does not have a binding which matches the bindings of service {1}
+NoMatchingCallbackBinding = Component reference {0} does not have a callback binding which matches the callback bindings of service {1}
+ReferenceEndPointMixWithTarget = Reference {0} must not specify endpoints using both target attribute and with binding uri attribute
+PolicyRelatedException = Policy Related Exception occured due to : {0}
+CompositeAlreadyIncluded = Composite {0} has already been included.
+ComponentReferenceMoreWire = Component reference {0} has more than one wires
+WireTargetNotFound = Wire target not found : {0}
+WireSourceNotFound = Wire source not found : {0}
+WireIncompatibleInterface = Incompatible interfaces on wire source and target : source = {0} target = {1}
+ComponentIncompatibleInterface = Incompatible interfaces on component reference and target : reference = {0} target = {1}
+TooManyReferenceTargets = Too many targets on reference: {0}
+ReferenceInterfaceNotSubSet = Interface of composite reference {0} must be compatible with the interface declared by promoted component reference.
+ServiceInterfaceNotSubSet = Interface of composite service {0} must be subset of the interface declared by promoted component service.
+NoComponentReferenceTarget = No target services found for the component reference to be autowired: {0}
+NoTypeForComponentProperty = No type specified on component property: Component = {0} Property = {1}
+URLSyntaxException = URLSyntaxException when creating binding URI at component = {0} service = {1} binding = {2} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/assembly-validation-messages_it.properties b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/assembly-validation-messages_it.properties
new file mode 100644
index 0000000000..b94d37ba2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/main/resources/assembly-validation-messages_it.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.
+#
+#
+DuplicateComponentName = Nome del componente duplicato: Composite = {0} Component = {1}
+DuplicateComponentServiceName = Nome del servizio del componente duplicato: Component = {0} Service = {1}
+DuplicateComponentReferenceName = Nome del reference del componente duplicato: Component = {0} Reference = {1}
+DuplicateComponentPropertyName = Nome della property del componente duplicato: Component = {0} Property = {1}
+NoComponentImplementation = Implementazione insistente per il componente: Component = {0}
+ServiceNotFoundForComponentService = Servizio non trovato per il componente: Component = {0} Service = {1}
+UnresolvedComponentImplementation = Implementazione del componente non trovata: Component = {0} Uri = {1}
+DuplicateImplementationPropertyName = Nome della property del componente duplicata: Component = {0} Property = {1}
+DuplicateImplementationReferenceName = Nome del riferimento duplicato: Component = {0} Reference = {1}
+PropertyNotFound = Property non trovata per il componente: Component = {0} Property = {1}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
new file mode 100644
index 0000000000..8a3a89aba4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.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 {
+
+ private AssemblyFactory assemblyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ }
+
+ public void testCreateComponent() {
+ createComponent("AccountServiceComponent1");
+ }
+
+ public void testCreateComponentType() {
+ createComponentType();
+ }
+
+ public void testCreateComposite() {
+ createComposite();
+ }
+
+ public void testCreateConstrainingType() {
+ createConstrainingType();
+ }
+
+ /**
+ * Create a composite
+ */
+ Composite createComposite() {
+ Composite c = assemblyFactory.createComposite();
+
+ Component c1 = createComponent("AccountServiceComponent1");
+ c.getComponents().add(c1);
+ Component c2 = createComponent("AccountServiceComponent2");
+ c.getComponents().add(c2);
+
+ Wire w = assemblyFactory.createWire();
+ w.setSource(c1.getReferences().get(0));
+ w.setTarget(c2.getServices().get(0));
+ c.getWires().add(w);
+
+ CompositeService cs = assemblyFactory.createCompositeService();
+ cs.setName("AccountService");
+ cs.setPromotedService(c1.getServices().get(0));
+ cs.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ c.getServices().add(cs);
+ cs.getBindings().add(new TestBinding(assemblyFactory));
+
+ CompositeReference cr = assemblyFactory.createCompositeReference();
+ cr.setName("StockQuoteService");
+ cr.getPromotedReferences().add(c2.getReferences().get(1));
+ cr.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ c.getReferences().add(cr);
+ cr.getBindings().add(new TestBinding(assemblyFactory));
+
+ return c;
+ }
+
+ /**
+ * Create a new component
+ */
+ Component createComponent(String name) {
+ Component c = assemblyFactory.createComponent();
+ c.setName(name);
+
+ ConstrainingType constraint = createConstrainingType();
+ c.setConstrainingType(constraint);
+
+ Implementation i = new TestImplementation(assemblyFactory);
+ c.setImplementation(i);
+
+ ComponentProperty p = assemblyFactory.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 = assemblyFactory.createComponentReference();
+ ref1.setName("accountDataService");
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ ref1.setReference(i.getReferences().get(0));
+ c.getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(assemblyFactory));
+
+ ComponentReference ref2 = assemblyFactory.createComponentReference();
+ ref2.setName("stockQuoteService");
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ ref2.setReference(i.getReferences().get(1));
+ c.getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(assemblyFactory));
+
+ ComponentService s = assemblyFactory.createComponentService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ s.setService(i.getServices().get(0));
+ c.getServices().add(s);
+ s.getBindings().add(new TestBinding(assemblyFactory));
+
+ return c;
+ }
+
+ /**
+ * Create a new component type
+ *
+ * @return
+ */
+ ComponentType createComponentType() {
+ ComponentType ctype = assemblyFactory.createComponentType();
+
+ Property p = assemblyFactory.createProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ ctype.getProperties().add(p);
+
+ Reference ref1 = assemblyFactory.createReference();
+ ref1.setName("accountDataService");
+ ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(assemblyFactory));
+
+ Reference ref2 = assemblyFactory.createReference();
+ ref2.setName("stockQuoteService");
+ ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(assemblyFactory));
+
+ Service s = assemblyFactory.createService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ ctype.getServices().add(s);
+ s.getBindings().add(new TestBinding(assemblyFactory));
+
+ return ctype;
+ }
+
+ /**
+ * Create a new constraining type
+ *
+ * @return
+ */
+ ConstrainingType createConstrainingType() {
+ ConstrainingType ctype = assemblyFactory.createConstrainingType();
+
+ AbstractProperty p = assemblyFactory.createAbstractProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ ctype.getProperties().add(p);
+
+ AbstractReference ref1 = assemblyFactory.createAbstractReference();
+ ref1.setName("accountDataService");
+ ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref1);
+
+ AbstractReference ref2 = assemblyFactory.createAbstractReference();
+ ref2.setName("stockQuoteService");
+ ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref2);
+
+ AbstractService s = assemblyFactory.createAbstractService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
+ ctype.getServices().add(s);
+
+ return ctype;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java
new file mode 100644
index 0000000000..5e0a2335d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.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.assembly;
+
+
+/**
+ * A test interface model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestBinding implements Binding {
+ public TestBinding(AssemblyFactory factory) {
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public String getURI() {
+ return "http://test";
+ }
+
+ public void setName(String name) {
+ }
+
+ public void setURI(String uri) {
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java
new file mode 100644
index 0000000000..19702954c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.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.assembly;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+
+/**
+ * A test component implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestImplementation extends ImplementationImpl 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-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java
new file mode 100644
index 0000000000..d94a7e93a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.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.assembly;
+
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+
+/**
+ * A test operation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestOperation extends OperationImpl {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java
new file mode 100644
index 0000000000..fabafc998b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.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.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;
+
+/**
+ * Test the CompositeBuilder.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBuilderTestCase extends TestCase {
+
+ private AssemblyFactory assemblyFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ }
+
+ public void testFuseIncludes() throws Exception {
+ 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);
+
+ new CompositeIncludeBuilderImpl(null).build(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() throws Exception {
+ 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);
+
+ new CompositeCloneBuilderImpl(null).build(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-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java
new file mode 100644
index 0000000000..82b1fd8665
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.assembly.builder.impl;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+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.AssemblyFactory;
+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.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.Service;
+import org.apache.tuscany.sca.assembly.TestBinding;
+import org.apache.tuscany.sca.assembly.TestImplementation;
+import org.apache.tuscany.sca.assembly.TestInterfaceContract;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PrintUtilTestCase {
+
+ private AssemblyFactory factory = new DefaultAssemblyFactory();
+
+ /**
+ * 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;
+ }
+
+ @Test
+ public void testPrint1() {
+ Composite composite = createComposite();
+ StringWriter sw = new StringWriter();
+ PrintUtil p = new PrintUtil(new PrintWriter(sw), true);
+ p.print(composite);
+ // System.out.println(sw.toString());
+ }
+
+ @Test
+ public void testPrint2() {
+ Composite composite = createComposite();
+ StringWriter sw = new StringWriter();
+ PrintUtil p = new PrintUtil(new PrintWriter(sw), false);
+ p.print(composite);
+ // System.out.println(sw.toString());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/LICENSE b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-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-android/modules/binding-sca-xml/META-INF/README b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/NOTICE b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/binding-sca-xml/pom.xml b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/pom.xml
new file mode 100644
index 0000000000..e27926d1ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <name>Apache Tuscany SCA Default Binding XML Model</name>
+
+ <dependencies>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.binding.sca.xml</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.binding.sca.xml*</Export-Package>
+ <Import-Package>org.apache.tuscany.sca.binding.sca.impl,*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
new file mode 100644
index 0000000000..a3e582c82e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.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.binding.sca.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.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * A processor to read the XML that describes the SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, Constants{
+
+ private PolicyFactory policyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+ private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
+ private Monitor monitor;
+
+ protected static final String BINDING_SCA = "binding.sca";
+ protected static final QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA);
+
+ public SCABindingProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ this.monitor = monitor;
+ }
+
+ public QName getArtifactType() {
+ return BINDING_SCA_QNAME;
+ }
+
+ public Class<SCABinding> getModelType() {
+ return SCABinding.class;
+ }
+
+ public SCABinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ SCABinding scaBinding = scaBindingFactory.createSCABinding();
+ IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
+ bindingType.setName(getArtifactType());
+ bindingType.setUnresolved(true);
+ ((PolicySetAttachPoint)scaBinding).setType(bindingType);
+
+ // Read policies
+ policyProcessor.readPolicies(scaBinding, reader);
+
+ // Read binding name
+ String name = reader.getAttributeValue(null, NAME);
+ if (name != null) {
+ scaBinding.setName(name);
+ }
+
+ // Read binding URI
+ String uri = reader.getAttributeValue(null, URI);
+ if (uri != null) {
+ scaBinding.setURI(uri);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && BINDING_SCA_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return scaBinding;
+ }
+
+ public void resolve(SCABinding model, ModelResolver resolver) throws ContributionResolveException {
+ policyProcessor.resolvePolicies(model, resolver);
+ }
+
+ public void write(SCABinding scaBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <binding.sca>
+ policyProcessor.writePolicyPrefixes(scaBinding, writer);
+ writer.writeStartElement(Constants.SCA10_NS, BINDING_SCA);
+ policyProcessor.writePolicyAttributes(scaBinding, writer);
+
+ // Write binding name
+ if (scaBinding.getName() != null) {
+ writer.writeAttribute(NAME, scaBinding.getName());
+ }
+
+ // Write binding URI
+ if (scaBinding.getURI() != null) {
+ writer.writeAttribute(URI, scaBinding.getURI());
+ }
+
+ writer.writeEndElement();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..bc9f9b7d62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+org.apache.tuscany.sca.binding.sca.xml.SCABindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.sca,model=org.apache.tuscany.sca.binding.sca.impl.SCABindingImpl
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
new file mode 100644
index 0000000000..a7c7c15eaa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.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.apace.tuscany.sca.binding.sca.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+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.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Test reading WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private CompositeBuilder compositeBuilder;
+
+ @Override
+ public void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+
+ inputFactory = XMLInputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+
+ }
+
+ public void testReadComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("/CalculatorServiceImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ComponentType componentType = (ComponentType)staxProcessor.read(reader);
+ assertNotNull(componentType);
+
+ SCABinding referenceSCABinding = (SCABinding) componentType.getReferences().get(0).getBindings().get(0);
+ assertNotNull(referenceSCABinding);
+
+ SCABinding serviceSCABinding = (SCABinding) componentType.getServices().get(0).getBindings().get(0);
+ assertNotNull(serviceSCABinding);
+
+ //new PrintUtil(System.out).print(componentType);
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("/Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+ assertNotNull(composite);
+
+ compositeBuilder.build(composite);
+
+ SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
+ SCABinding serviceSCABinding = (SCABinding) composite.getComponents().get(1).getServices().get(0).getBindings().get(0);
+
+ Assert.assertNotNull(referenceSCABinding);
+ Assert.assertNotNull(serviceSCABinding);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java
new file mode 100644
index 0000000000..8ceaecc9c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.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.apace.tuscany.sca.binding.sca.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.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+
+/**
+ * Test reading/write WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ inputFactory = XMLInputFactory.newInstance();
+ outputFactory = XMLOutputFactory.newInstance();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("/CalculatorServiceImpl.componentType");
+ ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
+ assertNotNull(componentType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
+ assertEquals("<?xml version='1.0' encoding='UTF-8'?><componentType xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\"><service name=\"CalculatorService\"><binding.sca /><interface.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" class=\"calculator.CalculatorService\" /></service><reference name=\"addService\"><binding.sca /><interface.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" class=\"calculator.AddService\" /></reference></componentType>",
+ bos.toString());
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("/Calculator.composite");
+ Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
+ assertEquals("<?xml version='1.0' encoding='UTF-8'?><composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\"><service name=\"CalculatorService\" promote=\"CalculatorServiceComponent\"><binding.sca /><interface.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" interface=\"calculator.CalculatorService\" /></service><component name=\"CalculatorServiceComponent\"><reference name=\"addService\" target=\"AddServiceComponent\"><binding.sca /></reference><reference name=\"subtractService\" target=\"SubtractServiceComponent\" /><reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" /><reference name=\"divideService\" target=\"DivideServiceComponent\" /></component><component name=\"AddServiceComponent\"><service><binding.sca /><interface.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" interface=\"calculator.AddService\" /></service></component><component name=\"SubtractServiceComponent\" /><component name=\"MultiplyServiceComponent\" /><component name=\"DivideServiceComponent\" /></composite>",
+ bos.toString() );
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/resources/Calculator.composite b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/resources/Calculator.composite
new file mode 100644
index 0000000000..9028662d05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/resources/Calculator.composite
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ <binding.sca/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent">
+ <binding.sca/>
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ <service>
+ <interface.java interface="calculator.AddService"/>
+ <binding.sca/>
+ </service>
+ </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-android/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType
new file mode 100644
index 0000000000..f02e7d6fc0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.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">
+
+ <service name="CalculatorService">
+ <interface.java class="calculator.CalculatorService" />
+ <binding.sca/>
+ </service>
+
+ <reference name="addService">
+ <interface.java class="calculator.AddService" />
+ <binding.sca/>
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/LICENSE b/sca-java-1.x/branches/sca-android/modules/binding-sca/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/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-android/modules/binding-sca/META-INF/README b/sca-java-1.x/branches/sca-android/modules/binding-sca/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/NOTICE b/sca-java-1.x/branches/sca-android/modules/binding-sca/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/binding-sca/pom.xml b/sca-java-1.x/branches/sca-android/modules/binding-sca/pom.xml
new file mode 100644
index 0000000000..c8af2d4628
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-sca</artifactId>
+ <name>Apache Tuscany SCA Default Binding Model</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.binding.sca</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.binding.sca*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.java
new file mode 100644
index 0000000000..167c93e86d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.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.binding.sca;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+
+
+/**
+ * Represents an SCA binding used in the distributed runtime.
+ * At the moment just provides us with a sensibly named type
+ * against which the distributed sca binding providers can be registered
+ *
+ * @version $Rev: 556322 $ $Date: 2007-07-14 19:53:15 +0100 (Sat, 14 Jul 2007) $
+ */
+public interface DistributedSCABinding extends Binding {
+
+ SCABinding getSCABinding();
+ void setSCABinding(SCABinding scaBinding);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java
new file mode 100644
index 0000000000..bd24d4b14c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.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.binding.sca;
+
+import java.net.URI;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedExceptionAction;
+
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
+import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
+
+/**
+ * Provider for Policy Intents and PolicySet definitions related to security
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCABindingDefinitionsProvider implements SCADefinitionsProvider {
+ private String definitionsFile = "org/apache/tuscany/sca/binding/sca/definitions.xml";
+ URLArtifactProcessor urlArtifactProcessor = null;
+
+ public SCABindingDefinitionsProvider(ExtensionPointRegistry registry) {
+ URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
+ // Allow privileged access to load resource. Requires RuntimePermssion in security policy.
+ final URL definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction<URL>() {
+ public URL run() {
+ return getClass().getClassLoader().getResource(definitionsFile);
+ }
+ });
+
+ SCADefinitions scaDefn = null;
+ try {
+ final URI uri = new URI(definitionsFile);
+ // Allow bindings to read properties. Requires PropertyPermission read in security policy.
+ scaDefn = AccessController.doPrivileged(new PrivilegedExceptionAction<SCADefinitions>() {
+ public SCADefinitions run() throws ContributionReadException {
+ return (SCADefinitions)urlArtifactProcessor.read(null, uri, definitionsFileUrl);
+ }
+ });
+ } catch (Exception e) {
+ throw new SCADefinitionsProviderException(e);
+ }
+ return scaDefn;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java
new file mode 100644
index 0000000000..43b0cd8f4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.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.binding.sca.impl;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+
+/**
+ * The Distributed SCA binding wrapper for the SCA binding model object. This is currently
+ * just used to locate the remote binding extension and pass the SCA binding to the remote
+ * extension. It isn't used in the model itself
+ *
+ * @version $Rev: 564307 $ $Date: 2007-08-09 18:48:29 +0100 (Thu, 09 Aug 2007) $
+ */
+public class DistributedSCABindingImpl implements DistributedSCABinding {
+
+ private SCABinding scaBinding;
+
+ /**
+ * Getter for the wrapped sca binding model object
+ *
+ * @return the sca binding model element
+ */
+ public SCABinding getSCABinding(){
+ return scaBinding;
+ }
+
+ /**
+ * Setter for the wrapped sca binding model element
+ *
+ * @param scaBinding the sca binding model element
+ */
+ public void setSCABinding(SCABinding scaBinding){
+ this.scaBinding = scaBinding;
+ }
+
+
+ // Operation implementations provided to make this class a
+ // valid Binding
+
+ /**
+ * Returns the binding URI.
+ *
+ * @return the binding URI
+ */
+ public String getURI(){
+ return null;
+ }
+
+ /**
+ * Sets the binding URI.
+ *
+ * @param uri the binding URI
+ */
+ public void setURI(String uri){
+ }
+
+ /**
+ * Returns the binding name.
+ *
+ * @return the binding name
+ */
+ public String getName(){
+ return null;
+ }
+
+ /**
+ * Sets the binding name.
+ *
+ * @param name the binding name
+ */
+ public void setName(String name){
+ }
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ public boolean isUnresolved(){
+ return false;
+ }
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ public void setUnresolved(boolean unresolved){
+ }
+
+ /**
+ * Clone the binding
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RemoteBindingHelper.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RemoteBindingHelper.java
new file mode 100644
index 0000000000..86629fb378
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RemoteBindingHelper.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.binding.sca.impl;
+
+/**
+ * TODO: TUSCANY-2578, implement a pluggable mechanism so sca binding impls can
+ * add their own code to the decision on whether or not to use
+ * the remote binding provider.
+ */
+public class RemoteBindingHelper {
+
+ private static boolean alwaysRemote;
+ static {
+ try {
+ Class.forName("org.apache.tuscany.sca.binding.sca.jms.JMSSCABindingProviderFactory");
+ alwaysRemote = true;
+ } catch (ClassNotFoundException e) {
+ alwaysRemote = false;
+ }
+ }
+
+ public static boolean isTargetRemote() {
+ return alwaysRemote;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java
new file mode 100644
index 0000000000..5c1cefb808
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.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.binding.sca.impl;
+
+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;
+
+/**
+ * The local SCA Binding provider implementation. It is not currently used.
+ *
+ * @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) {
+ return null;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java
new file mode 100644
index 0000000000..5dda74f72e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.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.sca.impl;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+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;
+
+/**
+ * The factory for creating SCA Binding providers
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCABindingProviderFactory implements BindingProviderFactory<SCABinding> {
+
+ private ExtensionPointRegistry extensionPoints;
+
+ public RuntimeSCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ SCABinding binding) {
+
+ return new RuntimeSCAReferenceBindingProvider(extensionPoints, component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ SCABinding binding) {
+ return new RuntimeSCAServiceBindingProvider(extensionPoints, component, service, binding);
+ }
+
+ public Class<SCABinding> getModelType() {
+ return SCABinding.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
new file mode 100644
index 0000000000..850fd77e96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.sca.impl;
+
+import java.net.URI;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+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.Invoker;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+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.osoa.sca.ServiceUnavailableException;
+
+/**
+ * The sca reference binding provider mediates between the twin requirements of
+ * local sca bindings and remote sca bindings. In the local case is does
+ * very little. When the sca binding model is set as being remote (because a
+ * reference target can't be resolved in the current model) this binding will
+ * try and create a remote connection to it
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private static final Logger logger = Logger.getLogger(RuntimeSCAReferenceBindingProvider.class.getName());
+
+ private RuntimeComponent component;
+ private RuntimeComponentReference reference;
+ private SCABinding binding;
+ private boolean started = false;
+
+ private BindingProviderFactory<DistributedSCABinding> distributedProviderFactory = null;
+ private ReferenceBindingProvider distributedProvider = null;
+
+ public RuntimeSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ SCABinding binding) {
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding;
+
+ // look to see if a distributed SCA binding implementation has
+ // been included on the classpath. This will be needed by the
+ // provider itself to do it's thing
+ ProviderFactoryExtensionPoint factoryExtensionPoint =
+ extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ distributedProviderFactory =
+ (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
+ .getProviderFactory(DistributedSCABinding.class);
+
+ }
+
+ public boolean isTargetRemote() {
+ boolean targetIsRemote = false;
+
+ // first look at the target service and see if this has been resolved
+ OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
+
+ // The decision is based on the results of the wiring process in the assembly model
+ // The SCA binding is used to represent unresolved reference targets, i.e. those
+ // reference targets that need resolving at run time. We can tell by lookin if the
+ // service to which this binding refers is resolved or not.
+ //
+ // TODO - When a callback is in operation. A callback reference bindings sometimes has to
+ // act as though there is a local wire and sometimes as if there is a remote wire
+ // what are the implications of this here?
+
+ if (RemoteBindingHelper.isTargetRemote()) {
+ if (reference.getInterfaceContract() != null) {
+ targetIsRemote = reference.getInterfaceContract().getInterface().isRemotable();
+ } else {
+ targetIsRemote = true;
+ }
+ } else if (optimizableBinding.getTargetComponentService() != null) {
+ if (optimizableBinding.getTargetComponentService().isUnresolved() == true) {
+ targetIsRemote = true;
+ } else {
+ targetIsRemote = false;
+ }
+ } else {
+ // the case where the wire is specified by URI, e.g. callbacks or user specified bindings, and
+ // look at the provided URI to decide whether it is a local or remote case
+ try {
+ URI uri = new URI(binding.getURI());
+ if (uri.isAbsolute()) {
+ targetIsRemote = true;
+ } else {
+ targetIsRemote = false;
+ }
+ } catch (Exception ex) {
+ targetIsRemote = false;
+ }
+ }
+ return targetIsRemote;
+ }
+
+ private ReferenceBindingProvider getDistributedProvider() {
+
+ if (isTargetRemote()) {
+ // initialize the remote provider if it hasn't been done already
+ if (distributedProvider == null) {
+ if (reference.getInterfaceContract() != null && !reference.getInterfaceContract().getInterface().isRemotable()) {
+ throw new IllegalStateException("Reference interface not remotable for component: " + component
+ .getName()
+ + " and reference: "
+ + reference.getName());
+ }
+
+ if (distributedProviderFactory == null) {
+ throw new IllegalStateException("No distributed SCA binding available for component: " + component
+ .getName()
+ + " and reference: "
+ + reference.getName());
+ }
+
+ // create the remote provider
+ DistributedSCABinding distributedBinding = new DistributedSCABindingImpl();
+ distributedBinding.setSCABinding(binding);
+
+ distributedProvider =
+ distributedProviderFactory.createReferenceBindingProvider(component, reference, distributedBinding);
+ }
+ }
+
+ return distributedProvider;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ if (isTargetRemote()) {
+ return getDistributedProvider().getBindingInterfaceContract();
+ } else {
+ if (reference.getReference() != null) {
+ return reference.getReference().getInterfaceContract();
+ } else {
+ return reference.getInterfaceContract();
+ }
+ }
+ }
+
+ public boolean supportsOneWayInvocation() {
+ if (isTargetRemote()) {
+ return getDistributedProvider().supportsOneWayInvocation();
+ } else {
+ return false;
+ }
+ }
+
+ private Invoker getInvoker(RuntimeWire wire, Operation operation) {
+ EndpointReference target = wire.getTarget();
+ if (target != null) {
+ RuntimeComponentService service = (RuntimeComponentService)target.getContract();
+ if (service != null) { // not a callback wire
+ SCABinding scaBinding = service.getBinding(SCABinding.class);
+ InvocationChain chain =
+ service.getInvocationChain(scaBinding, wire.getSource().getInterfaceContract(), operation);
+ return chain == null ? null : new SCABindingInvoker(chain);
+ }
+ }
+ return null;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ if (isTargetRemote()) {
+ return getDistributedProvider().createInvoker(operation);
+ } else {
+ RuntimeWire wire = reference.getRuntimeWire(binding);
+ Invoker invoker = getInvoker(wire, operation);
+ if (invoker == null) {
+ throw new ServiceUnavailableException("Unable to create SCA binding invoker for local target " + component.getName()
+ + " reference "
+ + reference.getName()
+ + " (bindingURI="
+ + binding.getURI()
+ + " operation="
+ + operation.getName()
+ + ")" );
+ }
+ return invoker;
+ }
+ }
+
+ public void start() {
+ if (started) {
+ return;
+ } else {
+ started = true;
+ }
+
+ if (getDistributedProvider() != null) {
+ distributedProvider.start();
+ }
+ }
+
+ public void stop() {
+ if (!started) {
+ return;
+ } else {
+ started = false;
+ }
+
+ if (getDistributedProvider() != null) {
+ distributedProvider.stop();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java
new file mode 100644
index 0000000000..8994ba5381
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.sca.impl;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The sca service binding provider mediates between the twin requirements of
+ * local sca bindings and remote sca bindings. In the local case is does
+ * very little. When the sca binding model is set as being remote this binding will
+ * try and create a remote service endpoint for remote references to connect to
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponentService service;
+ private BindingProviderFactory<DistributedSCABinding> distributedProviderFactory;
+ private ServiceBindingProvider distributedProvider;
+ private DistributedSCABinding distributedBinding;
+
+ public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints,
+ RuntimeComponent component,
+ RuntimeComponentService service,
+ SCABinding binding) {
+ this.service = service;
+ // if there is potentially a wire to this service that crosses the node boundary
+ if (service.getInterfaceContract().getInterface().isRemotable()) {
+
+ // look to see if a distributed SCA binding implementation has
+ // been included on the classpath. This will be needed by the
+ // provider itself to do it's thing
+ ProviderFactoryExtensionPoint factoryExtensionPoint =
+ extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ distributedProviderFactory =
+ (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
+ .getProviderFactory(DistributedSCABinding.class);
+
+ // Check the things that will generally be required to set up a
+ // distributed sca domain reference provider. I.e. make sure that we have a
+ // - distributed implementation of the sca binding available
+ // - remotable interface on the service
+ if (distributedProviderFactory != null) {
+
+ URI serviceURI = null;
+ try {
+ serviceURI = new URI(binding.getURI());
+ } catch(Exception ex) {
+
+ }
+
+ if (RemoteBindingHelper.isTargetRemote() || ((serviceURI != null) && (serviceURI.isAbsolute()))) {
+
+ // create a nested provider to handle the remote case
+ distributedBinding = new DistributedSCABindingImpl();
+ distributedBinding.setSCABinding(binding);
+
+ distributedProvider =
+ distributedProviderFactory.createServiceBindingProvider(component, service, distributedBinding);
+
+
+ } else {
+ /* do nothing at the moment as only apps using the node implementation
+ * will currently have the distributed domain set.
+ *
+ throw new IllegalStateException("No distributed domain available for component: "+
+ component.getName() +
+ " and service: " +
+ service.getName());
+ */
+ }
+ } else {
+ /* do nothing at the moment as all services with remotable interfaces
+ * are marked as remote
+ throw new IllegalStateException("No distributed SCA binding available for component: "+
+ component.getName() +
+ " and service: " +
+ service.getName());
+ */
+ }
+ }
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ if (distributedProvider != null) {
+ return distributedProvider.getBindingInterfaceContract();
+ } else {
+ if (service.getService() != null) {
+ return service.getService().getInterfaceContract();
+ } else {
+ return service.getInterfaceContract();
+ }
+ }
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ if (distributedProvider != null) {
+ distributedProvider.start();
+ }
+ }
+
+ public void stop() {
+ if (distributedProvider != null) {
+ distributedProvider.stop();
+ }
+
+ if (distributedBinding != null) {
+ // reset the binding URI to null so that if the composite containing the component
+ // with the service/binding is restarted the binding will have the correct URI set
+ SCABinding scaBinding = distributedBinding.getSCABinding();
+ try {
+ URI tempURI = new URI(scaBinding.getURI());
+ if (!tempURI.isAbsolute()){
+ scaBinding.setURI(null);
+ }
+ } catch (Exception ex){
+ scaBinding.setURI(null);
+ }
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.java
new file mode 100644
index 0000000000..ea758823a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.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.sca.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 class SCABindingFactoryImpl implements SCABindingFactory {
+
+ public SCABindingFactoryImpl (){
+
+ }
+
+ public SCABinding createSCABinding() {
+ return new SCABindingImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
new file mode 100644
index 0000000000..c93ddd9503
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.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.binding.sca.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * The assembly mode object for an SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCABindingImpl implements SCABinding, Extensible, PolicySetAttachPoint, OptimizableBinding, AutomaticBinding {
+ private String name;
+ private String uri;
+ private List<Object> extensions = new ArrayList<Object>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType intentAttachPointType;
+
+ private Component targetComponent;
+ private ComponentService targetComponentService;
+ private Binding targetBinding;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ private boolean isAutomatic = false;
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * Constructs a new SCA binding.
+ */
+ protected SCABindingImpl() {
+ }
+
+ // SCA Binding operations
+
+ /**
+ * Setters for the binding name. Defaults to the
+ * name of the service or reference with which the binding is
+ * associated
+ *
+ * @return the binding name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Setter for the binding name
+ *
+ * @param name the binding name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Getters for the binding URI. The computed URI for the
+ * service that the reference is targeting or which the service represents
+ * depending on whether the biding is associated with a reference or
+ * service
+ *
+ * @return the binding URI
+ */
+ public String getURI() {
+ return uri;
+ }
+
+ /**
+ * Setter for the binding URI
+ *
+ * @param uri the binding URI
+ */
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ /**
+ * Returns a list of extension objects contained in this model object.
+ *
+ * @return a list of extension objects container in this model object
+ */
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ public boolean isUnresolved() {
+ if (targetComponentService == null){
+ return true;
+ } else {
+ return targetComponentService.isUnresolved();
+ }
+ }
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return intentAttachPointType;
+ }
+
+ public void setType(IntentAttachPointType intentAttachPointType) {
+ this.intentAttachPointType = intentAttachPointType;
+ }
+
+ // Wireable binding operations
+
+ /**
+ * @return the targetComponent
+ */
+ public Component getTargetComponent() {
+ return targetComponent;
+ }
+
+ /**
+ * @param targetComponent the targetComponent to set
+ */
+ public void setTargetComponent(Component targetComponent) {
+ this.targetComponent = targetComponent;
+ }
+
+ /**
+ * @return the targetComponentService
+ */
+ public ComponentService getTargetComponentService() {
+ return targetComponentService;
+ }
+
+ /**
+ * @param targetComponentService the targetComponentService to set
+ */
+ public void setTargetComponentService(ComponentService targetComponentService) {
+ this.targetComponentService = targetComponentService;
+ }
+
+ /**
+ * @return the targetBinding
+ */
+ public Binding getTargetBinding() {
+ return targetBinding;
+ }
+
+ /**
+ * @param targetBinding the targetBinding to set
+ */
+ public void setTargetBinding(Binding targetBinding) {
+ this.targetBinding = targetBinding;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+
+ public void setIsAutomatic(boolean isAutomatic){
+ this.isAutomatic = isAutomatic;
+ }
+
+ public boolean getIsAutomatic(){
+ return this.isAutomatic;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.java
new file mode 100644
index 0000000000..52c0f64fe5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.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.binding.sca.impl;
+
+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;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCABindingInvoker implements Interceptor, DataExchangeSemantics {
+ private InvocationChain chain;
+
+ /**
+ * Construct a SCABindingInvoker that delegates to the service invocaiton chain
+ * @param chain
+ */
+ public SCABindingInvoker(InvocationChain chain) {
+ super();
+ this.chain = chain;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
+ */
+ public Invoker getNext() {
+ return chain.getHeadInvoker();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
+ */
+ public void setNext(Invoker next) {
+ // NOOP
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
+ */
+ public Message invoke(Message msg) {
+ return getNext().invoke(msg);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.DataExchangeSemantics#allowsPassByReference()
+ */
+ public boolean allowsPassByReference() {
+ return chain.allowsPassByReference();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory
new file mode 100644
index 0000000000..4efa03a933
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory
@@ -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.
+
+org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..5c6b8e21fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 binding extension
+org.apache.tuscany.sca.binding.sca.impl.RuntimeSCABindingProviderFactory;model=org.apache.tuscany.sca.assembly.SCABinding
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
new file mode 100644
index 0000000000..22c9a64b05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 SCA Definitions Providers
+org.apache.tuscany.sca.binding.sca.SCABindingDefinitionsProvider \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
new file mode 100644
index 0000000000..8bac9e01c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:bindingType type="sca:binding.sca" mayProvide="" alwaysProvides=""/>
+ </sca:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
new file mode 100644
index 0000000000..ff396566d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.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.apace.tuscany.sca.binding.sca;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.CompositeModelResolver;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * SCABindingTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCABindingTestCase {
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private CompositeModelResolver resolver;
+ private CompositeBuilder compositeBuilder;
+
+ @Before
+ public void init() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+
+ resolver = new CompositeModelResolver(null, null);
+
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+
+ }
+
+ @Test
+ public void testSCABindingFactory() {
+ SCABindingFactory factory = new SCABindingFactoryImpl();
+ Assert.assertNotNull(factory.createSCABinding());
+ }
+
+ @Test
+ public void testBuildModel() {
+ try{
+ InputStream is = getClass().getResourceAsStream("/Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+
+ is.close();
+ Assert.assertNotNull(composite);
+
+ resolver.addModel(composite);
+
+ staxProcessor.resolve(composite, resolver);
+
+ compositeBuilder.build(composite);
+
+ SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
+ SCABinding serviceSCABinding = (SCABinding) composite.getComponents().get(1).getServices().get(0).getBindings().get(0);
+
+ Assert.assertNotNull(referenceSCABinding);
+ Assert.assertNotNull(serviceSCABinding);
+ } catch (Exception ex) {
+ Assert.fail(ex.getMessage());
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/binding-sca/src/test/resources/Calculator.composite b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/test/resources/Calculator.composite
new file mode 100644
index 0000000000..37b26f3d68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/binding-sca/src/test/resources/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://calc"
+ targetNamespace="http://calc"
+ 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"/>
+ <service name="AddService">
+ <interface.java interface="calculator.AddService"/>
+ </service>
+ </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> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/LICENSE b/sca-java-1.x/branches/sca-android/modules/contribution-impl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/contribution-impl/META-INF/README b/sca-java-1.x/branches/sca-android/modules/contribution-impl/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/NOTICE b/sca-java-1.x/branches/sca-android/modules/contribution-impl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/contribution-impl/pom.xml b/sca-java-1.x/branches/sca-android/modules/contribution-impl/pom.xml
new file mode 100644
index 0000000000..ff83cff49c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/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-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <name>Apache Tuscany SCA Contribution Model Implementation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.impl</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.contribution*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java
new file mode 100644
index 0000000000..ab056e3214
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.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.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.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.PackageType;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Folder contribution package processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class FolderContributionProcessor implements PackageProcessor {
+
+ public FolderContributionProcessor() {
+ }
+
+ public String getPackageType() {
+ return PackageType.FOLDER;
+ }
+
+ /**
+ * Recursively traverse a root directory
+ *
+ * @param fileList
+ * @param file
+ * @param root
+ * @throws IOException
+ */
+ private static void traverse(List<URI> fileList, final File file, final File root) throws IOException {
+ // Allow privileged access to test file. Requires FilePermissions in security policy file.
+ Boolean isFile = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return file.isFile();
+ }
+ });
+ if (isFile) {
+ fileList.add(AccessController.doPrivileged(new PrivilegedAction<URI>() {
+ public URI run() {
+ return root.toURI().relativize(file.toURI());
+ }
+ }));
+ } else {
+ // Allow privileged access to test file. Requires FilePermissions in security policy
+ // file.
+ Boolean isDirectory = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return file.isDirectory();
+ }
+ });
+ if (isDirectory) {
+ String uri = AccessController.doPrivileged(new PrivilegedAction<URI>() {
+ public URI run() {
+ return root.toURI().relativize(file.toURI());
+ }
+ }).toString();
+
+ if (uri.endsWith("/")) {
+ uri = uri.substring(0, uri.length() - 1);
+ }
+ fileList.add(URI.create(uri));
+
+ // Allow privileged access to list files. Requires FilePermission in security
+ // policy.
+ File[] files = AccessController.doPrivileged(new PrivilegedAction<File[]>() {
+ public File[] run() {
+ return file.listFiles();
+ }
+ });
+ for (File f : files) {
+ if (!f.getName().startsWith(".")) {
+ traverse(fileList, f, root);
+ }
+ }
+ }
+ }
+ }
+
+ public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
+ return new URL(sourceURL, artifact.toString());
+ }
+
+ 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>();
+
+ try {
+ // Assume the root is a jar file
+ final File rootFolder = new File(packageSourceURL.toURI());
+ // Allow privileged access to test file. Requires FilePermissions in security policy
+ // file.
+ Boolean isDirectory = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return rootFolder.isDirectory();
+ }
+ });
+ if (isDirectory) {
+ // Allow privileged access to test file. Requires FilePermissions in security policy
+ // file.
+ Boolean folderExists = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return rootFolder.exists();
+ }
+ });
+ if (!folderExists) {
+ throw new ContributionReadException(rootFolder.getAbsolutePath());
+ }
+
+ // Security consideration. This method gathers URIs of enclosed
+ // artifacts. The URIs are protected by the policy when a user
+ // yries to open those URLs.
+ traverse(artifacts, rootFolder, rootFolder);
+ }
+
+ } catch (URISyntaxException e) {
+ throw new ContributionReadException(packageSourceURL.toExternalForm(), e);
+ }
+
+ return artifacts;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java
new file mode 100644
index 0000000000..3df275a7a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.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.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.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import org.apache.tuscany.sca.contribution.PackageType;
+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 {
+
+ public JarContributionProcessor() {
+ }
+
+ public String getPackageType() {
+ return PackageType.JAR;
+ }
+
+ 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.");
+ }
+
+ // Assume the root is a jar file
+ JarInputStream jar = new JarInputStream(inputStream);
+ try {
+ Set<String> names = new HashSet<String>();
+ while (true) {
+ JarEntry entry = jar.getNextJarEntry();
+ if (entry == null) {
+ // EOF
+ break;
+ }
+
+ // FIXME: Maybe we should externalize the filter as a property
+ String name = entry.getName();
+ if (!name.startsWith(".")) {
+
+ // Trim trailing /
+ if (name.endsWith("/")) {
+ name = name.substring(0, name.length() - 1);
+ }
+
+ // Add the entry name
+ if (!names.contains(name)) {
+ names.add(name);
+
+ // Add parent folder names to the list too
+ for (;;) {
+ int s = name.lastIndexOf('/');
+ if (s == -1) {
+ name = "";
+ } else {
+ name = name.substring(0, s);
+ }
+ if (!names.contains(name)) {
+ names.add(name);
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Return list of URIs
+ List<URI> artifacts = new ArrayList<URI>();
+ for (String name: names) {
+ artifacts.add(URI.create(name));
+ }
+ return artifacts;
+
+ } finally {
+ jar.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
new file mode 100644
index 0000000000..9375cb917f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
@@ -0,0 +1,399 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collections;
+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.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.Contribution;
+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;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * 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> contributionLocations = new HashMap<String, String>();
+
+ private Map<String, Contribution> contributionMap = new HashMap<String, Contribution>();
+ private List<Contribution> contributions = new ArrayList<Contribution>();
+
+ private URI domain;
+ private XMLInputFactory factory;
+ private Monitor monitor;
+
+ /**
+ * Marshals warnings into the monitor
+ *
+ * @param message
+ * @param model
+ * @param messageParameters
+ */
+ protected void warning(String message, Object model, String... messageParameters) {
+ if (monitor != null){
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Marshals errors into the monitor
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ protected void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Marshals exceptions into the monitor
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ protected void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Constructor with repository root
+ *
+ * @param repository
+ * @param factory
+ */
+ public ContributionRepositoryImpl(final String repository, XMLInputFactory factory, Monitor monitor) throws IOException {
+ this.monitor = monitor;
+ 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;
+ }
+ });
+ }
+
+ // Allow privileged access to File. Requires FilePermission in security policy file.
+ final String finalRoot = root;
+ this.rootFile = AccessController.doPrivileged(new PrivilegedAction<File>() {
+ public File run() {
+ return new File(finalRoot);
+ }
+ });
+
+ // Allow privileged access to File. Requires FilePermission in security policy file.
+ this.domain = AccessController.doPrivileged(new PrivilegedAction<URI>() {
+ public URI run() {
+ return rootFile.toURI();
+ }
+ });
+
+ // Allow privileged access to mkdir. Requires FilePermission in security policy file.
+ try {
+ AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
+ public Object run() throws IOException {
+ FileHelper.forceMkdir(rootFile);
+ return null;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ error("PrivilegedActionException", rootFile, (IOException)e.getException());
+ throw (IOException)e.getException();
+ }
+
+ // Allow privileged access to test file. Requires FilePermissions in security policy file.
+ Boolean notDirectory = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return (!rootFile.exists() || !rootFile.isDirectory() || !rootFile.canRead());
+ }
+ });
+ if (notDirectory) {
+ error("RootNotDirectory", rootFile, repository);
+ throw new IOException("The root is not a directory: " + repository);
+ }
+ this.factory = factory;
+ }
+
+ 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(final String contribution, URL sourceURL, InputStream contributionStream) throws IOException {
+ // where the file should be stored in the repository
+ final File location = mapToFile(sourceURL);
+ FileHelper.forceMkdir(location.getParentFile());
+
+ copy(contributionStream, location);
+
+ // add contribution to repositoryContent
+ // Allow ability to read user.dir property. Requires PropertyPermission in security policy.
+ URL contributionURL;
+ try {
+ contributionURL= AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
+ public URL run() throws IOException {
+ URL contributionURL = location.toURL();
+ URI relative = rootFile.toURI().relativize(location.toURI());
+ contributionLocations.put(contribution, relative.toString());
+ return contributionURL;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ error("PrivilegedActionException", location, (IOException)e.getException());
+ throw (IOException)e.getException();
+ }
+ 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()) {
+ URLConnection connection = sourceURL.openConnection();
+ connection.setUseCaches(false);
+ InputStream is = connection.getInputStream();
+ 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());
+ contributionLocations.put(contribution, relative.toString());
+ saveMap();
+
+ return location.toURL();
+ }
+
+ public URL find(String contribution) {
+ if (contribution == null) {
+ return null;
+ }
+ String location = contributionLocations.get(contribution);
+ if (location == null) {
+ return null;
+ }
+ try {
+ return new File(rootFile, location).toURL();
+ } catch (MalformedURLException e) {
+ // Should not happen
+ error("MalformedURLException", location, new AssertionError(e));
+ 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.contributionLocations.remove(contribution);
+ saveMap();
+ } catch (IOException ioe) {
+ // handle file could not be removed
+ }
+ }
+ }
+
+ public List<String> list() {
+ return new ArrayList<String>(contributionLocations.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) {
+ warning("DomainFileNotFound", domainFile, domainFile.getAbsolutePath());
+ 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");
+ contributionLocations.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 : contributionLocations.entrySet()) {
+ writer.println(" <contribution uri=\"" + e.getKey() + "\" location=\"" + e.getValue() + "\"/>");
+ }
+ writer.println("</domain>");
+ writer.flush();
+ } catch (IOException e) {
+ IllegalArgumentException ae = new IllegalArgumentException(e);
+ error("IllegalArgumentException", os, ae);
+ throw ae;
+ } finally {
+ IOHelper.closeQuietly(os);
+ }
+ }
+
+ public void destroy() {
+ }
+
+ public void addContribution(Contribution contribution) {
+ contributionMap.put(contribution.getURI(), contribution);
+ contributions.add(contribution);
+ }
+
+ public void removeContribution(Contribution contribution) {
+ contributionMap.remove(contribution.getURI());
+ contributions.remove(contribution);
+ }
+
+ public void updateContribution(Contribution contribution) {
+ Contribution oldContribution = contributionMap.remove(contribution.getURI());
+ contributions.remove(oldContribution);
+ contributionMap.put(contribution.getURI(), contribution);
+ contributions.add(contribution);
+ }
+
+ public Contribution getContribution(String uri) {
+ return contributionMap.get(uri);
+ }
+
+ public List<Contribution> getContributions() {
+ return Collections.unmodifiableList(contributions);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
new file mode 100644
index 0000000000..7b8b12ca9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
@@ -0,0 +1,584 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ContributionMetadata;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+import org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * 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;
+
+ /**
+ * Registry of available StAX processors,
+ * used for loading contribution metadata in a extensible way
+ */
+ private StAXArtifactProcessor staxProcessor;
+
+ /**
+ * Event listener for contribution operations
+ */
+ private ExtensibleContributionListener contributionListener;
+
+ /**
+ * Registry of available model resolvers
+ */
+
+ private ModelResolverExtensionPoint modelResolvers;
+
+ /**
+ * Model factory extension point
+ */
+
+ private ModelFactoryExtensionPoint modelFactories;
+
+ /**
+ * XML factory used to create reader instance to load contribution metadata
+ */
+ private XMLInputFactory xmlFactory;
+
+ /**
+ * Assembly factory
+ */
+ private AssemblyFactory assemblyFactory;
+
+ /**
+ * Contribution model factory
+ */
+ private ContributionFactory contributionFactory;
+
+
+ private ModelResolver policyDefinitionsResolver;
+
+ private List policyDefinitions;
+
+ private Monitor monitor;
+
+ private String COMPOSITE_FILE_EXTN = ".composite";
+
+ public ContributionServiceImpl(ContributionRepository repository,
+ PackageProcessor packageProcessor,
+ URLArtifactProcessor documentProcessor,
+ StAXArtifactProcessor staxProcessor,
+ ExtensibleContributionListener contributionListener,
+ ModelResolver policyDefinitionsResolver,
+ ModelResolverExtensionPoint modelResolvers,
+ ModelFactoryExtensionPoint modelFactories,
+ AssemblyFactory assemblyFactory,
+ ContributionFactory contributionFactory,
+ XMLInputFactory xmlFactory,
+ List<SCADefinitions> policyDefinitions,
+ Monitor monitor) {
+ super();
+ this.contributionRepository = repository;
+ this.packageProcessor = packageProcessor;
+ this.artifactProcessor = documentProcessor;
+ this.staxProcessor = staxProcessor;
+ this.contributionListener = contributionListener;
+ this.modelResolvers = modelResolvers;
+ this.modelFactories = modelFactories;
+ this.xmlFactory = xmlFactory;
+ this.assemblyFactory = assemblyFactory;
+ this.contributionFactory = contributionFactory;
+ this.policyDefinitionsResolver = policyDefinitionsResolver;
+ this.policyDefinitions = policyDefinitions;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ public Contribution contribute(String contributionURI, URL sourceURL, boolean storeInRepository)
+ throws ContributionException, IOException {
+ if (contributionURI == null) {
+ error("ContributionURINull", contributionURI);
+ throw new IllegalArgumentException("URI for the contribution is null");
+ }
+ if (sourceURL == null) {
+ error("SourceURLNull", sourceURL);
+ throw new IllegalArgumentException("Source URL for the contribution is null");
+ }
+ return addContribution(contributionURI, sourceURL, null, null, storeInRepository);
+ }
+
+ public Contribution contribute(String contributionURI,
+ URL sourceURL,
+ ModelResolver modelResolver,
+ boolean storeInRepository) throws ContributionException, IOException {
+ if (contributionURI == null) {
+ error("ContributionURINull", contributionURI);
+ throw new IllegalArgumentException("URI for the contribution is null");
+ }
+ if (sourceURL == null) {
+ error("SourceURLNull", sourceURL);
+ 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)
+ throws ContributionException, IOException {
+
+ return addContribution(contributionURI, sourceURL, input, null, true);
+ }
+
+ public Contribution contribute(String contributionURI, URL sourceURL, InputStream input, ModelResolver modelResolver)
+ throws ContributionException, IOException {
+
+ return addContribution(contributionURI, sourceURL, input, modelResolver, true);
+ }
+
+ public Contribution getContribution(String uri) {
+ return this.contributionRepository.getContribution(uri);
+ }
+
+ /**
+ * Remove a contribution and notify listener that contribution was removed
+ */
+ public void remove(String uri) throws ContributionException {
+ Contribution contribution = contributionRepository.getContribution(uri);
+ this.contributionRepository.removeContribution(contribution);
+ this.contributionListener.contributionRemoved(this.contributionRepository, contribution);
+ }
+
+ /**
+ * Add a composite model to the contribution
+ */
+ public void addDeploymentComposite(Contribution contribution, Composite composite) throws ContributionException {
+ Artifact artifact = this.contributionFactory.createArtifact();
+ artifact.setURI(composite.getURI());
+ artifact.setModel(composite);
+
+ contribution.getArtifacts().add(artifact);
+
+ contribution.getDeployables().add(composite);
+ }
+
+ /**
+ * Utility/Helper methods for contribution service
+ */
+
+ /**
+ * Perform read of the contribution metadata loader (sca-contribution.xml and sca-contribution-generated.xml)
+ * When the two metadata files are available, the information provided are merged, and the sca-contribution has priorities
+ *
+ * @param sourceURL
+ * @return Contribution
+ * @throws ContributionException
+ */
+ private Contribution readContributionMetadata(URL sourceURL) throws ContributionException {
+ Contribution contributionMetadata = contributionFactory.createContribution();
+
+ ContributionMetadataDocumentProcessor metadataDocumentProcessor =
+ new ContributionMetadataDocumentProcessor(modelFactories, staxProcessor, monitor);
+
+ final URL[] urls = {sourceURL};
+ // Allow access to create classloader. Requires RuntimePermission in security policy.
+ URLClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() {
+ public URLClassLoader run() {
+ return new URLClassLoader(urls, null);
+ }
+ });
+ for (String path: new String[]{
+ Contribution.SCA_CONTRIBUTION_GENERATED_META,
+ Contribution.SCA_CONTRIBUTION_META}) {
+ URL url = cl.getResource(path);
+ if (url != null) {
+ ContributionMetadata contribution = metadataDocumentProcessor.read(sourceURL, URI.create(path), url);
+ contributionMetadata.getImports().addAll(contribution.getImports());
+ contributionMetadata.getExports().addAll(contribution.getExports());
+ contributionMetadata.getDeployables().addAll(contribution.getDeployables());
+ }
+ }
+
+ // For debugging purposes, write it back to XML
+ // if (contributionMetadata != null) {
+ // try {
+ // ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ // XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ // outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+ // staxProcessor.write(contributionMetadata, outputFactory.createXMLStreamWriter(bos));
+ // Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
+ // OutputFormat format = new OutputFormat();
+ // format.setIndenting(true);
+ // format.setIndent(2);
+ // XMLSerializer serializer = new XMLSerializer(System.out, format);
+ // serializer.serialize(document);
+ // } catch (Exception e) {
+ // e.printStackTrace();
+ // }
+ // }
+
+ return contributionMetadata;
+ }
+
+ /**
+ * 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) {
+ error("ContributionContentNull", contributionStream);
+ 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);
+ }
+ }
+
+ //initialize contribution based on it's metadata if available
+ Contribution contribution = readContributionMetadata(locationURL);
+
+ // Create contribution model resolver
+ if (modelResolver == null) {
+ //FIXME Remove this domain resolver, visibility of policy declarations should be handled by
+ // the contribution import/export mechanism instead of this domainResolver hack.
+ modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories, policyDefinitionsResolver);
+ }
+
+ //set contribution initial information
+ contribution.setURI(contributionURI);
+ contribution.setLocation(locationURL.toString());
+ contribution.setModelResolver(modelResolver);
+
+ 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) {
+ URLConnection connection = sourceURL.openConnection();
+ connection.setUseCaches(false);
+ // Allow access to open URL stream. Add FilePermission to added to security policy file.
+ final URLConnection finalConnection = connection;
+ try {
+ contributionStream = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
+ public InputStream run() throws IOException {
+ return finalConnection.getInputStream();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (IOException)e.getException();
+ }
+
+ 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
+ try {
+ // Allow access to read system properties. Requires PropertyPermission in security policy.
+ // Any security exceptions are caught and wrapped as ContributionException.
+ processReadPhase(contribution, contributionArtifacts);
+ } catch ( Exception e ) {
+ throw new ContributionException(e);
+ }
+
+ //
+ this.contributionListener.contributionAdded(this.contributionRepository, contribution);
+
+ // Resolve them
+ processResolvePhase(contribution);
+
+ // Add all composites under META-INF/sca-deployables to the
+ // list of deployables
+ String prefix = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
+ for (Artifact 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);
+ }
+ }
+ }
+ }
+
+ processApplicationComposite(contribution);
+
+ // store the contribution on the registry
+ this.contributionRepository.addContribution(contribution);
+
+ return contribution;
+ }
+
+ /**
+ * Process any application composite (eg see 5.1.3 of SCA JEE spec)
+ * TODO: see TUSCANY-2581
+ */
+ private void processApplicationComposite(Contribution contribution) {
+
+ Composite composite = findComposite("web-inf/web.composite", contribution);
+ if (composite != null) {
+ if (!contribution.getDeployables().contains(composite)) {
+ contribution.getDeployables().add(createDeploymentComposite(composite));
+ }
+ }
+ }
+
+ /**
+ * Create a deployment composite for the composite
+ * See line 247 section 5.1.3 of SCA JEE spec
+ */
+ private Composite createDeploymentComposite(Composite composite) {
+ // TODO: for now just use as-is
+ return composite;
+ }
+
+ private Composite findComposite(String name, Contribution contribution) {
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ if (name.equalsIgnoreCase(artifact.getURI())) {
+ return (Composite)artifact.getModel();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 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, XMLStreamException {
+
+ ModelResolver modelResolver = contribution.getModelResolver();
+ URL contributionURL = new URL(contribution.getLocation());
+
+ List<URI> compositeUris = new ArrayList<URI>();
+
+ Object model = null;
+ for (URI anArtifactUri : artifacts) {
+ if ( anArtifactUri.toString().endsWith(COMPOSITE_FILE_EXTN)) {
+ compositeUris.add(anArtifactUri);
+ } else {
+ URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), anArtifactUri);
+
+ // Add the deployed artifact model to the resolver
+ Artifact artifact = this.contributionFactory.createArtifact();
+ artifact.setURI(anArtifactUri.toString());
+ artifact.setLocation(artifactURL.toString());
+ contribution.getArtifacts().add(artifact);
+ modelResolver.addModel(artifact);
+
+ model = this.artifactProcessor.read(contributionURL, anArtifactUri, artifactURL);
+
+ if (model != null) {
+ artifact.setModel(model);
+
+ // Add the loaded model to the model resolver
+ modelResolver.addModel(model);
+
+ // Add policy definitions to the list of policy definitions
+ if (model instanceof SCADefinitions) {
+ policyDefinitions.add(model);
+
+ SCADefinitions definitions = (SCADefinitions)model;
+ for (Intent intent : definitions.getPolicyIntents() ) {
+ policyDefinitionsResolver.addModel(intent);
+ }
+
+ for (PolicySet policySet : definitions.getPolicySets() ) {
+ policyDefinitionsResolver.addModel(policySet);
+ }
+
+ for (IntentAttachPointType attachPointType : definitions.getBindingTypes() ) {
+ policyDefinitionsResolver.addModel(attachPointType);
+ }
+
+ for (IntentAttachPointType attachPointType : definitions.getImplementationTypes() ) {
+ policyDefinitionsResolver.addModel(attachPointType);
+ }
+ for (Object binding : definitions.getBindings() ) {
+ policyDefinitionsResolver.addModel(binding);
+ }
+ }
+ }
+ }
+ }
+
+ for (URI anArtifactUri : compositeUris) {
+ URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), anArtifactUri);
+
+ // Add the deployed artifact model to the resolver
+ Artifact artifact = this.contributionFactory.createArtifact();
+ artifact.setURI(anArtifactUri.toString());
+ artifact.setLocation(artifactURL.toString());
+ contribution.getArtifacts().add(artifact);
+ modelResolver.addModel(artifact);
+
+ model = this.artifactProcessor.read(contributionURL, anArtifactUri, artifactURL);
+ if (model != null) {
+ artifact.setModel(model);
+ // Add the loaded model to the model resolver
+ modelResolver.addModel(model);
+ }
+ }
+ }
+
+ /**
+ * 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 {
+ List<Artifact> composites = new ArrayList<Artifact>();
+
+ // for each artifact that was processed on the contribution
+ for (Artifact artifact : contribution.getArtifacts()) {
+ //leave the composites to be resolved at the end
+ if (artifact.getURI().endsWith(".composite")) {
+ composites.add(artifact);
+ } else {
+ // resolve the model object
+ if (artifact.getModel() != null) {
+ // System.out.println("Processing Resolve Phase : " + artifact.getURI());
+ this.artifactProcessor.resolve(artifact.getModel(), contribution.getModelResolver());
+ }
+ }
+ }
+
+ //process each composite file
+ for (Artifact artifact : composites) {
+ // 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-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java
new file mode 100644
index 0000000000..9f04c4af27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.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.contribution.service.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.PackageType;
+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", PackageType.JAR);
+ contentTypeRegistry.put("WAR", PackageType.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 correct one
+ * @return The content type
+ */
+ public String getType(URL resourceURL, String defaultContentType) {
+ URLConnection connection = null;
+ String contentType = defaultContentType;
+ final String urlProtocol = resourceURL.getProtocol();
+
+ if (urlProtocol.equals("file")) {
+ final File fileOrDir = FileHelper.toFile(resourceURL);
+ // Allow privileged access to test file. Requires FilePermissions in security policy.
+ Boolean isDirectory = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return fileOrDir.isDirectory();
+ }
+ });
+ if (isDirectory) {
+ // Special case : contribution is a folder
+ contentType = PackageType.FOLDER;
+ }
+
+ String type = resolveContentyTypeByExtension(resourceURL);
+ if (type != null) {
+ return type;
+ }
+ } else if (urlProtocol.equals("bundle") || urlProtocol.equals("bundleresource")) {
+ contentType = PackageType.BUNDLE;
+ } else {
+ contentType = resolveContentyTypeByExtension(resourceURL);
+ if (contentType == null) {
+ try {
+ connection = resourceURL.openConnection();
+ connection.setUseCaches(false);
+ 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-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java
new file mode 100644
index 0000000000..cd5e87ca42
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java
@@ -0,0 +1,701 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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 = '\\';
+
+ /**
+ * 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-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java
new file mode 100644
index 0000000000..630d1f6bf4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.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.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.net.URLConnection;
+import java.util.jar.JarFile;
+
+public class IOHelper {
+ /**
+ * The default buffer size to use.
+ */
+ private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+
+ /**
+ * 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 {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ is = connection.getInputStream();
+ }
+ }
+
+ public SafeURLInputStream(JarURLConnection connection) throws IOException {
+ // We cannot use cache
+ connection.setUseCaches(false);
+ is = connection.getInputStream();
+ jarFile = connection.getJarFile();
+ }
+
+ @Override
+ public int available() throws IOException {
+ return is.available();
+ }
+
+ @Override
+ public void close() throws IOException {
+ is.close();
+ // We need to close the JAR file
+ if (jarFile != null) {
+ jarFile.close();
+ }
+ }
+
+ @Override
+ public synchronized void mark(int readlimit) {
+ is.mark(readlimit);
+ }
+
+ @Override
+ public boolean markSupported() {
+ return is.markSupported();
+ }
+
+ @Override
+ public int read() throws IOException {
+ return is.read();
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ return is.read(b, off, len);
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ return is.read(b);
+ }
+
+ @Override
+ public synchronized void reset() throws IOException {
+ is.reset();
+ }
+
+ @Override
+ 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-android/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
new file mode 100644
index 0000000000..b644709266
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;type=application/vnd.tuscany.folder
+org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;type=application/x-compressed
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties
new file mode 100644
index 0000000000..158ee2102d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties
@@ -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.
+#
+#
+ContributionURINull =URI for the contribution is null
+SourceURLNull = Source URL for the contribution is null
+ContributionContentNull = The content of the contribution is null
+PrivilegedActionException = Exception occured due to FilePermissions in security policy file
+RootNotDirectory = The root is not a directory {0}
+IllegalArgumentException = IllegalArgumentException occured due to :
+DomainFileNotFound = Domain file "sca-domain.xml" not found ({0})
+MalformedURLException = MalformedURLException occured due to : \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java
new file mode 100644
index 0000000000..c33b31b550
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.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;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
+
+/**
+ * Folder Package Processor test case
+ * Verifies proper handle of File System structured contributions
+ *
+ * @version $Rev$ $Date$
+ */
+public class FolderContributionPackageProcessorTestCase extends TestCase {
+ private static final String FOLDER_CONTRIBUTION = ".";
+
+ public final void testProcessPackageArtifacts() throws Exception {
+ FolderContributionProcessor folderProcessor = new FolderContributionProcessor();
+ URL contributionURL = new File(FOLDER_CONTRIBUTION).toURL().toURI().toURL();
+
+ List<URI> artifacts = folderProcessor.getArtifacts(contributionURL, null);
+ assertNotNull(artifacts);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java
new file mode 100644
index 0000000000..9b3dce7029
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.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.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;
+
+/**
+ * JAR Package Processor test case
+ * Verifies proper handle of JAR Archives contributions
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class JarContributionPackageProcessorTestCase extends TestCase {
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+
+ 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-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java
new file mode 100644
index 0000000000..46b4183380
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.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.contribution.processor;
+
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+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.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+
+
+/**
+ * URL Artifact Processor Extension Point test case
+ * Verifies the right registration and lookup for processors that handle filename and file types
+ *
+ * @version $Rev$ $Date$
+ */
+public class URLartifactProcessorExtensionPointTestCase extends TestCase {
+
+ private URLArtifactProcessorExtensionPoint artifactProcessors;
+
+ @Override
+ protected void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ artifactProcessors = new DefaultURLArtifactProcessorExtensionPoint(extensionPoints);
+ artifactProcessors.addArtifactProcessor(new FileTypeArtifactProcessor());
+ artifactProcessors.addArtifactProcessor(new FileNameArtifactProcessor());
+ }
+
+
+ public final void testFileTypeProcessor() {
+ assertNotNull(artifactProcessors.getProcessor(".m1"));
+ }
+
+
+ public final void testFileNameProcessor() {
+ assertNotNull(artifactProcessors.getProcessor("file.m2"));
+
+ }
+
+ /**
+ * Internal mock classes
+ *
+ */
+
+ private class M1 {
+ }
+
+ private class M2 {
+ }
+
+ private class FileTypeArtifactProcessor implements URLArtifactProcessor<M1> {
+ public FileTypeArtifactProcessor() {
+ }
+
+ public M1 read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ return null;
+ }
+
+ public void resolve(M1 m1, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public String getArtifactType() {
+ return ".m1";
+ }
+
+ public Class<M1> getModelType() {
+ return M1.class;
+ }
+ }
+
+ private class FileNameArtifactProcessor implements URLArtifactProcessor<M2> {
+ public FileNameArtifactProcessor() {
+ }
+
+ public M2 read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ return null;
+ }
+
+ public void resolve(M2 m2, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public String getArtifactType() {
+ return "file.m2";
+ }
+
+ public Class<M2> getModelType() {
+ return M2.class;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.java
new file mode 100644
index 0000000000..98852e951c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.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.contribution.resolver;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+
+/**
+ * Test the default model resolver implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelResolverTestCase extends TestCase {
+
+ private ModelResolver resolver;
+ private ContributionFactory factory;
+
+ @Override
+ protected void setUp() throws Exception {
+ resolver = new DefaultModelResolver();
+ factory = new DefaultContributionFactory();
+ }
+
+ 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 testResolvedArtifact() {
+ Artifact artifact = factory.createArtifact();
+ artifact.setURI("foo/bar");
+ resolver.addModel(artifact);
+ Artifact x = factory.createArtifact();
+ x.setURI("foo/bar");
+ x = resolver.resolveModel(Artifact.class, x);
+ assertTrue(x == artifact);
+ }
+
+ class Model {
+ private String name;
+
+ Model(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return name.equals(((Model)obj).name);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java
new file mode 100644
index 0000000000..01083cc6a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.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.contribution.resolver;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+/**
+ * Test DefaultArtifactResolver.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleModelResolverTestCase extends TestCase {
+ private ExtensibleModelResolver resolver;
+
+ private ContributionFactory factory;
+
+ @Override
+ protected void setUp() throws Exception {
+
+ ModelResolverExtensionPoint resolvers = new DefaultModelResolverExtensionPoint();
+ resolvers.addResolver(Model.class, TestModelResolver.class);
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+
+ resolver = new ExtensibleModelResolver(null, resolvers, factories, null);
+
+ factory = new DefaultContributionFactory();
+ }
+
+ public void testResolvedDefault() {
+ OtherModel a = new OtherModel("a");
+ resolver.addModel(a);
+ OtherModel x = new OtherModel("a");
+ x = resolver.resolveModel(OtherModel.class, x);
+ assertTrue(x == a);
+ }
+
+ public void testResolvedRegisteredClass() {
+ Model a = new Model("a");
+ resolver.addModel(a);
+ Model x = new Model("a");
+ x = resolver.resolveModel(Model.class, x);
+ assertTrue(x == a);
+ }
+
+ public void testUnresolvedDefault() {
+ OtherModel x = new OtherModel("a");
+ OtherModel y = resolver.resolveModel(OtherModel.class, x);
+ assertTrue(x == y);
+ }
+
+ public void testUnresolved() {
+ Model x = new Model("a");
+ Model y = resolver.resolveModel(Model.class, x);
+ assertTrue(x == y);
+ }
+
+ public void testResolvedArtifact() {
+ Artifact artifact = factory.createArtifact();
+ artifact.setURI("foo/bar");
+ resolver.addModel(artifact);
+ Artifact x = factory.createArtifact();
+ x.setURI("foo/bar");
+ x = resolver.resolveModel(Artifact.class, x);
+ assertTrue(x == artifact);
+ }
+
+ private class Model {
+ private String name;
+
+ Model(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return name.equals(((Model)obj).name);
+ }
+ }
+
+ private class OtherModel {
+ private String name;
+
+ OtherModel(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return name.equals(((OtherModel)obj).name);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java
new file mode 100644
index 0000000000..66ecd33da6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.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.resolver;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+/**
+ * A test implementation of a model resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModelResolver implements ModelResolver {
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public TestModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ 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);
+ }
+ // 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-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java
new file mode 100644
index 0000000000..2e5354fb96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.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.contribution.services;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+
+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;
+
+ @Override
+ protected void setUp() throws Exception {
+ // create repository (this should re-create the root directory)
+ this.repository = new ContributionRepositoryImpl("target/repository/", XMLInputFactory.newInstance(), null);
+ 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-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java
new file mode 100644
index 0000000000..dfb600153e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.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.services;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.PackageType;
+import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
+
+public class PackageTypeDescriberImplTestCase extends TestCase {
+ private PackageTypeDescriberImpl packageTypeDescriber;
+
+ public void testResolveArchivePackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/deployables/sample-calculator.jar");
+ assertEquals(PackageType.JAR, this.packageTypeDescriber.getType(artifactURL, null));
+ }
+
+ public void testResolveFolderPackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/deployables/");
+ assertEquals(PackageType.FOLDER, this.packageTypeDescriber.getType(artifactURL, null));
+ }
+
+ public void testResolveFolder2PackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/deployables");
+ assertEquals(PackageType.FOLDER, 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"));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ packageTypeDescriber = new PackageTypeDescriberImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar b/sca-java-1.x/branches/sca-android/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-android/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar b/sca-java-1.x/branches/sca-android/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-android/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/test.composite b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/test.composite
new file mode 100644
index 0000000000..1e09549194
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/contribution-impl/src/test/resources/test.ext b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/test.ext
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-impl/src/test/resources/test.ext
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/LICENSE b/sca-java-1.x/branches/sca-android/modules/contribution-java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-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-android/modules/contribution-java/META-INF/README b/sca-java-1.x/branches/sca-android/modules/contribution-java/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/NOTICE b/sca-java-1.x/branches/sca-android/modules/contribution-java/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/contribution-java/pom.xml b/sca-java-1.x/branches/sca-android/modules/contribution-java/pom.xml
new file mode 100644
index 0000000000..153a4f7c5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <name>Apache Tuscany SCA Java Import/Export Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.java</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.contribution.java*</Export-Package>
+ <DynamicImport-Package>org.apache.tuscany.sca.contribution.osgi.impl</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.java
new file mode 100644
index 0000000000..886c61c00a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.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.contribution.java;
+
+import org.apache.tuscany.sca.contribution.java.impl.JavaImportExportFactoryImpl;
+
+/**
+ * Default Java Import/Export Factory implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultJavaImportExportFactory extends JavaImportExportFactoryImpl implements JavaImportExportFactory {
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.java
new file mode 100644
index 0000000000..41e93ec148
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.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.java;
+
+import org.apache.tuscany.sca.contribution.Export;
+
+/**
+ * Base Java Export model interface
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaExport extends Export {
+ /**
+ * Get java package that identifies the import
+ *
+ * @return The package name
+ */
+ String getPackage();
+
+ /**
+ * Set java package that identifies the import
+ *
+ * @param packageName The package name
+ */
+ void setPackage(String packageName);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java
new file mode 100644
index 0000000000..d3568f6283
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.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.java;
+
+import org.apache.tuscany.sca.contribution.Import;
+
+/**
+ * Base Java Import model interface
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImport extends Import {
+
+ /**
+ * 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 java package that identifies the import
+ *
+ * @return The package name
+ */
+ String getPackage();
+
+ /**
+ * Set java package that identifies the import
+ *
+ * @param packageName The package name
+ */
+ void setPackage(String packageName);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.java
new file mode 100644
index 0000000000..af2ca9cd57
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.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.java;
+
+/**
+ * Base Java Import/Export model factory
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImportExportFactory {
+
+ /**
+ * Create a java import model object
+ *
+ * @return The new JavaImport model object
+ */
+ JavaImport createJavaImport();
+
+ /**
+ * Create a java export model object
+ *
+ * @return The new JavaExport model object
+ */
+ JavaExport createJavaExport();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
new file mode 100644
index 0000000000..61c73bf2f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.contribution.java.impl;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.DefaultDelegatingModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * A Model Resolver for ClassReferences.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ClassLoaderModelResolver extends URLClassLoader implements ModelResolver {
+ private Contribution contribution;
+ private Map<String, ModelResolver> importResolvers = new HashMap<String, ModelResolver>();
+
+ private static ClassLoader parentClassLoader() {
+ ClassLoader parentClassLoader = ServiceDiscovery.getInstance().getServiceDiscoverer().getClass().getClassLoader();
+ return parentClassLoader;
+ }
+
+ public ClassLoaderModelResolver(final Contribution contribution, ModelFactoryExtensionPoint modelFactories) throws MalformedURLException {
+ super(new URL[] {new URL(contribution.getLocation())}, parentClassLoader());
+ this.contribution = contribution;
+
+ // Index Java import resolvers by package name
+ Map<String, List<ModelResolver>> resolverMap = new HashMap<String, List<ModelResolver>>();
+ for (Import import_: this.contribution.getImports()) {
+ if (import_ instanceof JavaImport) {
+ JavaImport javaImport = (JavaImport)import_;
+ List<ModelResolver> resolvers = resolverMap.get(javaImport.getPackage());
+ if (resolvers == null) {
+ resolvers = new ArrayList<ModelResolver>();
+ resolverMap.put(javaImport.getPackage(), resolvers);
+ }
+ resolvers.add(javaImport.getModelResolver());
+ }
+ }
+
+ // Create a delegating model resolver for each imported package
+ for (Map.Entry<String, List<ModelResolver>> entry: resolverMap.entrySet()) {
+ importResolvers.put(entry.getKey(), new DefaultDelegatingModelResolver(entry.getValue()));
+ }
+ }
+
+ public void addModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public Object removeModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ if (!(unresolved instanceof ClassReference)) {
+ return unresolved;
+ }
+
+ try {
+
+ // Load the class and return a class reference for it
+ String className = ((ClassReference)unresolved).getClassName();
+ Class<?> clazz = Class.forName(className, true, this);
+ return modelClass.cast(new ClassReference(clazz));
+
+ } catch (ClassNotFoundException e) {
+ return unresolved;
+ } catch (NoClassDefFoundError e) {
+ return unresolved;
+ }
+ }
+
+ @Override
+ public URL findResource(String name) {
+
+ //TODO delegate to the Java import resolvers
+
+ URL url = super.findResource(name);
+ return url;
+ }
+
+ @Override
+ public Enumeration<URL> findResources(String name) throws IOException {
+
+ //TODO delegate to the Java import resolvers
+ //Enumeration<URL> importedResources;
+
+ Enumeration<URL> resources = super.findResources(name);
+ List<URL> allResources = new ArrayList<URL>();
+ //for (; importedResources.hasMoreElements(); ) {
+ // allResources.add(importedResources.nextElement());
+ //}
+ for (; resources.hasMoreElements(); ) {
+ allResources.add(resources.nextElement());
+ }
+ return Collections.enumeration(allResources);
+ }
+
+ @Override
+ protected Class<?> findClass(String name) throws ClassNotFoundException {
+
+ // Extract the package name
+ int d = name.lastIndexOf('.');
+ String packageName;
+ if (d != -1) {
+ packageName = name.substring(0, d);
+ } else {
+ packageName = null;
+ }
+
+ // First try to load the class using the Java import resolvers
+ ModelResolver importResolver = importResolvers.get(packageName);
+ if (importResolver != null) {
+ ClassReference classReference = importResolver.resolveModel(ClassReference.class, new ClassReference(name));
+ if (!classReference.isUnresolved()) {
+ return classReference.getJavaClass();
+ }
+ }
+
+ // Next, try to load the class from the current contribution
+ Class<?> clazz = super.findClass(name);
+ return clazz;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java
new file mode 100644
index 0000000000..962512a745
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.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.contribution.java.impl;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Constructor;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * A Model Resolver for ClassReferences.
+ *
+ * @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
+ */
+public class ClassReferenceModelResolver implements ModelResolver {
+ private Contribution contribution;
+ private WeakReference<ClassLoader> classLoader;
+ private Map<String, ClassReference> map = new HashMap<String, ClassReference>();
+
+ private ModelResolver osgiResolver;
+
+ public ClassReferenceModelResolver(final Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ if (this.contribution != null) {
+ // Allow privileged access to get ClassLoader. Requires RuntimePermission in security policy.
+ // ClassLoader cl = contribution.getClassLoader();
+ ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return contribution.getClassLoader();
+ }
+ });
+
+ if (cl == null) {
+ // Allow privileged access to get ClassLoader. Requires RuntimePermission in security policy.
+ //ClassLoader contextClassLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ // public ClassLoader run() {
+ // return Thread.currentThread().getContextClassLoader();
+ // }
+ //});
+ ClassLoader contextClassLoader = ServiceDiscovery.getInstance().getServiceDiscoverer().getClass().getClassLoader();
+ cl = new ContributionClassLoader(contribution, contextClassLoader);
+ contribution.setClassLoader(cl);
+ }
+ this.classLoader = new WeakReference<ClassLoader>(cl);
+ } else {
+ // This path should be used only for unit testing.
+ // Allow privileged access to get ClassLoader. Requires RuntimePermission in security policy.
+ // this.classLoader = new WeakReference<ClassLoader>(this.getClass().getClassLoader());
+ ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return this.getClass().getClassLoader();
+ }
+ });
+ this.classLoader = new WeakReference<ClassLoader>( cl );
+ }
+
+ try {
+ Class<?> osgiResolverClass =
+ Class.forName("org.apache.tuscany.sca.contribution.osgi.impl.OSGiClassReferenceModelResolver");
+ if (osgiResolverClass != null) {
+ Constructor constructor =
+ osgiResolverClass.getConstructor(Contribution.class, ModelFactoryExtensionPoint.class);
+ this.osgiResolver = (ModelResolver)constructor.newInstance(contribution, modelFactories);
+ }
+ } catch (Throwable e) {
+ // Ignore error, non-OSGi classloading is used in this case
+ }
+ }
+
+ public void addModel(Object resolved) {
+ ClassReference clazz = (ClassReference)resolved;
+ map.put(clazz.getClassName(), clazz);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((ClassReference)resolved).getClassName());
+ }
+
+
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ if (!(unresolved instanceof ClassReference)) {
+ return unresolved;
+ }
+ Object resolved = map.get(((ClassReference)unresolved).getClassName());
+
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+
+ //Load a class on demand
+ Class clazz = null;
+
+ if (osgiResolver != null) {
+ resolved = osgiResolver.resolveModel(modelClass, unresolved);
+ clazz = ((ClassReference)resolved).getJavaClass();
+ }
+
+ if (clazz == null) {
+ try {
+ // Search contribution ClassLoader (which has visibility of classes in the contribution
+ // as well as explicitly imported packages from other contributions)
+ clazz = Class.forName(((ClassReference)unresolved).getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+ } catch (NoClassDefFoundError e) {
+ }
+ }
+
+ if (clazz != null) {
+ //if we load the class
+ // Store a new ClassReference wrapping the loaded class
+ ClassReference classReference = new ClassReference(clazz);
+ map.put(clazz.getName(), classReference);
+
+ // Return the resolved ClassReference
+ return modelClass.cast(classReference);
+ } else {
+ return unresolved;
+ }
+
+ }
+
+
+ /***************
+ * Helper methods
+ ***************/
+
+ private String getPackageName(ClassReference clazz) {
+ int pos = clazz.getClassName().lastIndexOf(".");
+ return clazz.getClassName().substring(0, pos);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java
new file mode 100644
index 0000000000..aa68925376
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java
@@ -0,0 +1,385 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.java.impl;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+
+
+public class ContributionClassLoader extends URLClassLoader {
+// public class ContributionClassLoader {
+
+ private Contribution contribution;
+ // private b urlClassLoader;
+
+ /**
+ * Constructor for contribution ClassLoader
+ *
+ * @param contribution
+ * @param parent
+ * @throws MalformedURLException
+ */
+ public ContributionClassLoader(Contribution contribution, final ClassLoader parent) {
+ super(new URL[0], parent);
+ // Note that privileged use of getContextClassLoader have been promoted to callers.
+ // super(new URL[0], parent == null?Thread.currentThread().getContextClassLoader(): null);
+ this.contribution = contribution;
+ if (contribution.getLocation() != null) {
+ try {
+ this.addURL(new URL(contribution.getLocation()));
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /*
+ * Return the ClassLoader corresponding to a contribution providing an export
+ * Create a new ClassLoader for the contribution if one does not exist
+ */
+ private ClassLoader getExportClassLoader(Contribution exportingContribution) {
+ ClassLoader cl = exportingContribution.getClassLoader();
+ if (!(cl instanceof ContributionClassLoader)) {
+ if (cl == null) {
+ cl = getParent();
+ }
+
+ cl = new ContributionClassLoader(exportingContribution, cl);
+ exportingContribution.setClassLoader(cl);
+ }
+ return cl;
+ }
+
+ /* (non-Javadoc)
+ * @see java.net.URLClassLoader#findClass(java.lang.String)
+ *
+ * Search path for class:
+ * This contribution
+ * Imported contributions
+ */
+ @Override
+ protected Class<?> findClass(String className) throws ClassNotFoundException {
+
+ Class<?> clazz = null;
+ try {
+ clazz = findClassFromContribution(className);
+ } catch (ClassNotFoundException e) {
+
+ for (Import import_ : this.contribution.getImports()) {
+ if (classNameMatchesImport(className, import_)) {
+ // Delegate the resolution to the imported contribution
+ for (Contribution exportingContribution : ((JavaImportModelResolver)import_.getModelResolver()).getExportContributions()) {
+
+ ClassLoader exportClassLoader = getExportClassLoader(exportingContribution);
+ if (exportClassLoader instanceof ContributionClassLoader) {
+
+ for (Export export : exportingContribution.getExports()) {
+ try {
+ if (import_.match(export)) {
+ clazz = ((ContributionClassLoader)exportClassLoader).findClassFromContribution(className);
+ break;
+ }
+ } catch (ClassNotFoundException e1) {
+ continue;
+ }
+
+ }
+ if (clazz != null) break;
+ }
+ }
+ if (clazz != null) break;
+ }
+ }
+
+ if (clazz == null) throw e;
+ }
+ return clazz;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean)
+ *
+ * Search path for class:
+ * Parent ClassLoader
+ * This contribution
+ * Imported contributions
+ *
+ */
+ @Override
+ protected synchronized Class<?> loadClass(String className, boolean resolveClass)
+ throws ClassNotFoundException {
+
+ Class<?> clazz = null;
+ try {
+
+ if (this.getParent() != null)
+ clazz = this.getParent().loadClass(className);
+
+ } catch (ClassNotFoundException e) {
+ }
+
+ if (clazz == null)
+ clazz = findClass(className);
+
+
+ if (resolveClass)
+ this.resolveClass(clazz);
+ return clazz;
+
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.net.URLClassLoader#findResource(java.lang.String)
+ */
+ @Override
+ public URL findResource(String name) {
+
+ URL url = findResourceFromContribution(name);
+
+ if (url == null) {
+ for (Import import_ : this.contribution.getImports()) {
+ if (resourceNameMatchesImport(name, import_)) {
+ // Delegate the resolution to the imported contribution
+ for (Contribution exportingContribution : ((JavaImportModelResolver)import_.getModelResolver()).getExportContributions()) {
+
+ ClassLoader exportClassLoader = getExportClassLoader(exportingContribution);
+ if (exportClassLoader instanceof ContributionClassLoader) {
+
+ for (Export export : exportingContribution.getExports()) {
+ if (import_.match(export)) {
+ url = ((ContributionClassLoader)exportClassLoader).findResourceFromContribution(name);
+ if (url != null) break;
+ }
+ }
+ if (url != null) break;
+ }
+ }
+ if (url != null) break;
+ }
+ }
+
+ }
+ return url;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.net.URLClassLoader#findResources(java.lang.String)
+ */
+ @Override
+ public Enumeration<URL> findResources(String name) throws IOException {
+
+ return Collections.enumeration(findResourceSet(name));
+ }
+
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.ClassLoader#getResource(java.lang.String)
+ *
+ * Find a resource.
+ * Search path for resource:
+ * Parent ClassLoader
+ * This contribution
+ * Imported contributions
+ */
+ @Override
+ public URL getResource(String resName) {
+
+ URL resource = null;
+
+ if (this.getParent() != null) {
+ resource = this.getParent().getResource(resName);
+ }
+ if (resource == null)
+ resource = findResource(resName);
+
+ return resource;
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.ClassLoader#getResources(java.lang.String)
+ *
+ * Return list of resources from this contribution, resources
+ * imported through imported contributions and resources from parent
+ * ClassLoader.
+ */
+ @Override
+ public Enumeration<URL> getResources(String resName) throws IOException {
+
+ HashSet<URL> resourceSet = findResourceSet(resName);
+ addEnumerationToCollection(resourceSet, super.getResources(resName));
+
+ return Collections.enumeration(resourceSet);
+ }
+
+
+ /*
+ * Find set of resources
+ */
+ private HashSet<URL> findResourceSet(String name) throws IOException {
+
+ HashSet<URL> resources = new HashSet<URL>();
+
+ addEnumerationToCollection(resources, super.findResources(name));
+
+ for (Import import_ : this.contribution.getImports()) {
+ if (!(import_ instanceof JavaImport)) {
+ continue;
+ }
+ if (resourceNameMatchesImport(name, import_)) {
+ // Delegate the resolution to the imported contribution
+ for (Contribution exportingContribution : ((JavaImportModelResolver)import_.getModelResolver()).getExportContributions()) {
+
+ ClassLoader exportClassLoader = getExportClassLoader(exportingContribution);
+ if (exportClassLoader instanceof ContributionClassLoader) {
+
+ for (Export export : exportingContribution.getExports()) {
+ if (import_.match(export)) {
+ addEnumerationToCollection(resources,
+ ((ContributionClassLoader)exportClassLoader).findResources(name));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return resources;
+ }
+
+
+ /*
+ * Find class from contribution. If class has already been loaded, return loaded class.
+ */
+ private Class<?> findClassFromContribution(String className) throws ClassNotFoundException {
+
+ Class<?> clazz = findLoadedClass(className);
+ if (clazz == null)
+ clazz = super.findClass(className);
+ return clazz;
+
+ }
+
+ /*
+ * Find resource from contribution.
+ */
+ private URL findResourceFromContribution(String name) {
+
+ return super.findResource(name);
+ }
+
+ /**
+ * Check if a class name matches an import statement.
+ * Class matches if the package name used in <import.java/> matches
+ *
+ * @param name Name of class
+ * @param import_ SCA contribution import
+ * @return true if this is a matching import
+ */
+ private boolean classNameMatchesImport(String name, Import import_) {
+
+ if (import_ instanceof JavaImport && name != null && name.lastIndexOf('.') > 0) {
+ JavaImport javaImport = (JavaImport) import_;
+
+ String packageName = name.substring(0, name.lastIndexOf('.'));
+ if (javaImport.getPackage().endsWith(".*")) {
+ String prefix = javaImport.getPackage().substring(0, javaImport.getPackage().length() -1);
+ if (packageName.startsWith(prefix)) {
+ return true;
+ }
+ } else {
+ return packageName.equals(javaImport.getPackage());
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if a resource name matches an import statement.
+ * Resource matches if package/namespace match the directory of resource.
+ *
+ * @param name Name of resource
+ * @param import_ SCA contribution import
+ * @return true if this is a matching import
+ */
+ private boolean resourceNameMatchesImport(String name, Import import_) {
+
+
+ if (name == null || name.lastIndexOf('/') <= 0)
+ return false;
+ else if (import_ instanceof JavaImport) {
+ JavaImport javaImport = (JavaImport) import_;
+
+ if (javaImport.getPackage().endsWith(".*")) {
+ String packageName = name.substring(0, name.lastIndexOf('/')).replace('/', '.');
+ String prefix = javaImport.getPackage().substring(0, javaImport.getPackage().length() -1);
+ if (packageName.startsWith(prefix)) {
+ return true;
+ }
+ } else {
+ // 'name' is a resource : contains "/" as separators
+ // Get package name from resource name
+ String packageName = name.substring(0, name.lastIndexOf('/'));
+ return packageName.equals(javaImport.getPackage().replaceAll("\\.", "/"));
+ }
+ }
+ return false;
+ }
+
+ /*
+ * Add an enumeration to a Collection
+ */
+ private <T extends Object> void addEnumerationToCollection(Collection<T> collection, Enumeration<T> enumeration) {
+
+ while (enumeration.hasMoreElements())
+ collection.add(enumeration.nextElement());
+ }
+
+
+ @Override
+ public String toString() {
+ return "SCA Contribution ClassLoader location: " + contribution.getLocation() + " parent ClassLoader: " + getParent();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.java
new file mode 100644
index 0000000000..f35f35ac4c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.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.java.impl;
+
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * Implementation of a Java Import model
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaExportImpl implements JavaExport {
+ private ModelResolver modelResolver;
+
+ /**
+ * Java package being exported
+ */
+ private String packageName;
+
+ public JavaExportImpl() {
+ super();
+ }
+
+ public String getPackage() {
+ return this.packageName;
+ }
+
+ public void setPackage(String packageName) {
+ this.packageName = packageName;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java
new file mode 100644
index 0000000000..8d5412f6d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.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.java.impl;
+
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A model resolver for Java exports.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaExportModelResolver implements ModelResolver {
+
+ private JavaExport export;
+ private ModelResolver resolver;
+
+ public JavaExportModelResolver(JavaExport export, ModelResolver resolver) {
+ this.export = export;
+ this.resolver = resolver;
+ }
+
+ public void addModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public Object removeModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ if (!(unresolved instanceof ClassReference)) {
+ return unresolved;
+ }
+
+ // Filter package name
+ ClassReference classReference = (ClassReference)unresolved;
+ String className = classReference.getClassName();
+ int d = className.lastIndexOf('.');
+ String packageName;
+ if (d != -1) {
+ packageName = className.substring(0, d);
+ } else {
+ packageName = "";
+ }
+ if (export.getPackage().equals(packageName)) {
+
+ // Package matches the exported package, delegate to the
+ // contribution's resolver
+ return resolver.resolveModel(modelClass, unresolved);
+ } else {
+
+ // Package is not exported, return the unresolved object
+ return unresolved;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java
new file mode 100644
index 0000000000..9f6ff52289
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.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.sca.contribution.java.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 javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
+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.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * Artifact processor for Java Export
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaExportProcessor implements StAXArtifactProcessor<JavaExport> {
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private static final QName EXPORT_JAVA = new QName(SCA10_NS, "export.java");
+
+ private static final String PACKAGE = "package";
+
+ private final JavaImportExportFactory factory;
+ private final Monitor monitor;
+
+ public JavaExportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ super();
+ this.factory = modelFactories.getFactory(JavaImportExportFactory.class);
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-java-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ public QName getArtifactType() {
+ return EXPORT_JAVA;
+ }
+
+ public Class<JavaExport> getModelType() {
+ return JavaExport.class;
+ }
+
+ /**
+ * Process <export package=""/>
+ */
+ public JavaExport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ JavaExport javaExport = this.factory.createJavaExport();
+ QName element = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ element = reader.getName();
+
+ // Read <export.java>
+ if (EXPORT_JAVA.equals(element)) {
+ String packageName = reader.getAttributeValue(null, PACKAGE);
+ if (packageName == null) {
+ error("AttributePackageMissing", reader);
+ //throw new ContributionReadException("Attribute 'package' is missing");
+ } else
+ javaExport.setPackage(packageName);
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (EXPORT_JAVA.equals(reader.getName())) {
+ return javaExport;
+ }
+ break;
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return javaExport;
+ }
+
+ public void write(JavaExport javaExport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <export.java>
+ writer.writeStartElement(EXPORT_JAVA.getNamespaceURI(), EXPORT_JAVA.getLocalPart());
+
+ if (javaExport.getPackage() != null) {
+ writer.writeAttribute(PACKAGE, javaExport.getPackage());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(JavaExport javaExport, ModelResolver resolver) throws ContributionResolveException {
+
+ if (javaExport.getPackage() != null)
+ // Initialize the export resolver
+ javaExport.setModelResolver(new JavaExportModelResolver(javaExport, resolver));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.java
new file mode 100644
index 0000000000..e5dc397f4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.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.java.impl;
+
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
+
+/**
+ * Java Import/Export Factory implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportExportFactoryImpl implements JavaImportExportFactory {
+
+ public JavaImport createJavaImport() {
+ return new JavaImportImpl();
+ }
+
+ public JavaExport createJavaExport() {
+ return new JavaExportImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java
new file mode 100644
index 0000000000..47cdc9767b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.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.contribution.java.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.resolver.DefaultImportAllModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionListener;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+
+/**
+ * Java Import/Export contribution listener
+ * The listener would process all import/export from a given contribution
+ * and initialize the model resolvers properly
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportExportListener implements ContributionListener {
+
+ private ContributionFactory contributionFactory;
+
+ /**
+ * Constructs a new JavaImportExportListener
+ */
+ public JavaImportExportListener(ModelFactoryExtensionPoint modelFactories) {
+ contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ }
+
+ /**
+ * Initialize the import/export model resolvers
+ * Export model resolvers are same as Contribution model resolver
+ * Import model resolvers are matched to a specific contribution if a location URI is specified,
+ * otherwise it try to resolve against all the other contributions
+ * Also set the exporting contributions used by contribution ClassLoaders to
+ * match import/export for class loading.
+ */
+ public void contributionAdded(ContributionRepository repository, Contribution contribution) {
+
+ // If the contribution does not contain sca-contribution.xml metadata
+ // (for example it's an existing JAR developed before SCA existed)
+ // export all its Java packages
+ ModelResolver modelResolver = contribution.getModelResolver();
+
+ // Look for META-INF/sca-contribution.xml
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(Contribution.SCA_CONTRIBUTION_META);
+ artifact = modelResolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() == null) {
+
+ // Look for META-INF/sca-contribution-generated.xml
+ artifact.setURI(Contribution.SCA_CONTRIBUTION_GENERATED_META);
+ artifact = modelResolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() == null) {
+
+ // No contribution metadata file was found, default to export all the
+ // Java packages found in the contribution
+ Set<String> packages = new HashSet<String>();
+ for (Artifact a: contribution.getArtifacts()) {
+ String uri = a.getURI();
+ if (uri.endsWith(".class")) {
+ uri = uri.substring(0, uri.length() - 6);
+ int d = uri.lastIndexOf('/');
+ if (d != -1) {
+ packages.add(uri.substring(0, d).replace('/', '.'));
+ }
+ }
+ }
+
+ // Add Java export model objects for all the packages we found
+ for (String pkg: packages) {
+ JavaExport export = new JavaExportImpl();
+ export.setPackage(pkg);
+ contribution.getExports().add(export);
+ }
+ }
+ }
+
+ // Initialize the contribution exports
+ for (Export export: contribution.getExports()) {
+ export.setModelResolver(contribution.getModelResolver());
+ }
+
+ // Initialize the contribution imports
+ for (Import import_: contribution.getImports()) {
+ boolean initialized = false;
+
+ if(import_ instanceof JavaImport) {
+ JavaImport javaImport = (JavaImport) import_;
+
+ //Find a matching contribution
+ if(javaImport.getLocation() != null) {
+ Contribution targetContribution = repository.getContribution(javaImport.getLocation());
+ if (targetContribution != null) {
+
+ // Find a matching contribution export
+ for (Export export: targetContribution.getExports()) {
+ if (export instanceof JavaExport) {
+ JavaExport javaExport = (JavaExport)export;
+ if (javaImport.getPackage().equals(javaExport.getPackage())) {
+ List<Contribution> exportingContributions = new ArrayList<Contribution>();
+ exportingContributions.add(targetContribution);
+ javaImport.setModelResolver(new JavaImportModelResolver(exportingContributions, javaExport.getModelResolver()));
+ initialized = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ //if no location was specified, try to resolve with any contribution
+ if (!initialized) {
+ //Use a resolver that will consider all contributions
+ import_.setModelResolver(new JavaImportModelResolver(repository.getContributions(), new DefaultImportAllModelResolver(import_, repository.getContributions())));
+ }
+ }
+ }
+ }
+
+ public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
+
+ }
+
+ public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.java
new file mode 100644
index 0000000000..cc18d5f798
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.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.contribution.java.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * Implementation of a Java Import model
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportImpl implements JavaImport {
+ private ModelResolver modelResolver;
+ private List<Contribution> contributions;
+ /**
+ * Java package name being imported
+ */
+ private String packageName;
+ /**
+ * Contribution URI where the artifact is imported from
+ */
+ private String location;
+
+ public JavaImportImpl() {
+ super();
+ }
+
+ public String getLocation() {
+ return this.location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getPackage() {
+ return this.packageName;
+ }
+
+ public void setPackage(String packageName) {
+ this.packageName = packageName;
+ }
+
+ public ModelResolver getModelResolver() {
+ return this.modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+ public List<Contribution> getExportContributions() {
+ return contributions;
+ }
+
+ public void setExportContributions(List<Contribution> contributions) {
+ this.contributions = contributions;
+ }
+
+ /**
+ * Match a JavaImport to a given JavaExport based on :
+ * location is not provided
+ * import and export packages match
+ */
+ public boolean match(Export export) {
+ if(export instanceof JavaExport) {
+ JavaExport javaExport = (JavaExport)export;
+ String exportedPackage = javaExport.getPackage();
+ if (packageName.equals(exportedPackage)) {
+ return true;
+ } else {
+ if (packageName.endsWith(".*")) {
+ String prefix = packageName.substring(0, packageName.length() - 1);
+ if (exportedPackage.startsWith(prefix)) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(packageName);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.java
new file mode 100644
index 0000000000..484eddd222
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.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.contribution.java.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A JavaImport specific model resolver. This model resolver is temporary
+ * and provides the ContributionClassLoader with the list of exporting
+ * contributions that it currently needs.
+ *
+ * FIXME Remove this class after the ContributionClassLoader is simplified
+ * and cleaned up.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportModelResolver implements ModelResolver {
+
+ private ModelResolver modelResolver;
+ private List<Contribution> contributions;
+
+ public JavaImportModelResolver(List<Contribution> contributions, ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ this.contributions = contributions;
+ }
+
+ public List<Contribution> getExportContributions() {
+ return contributions;
+ }
+
+ public void addModel(Object resolved) {
+ modelResolver.addModel(resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return modelResolver.removeModel(resolved);
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ return modelResolver.resolveModel(modelClass, unresolved);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
new file mode 100644
index 0000000000..d027d75b32
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.java.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 javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
+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.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * Artifact Processor for Java Imports
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportProcessor implements StAXArtifactProcessor<JavaImport> {
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private static final QName IMPORT_JAVA = new QName(SCA10_NS, "import.java");
+
+ private static final String PACKAGE = "package";
+ private static final String LOCATION = "location";
+
+ private final JavaImportExportFactory factory;
+ private final Monitor monitor;
+
+ public JavaImportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ super();
+ this.factory = modelFactories.getFactory(JavaImportExportFactory.class);
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-java-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ public QName getArtifactType() {
+ return IMPORT_JAVA;
+ }
+
+ public Class<JavaImport> getModelType() {
+ return JavaImport.class;
+ }
+
+ /**
+ * Process <import.java package="" location=""/>
+ */
+ public JavaImport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ JavaImport javaImport = this.factory.createJavaImport();
+ QName element = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ element = reader.getName();
+
+ // Read <import.java>
+ if (IMPORT_JAVA.equals(element)) {
+ String packageName = reader.getAttributeValue(null, PACKAGE);
+ if (packageName == null) {
+ error("AttributePackageMissing", reader);
+ //throw new ContributionReadException("Attribute 'package' is missing");
+ } else
+ javaImport.setPackage(packageName);
+
+ String location = reader.getAttributeValue(null, LOCATION);
+ javaImport.setLocation(location);
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (IMPORT_JAVA.equals(reader.getName())) {
+ return javaImport;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return javaImport;
+ }
+
+ public void write(JavaImport javaImport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <import.java>
+ writer.writeStartElement(IMPORT_JAVA.getNamespaceURI(), IMPORT_JAVA.getLocalPart());
+
+ if (javaImport.getPackage() != null) {
+ writer.writeAttribute(PACKAGE, javaImport.getPackage());
+ }
+ if (javaImport.getLocation() != null) {
+ writer.writeAttribute(LOCATION, javaImport.getLocation());
+ }
+
+ writer.writeEndElement();
+ }
+
+
+ public void resolve(JavaImport model, ModelResolver resolver) throws ContributionResolveException {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory
new file mode 100644
index 0000000000..a293330a57
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory
@@ -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.
+
+org.apache.tuscany.sca.contribution.java.impl.JavaImportExportFactoryImpl
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..ac1fa9aade
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.java.impl.JavaImportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#import.java,model=org.apache.tuscany.sca.contribution.java.JavaImport
+org.apache.tuscany.sca.contribution.java.impl.JavaExportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#export.java,model=org.apache.tuscany.sca.contribution.java.JavaExport
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..c69eb40636
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -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.
+
+org.apache.tuscany.sca.contribution.java.impl.ClassReferenceModelResolver;model=org.apache.tuscany.sca.contribution.resolver.ClassReference
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
new file mode 100644
index 0000000000..7debb3d3c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
@@ -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.
+
+org.apache.tuscany.sca.contribution.java.impl.JavaImportExportListener
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties
new file mode 100644
index 0000000000..70b58f75c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties
@@ -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.
+#
+#
+AttributePackageMissing = Attribute 'package' is missing
+
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java
new file mode 100644
index 0000000000..1405ad4bd5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.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.contribution.java.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+
+/**
+ * Test ClassReferenceArtifactResolver.
+ *
+ * @version $Rev: 560435 $ $Date: 2007-07-27 18:26:55 -0700 (Fri, 27 Jul 2007) $
+ */
+public class ClassReferenceArtifactResolverTestCase extends TestCase {
+ private ExtensibleModelResolver resolver;
+
+ @Override
+ protected void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+
+ ModelResolverExtensionPoint resolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
+ resolvers.addResolver(ClassReference.class, ClassReferenceModelResolver.class);
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ resolver = new ExtensibleModelResolver(null, resolvers, modelFactories);
+ }
+
+ /**
+ * Test ClassReference resolution
+ *
+ */
+ public void testResolveClass() {
+ ClassReference ref = new ClassReference(getClass().getName());
+ ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
+ assertFalse(clazz.isUnresolved());
+ assertTrue(clazz.getJavaClass() == getClass());
+ }
+
+ /**
+ * Test ClassReference resolution of inexistent class
+ *
+ */
+ public void testUnresolvedClass() {
+ ClassReference ref = new ClassReference("NonExistentClass");
+ ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
+ assertTrue(clazz.isUnresolved());
+ assertTrue(clazz.getJavaClass() == null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
new file mode 100644
index 0000000000..3ae161642d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.java.impl;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * Test ContributionClassLoader.
+ *
+ */
+public class ContributionClassLoaderTestCase {
+
+ private ContributionFactory contributionFactory;
+ private JavaImportExportFactory javaImportExportFactory;
+
+ @Before
+ public void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ javaImportExportFactory = modelFactories.getFactory(JavaImportExportFactory.class);
+ }
+
+ private Contribution createContribution(String fileName) throws MalformedURLException {
+ Contribution contrib = contributionFactory.createContribution();
+ File contribDir = new File(fileName);
+ contrib.setLocation(contribDir.toURI().toURL().toString());
+ ClassLoader contextClassLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ contrib.setClassLoader(new ContributionClassLoader(contrib, contextClassLoader));
+ return contrib;
+ }
+
+
+ @Test
+ public void testClassLoadingFromContribution() throws ClassNotFoundException, MalformedURLException {
+
+ Contribution contribA = createContribution("target/test-classes");
+ Contribution contribB = createContribution("target");
+ Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
+
+ // Class present in contribution, also in parent. Class is loaded from parent
+ Class<?> testClassA = contribA.getClassLoader().loadClass(this.getClass().getName());
+ Assert.assertNotNull(testClassA);
+ Assert.assertSame(this.getClass(), testClassA);
+
+ // Class not present in contribution, but present in parent ClassLoader
+ Class<?> testClassB = contribB.getClassLoader().loadClass(this.getClass().getName());
+ Assert.assertNotNull(testClassB);
+ Assert.assertSame(this.getClass(), testClassB);
+
+ // Class present in contribution, but not in parent
+ Class<?> testClassC = contribC.getClassLoader().loadClass("calculator.AddService");
+ Assert.assertNotNull(testClassC);
+
+ // Class not present in contribution or in parent
+ try {
+ contribA.getClassLoader().loadClass("NonExistent");
+
+ Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
+
+ } catch (ClassNotFoundException e) {
+ }
+
+
+
+ }
+
+ @Test
+ public void testResourceLoadingFromContribution() throws ClassNotFoundException, MalformedURLException {
+
+ Contribution contribA = createContribution("target/test-classes");
+ Contribution contribB = createContribution("target");
+ Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
+
+ // Resource present in contribution, and in parent
+ URL resA = contribA.getClassLoader().getResource("deployables/sample-calculator.jar");
+ Assert.assertNotNull(resA);
+
+ // Resource not present in contribution, but present in parent ClassLoader
+ URL resB = contribB.getClassLoader().getResource("deployables/sample-calculator.jar");
+ Assert.assertNotNull(resB);
+
+ // Resource present in contribution, but not in parent
+ URL resC = contribC.getClassLoader().getResource("calculator/AddService.class");
+ Assert.assertNotNull(resC);
+
+ // Load Java class as resource from parent
+ String classResName = this.getClass().getName().replaceAll("\\.", "/") + ".class";
+ URL classResA = contribA.getClassLoader().getResource(classResName);
+ Assert.assertNotNull(classResA);
+
+ // Non-existent resource
+ URL res = contribA.getClassLoader().getResource("deployables/NonExistent");
+ Assert.assertNull(res);
+
+ }
+
+ private static String getPackageName(Class<?> cls) {
+ String name = cls.getName();
+ int index = name.lastIndexOf('.');
+ return index == -1 ? "" : name.substring(0, index);
+ }
+
+ @Test
+ public void testClassLoadingFromImportedContribution() throws ClassNotFoundException, MalformedURLException {
+
+ Contribution contribA = createContribution("target/test-classes");
+ Contribution contribB = createContribution("target");
+ Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
+ ArrayList<Contribution> exportContribList = new ArrayList<Contribution>();
+ exportContribList.add(contribA);
+ exportContribList.add(contribC);
+
+ JavaImport import_ = javaImportExportFactory.createJavaImport();
+ import_.setPackage(getPackageName(getClass()));
+ import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
+ contribB.getImports().add(import_);
+ import_ = javaImportExportFactory.createJavaImport();
+ import_.setPackage("calculator");
+ import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
+ contribB.getImports().add(import_);
+
+ JavaExport export = javaImportExportFactory.createJavaExport();
+ export.setPackage(getPackageName(getClass()));
+ contribA.getExports().add(export);
+ export = javaImportExportFactory.createJavaExport();
+ export.setPackage("calculator");
+ contribC.getExports().add(export);
+
+ // Load class from parent, class is also present in imported contribution. Class should
+ // be loaded from parent
+ Class<?> testClassB = contribB.getClassLoader().loadClass(this.getClass().getName());
+ Assert.assertNotNull(testClassB);
+ Assert.assertSame(this.getClass(), testClassB);
+
+ // Load class from parent, class is also present in parent. Class should be loaded
+ // from parent.
+ Class<?> testClassA = contribA.getClassLoader().loadClass(this.getClass().getName());
+ Assert.assertNotNull(testClassA);
+ Assert.assertSame(this.getClass(), testClassA);
+
+ // Imported class should be the same as the one loaded by the exporting contribution
+ Assert.assertSame(testClassA, testClassB);
+
+ // Load class from imported contribution, class is not present in parent
+ Class<?> testClassB1 = contribB.getClassLoader().loadClass("calculator.AddService");
+ Assert.assertNotNull(testClassB1);
+
+ // Imported class should be the same as the one loaded by the exporting contribution
+ Class<?> testClassC = contribC.getClassLoader().loadClass("calculator.AddService");
+ Assert.assertNotNull(testClassC);
+ Assert.assertSame(testClassC, testClassB1);
+
+
+ // Try to load class from package which is not explicitly imported - should throw ClassNotFoundException
+ try {
+ contribA.getClassLoader().loadClass("calculator.AddService");
+
+ Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
+
+ } catch (ClassNotFoundException e) {
+ }
+
+ // Try to load non-existent class from imported package - should throw ClassNotFoundException
+ try {
+ contribB.getClassLoader().loadClass(getPackageName(getClass()) + ".NonExistentClass");
+
+ Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
+
+ } catch (ClassNotFoundException e) {
+ }
+
+ }
+
+ @Test
+ public void testResourceLoadingFromImportedContribution() throws ClassNotFoundException, MalformedURLException {
+
+ Contribution contribA = createContribution("target/test-classes");
+ Contribution contribB = createContribution("target");
+ Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
+
+ ArrayList<Contribution> exportContribList = new ArrayList<Contribution>();
+ exportContribList.add(contribA);
+ exportContribList.add(contribC);
+
+ JavaImport import_ = javaImportExportFactory.createJavaImport();
+ import_.setPackage(getPackageName(getClass()));
+ import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
+ contribB.getImports().add(import_);
+ JavaImport import1_ = javaImportExportFactory.createJavaImport();
+ import1_.setPackage("calculator");
+ import1_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
+ contribB.getImports().add(import1_);
+
+ JavaExport export = javaImportExportFactory.createJavaExport();
+ export.setPackage(getPackageName(getClass()));
+ contribA.getExports().add(export);
+ JavaExport export1 = javaImportExportFactory.createJavaExport();
+ export1.setPackage("calculator");
+ contribC.getExports().add(export1);
+
+
+ // Load resource from parent
+ URL resB = contribB.getClassLoader().getResource("deployables/sample-calculator.jar");
+ Assert.assertNotNull(resB);
+
+ // Load Java class as resource from imported contribution with JavaImport
+ String classResName = this.getClass().getName().replaceAll("\\.", "/") + ".class";
+ URL classResB = contribB.getClassLoader().getResource(classResName);
+ Assert.assertNotNull(classResB);
+
+ // Load Java class as resource from imported contribution with JavaImport
+ URL classResB1 = contribB.getClassLoader().getResource("calculator/AddService.class");
+ Assert.assertNotNull(classResB1);
+
+ // Try to load resource not explicitly imported by contribution
+ URL classResA1 = contribA.getClassLoader().getResource("calculator/AddService.class");
+ Assert.assertNull(classResA1);
+
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java
new file mode 100644
index 0000000000..0ec5bfba39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.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.java.impl;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
+
+/**
+ * Test JavaExportProcessorTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaExportProcessorTestCase extends TestCase {
+
+ private static final String VALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<export.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" package=\"org.apache.tuscany.sca.contribution.java\"/>";
+
+ private static final String INVALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<export.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"/>";
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private Monitor monitor;
+
+ @Override
+ protected void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ if (monitorFactory != null) {
+ monitor = monitorFactory.createMonitor();
+ utilities.addUtility(monitorFactory);
+ }
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+ }
+
+ /**
+ * Test loading a valid export element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+ JavaExport javaExport = (JavaExport)staxProcessor.read(reader);
+ assertEquals("org.apache.tuscany.sca.contribution.java", javaExport.getPackage());
+ }
+
+ /**
+ * Test loading an INVALID export element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+ /*try {
+ staxProcessor.read(reader);
+ fail("readerException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }*/
+ staxProcessor.read(reader);
+ Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
+ assertNotNull(problem);
+ assertEquals("AttributePackageMissing", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java
new file mode 100644
index 0000000000..9e43b744cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.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.contribution.java.impl;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
+
+/**
+ * Test JavaImportProcessorTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportProcessorTestCase extends TestCase {
+
+ private static final String VALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<import.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" package=\"org.apache.tuscany.sca.contribution.java\" location=\"sca://contributions/001\"/>";
+
+ private static final String INVALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<import.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>";
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private Monitor monitor;
+
+ @Override
+ protected void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ if (monitorFactory != null) {
+ monitor = monitorFactory.createMonitor();
+ utilities.addUtility(monitorFactory);
+ }
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+ }
+
+ /**
+ * Test loading a valid import element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+ JavaImport javaImport = (JavaImport)staxProcessor.read(reader);
+
+ assertEquals("org.apache.tuscany.sca.contribution.java", javaImport.getPackage());
+ assertEquals("sca://contributions/001", javaImport.getLocation());
+ }
+
+ /**
+ * Test loading a INVALID import element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+ /*try {
+ staxProcessor.read(reader);
+ fail("readerException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }*/
+ staxProcessor.read(reader);
+ Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
+ assertNotNull(problem);
+ assertEquals("AttributePackageMissing", problem.getMessageId());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/resources/deployables/sample-calculator.jar b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/resources/deployables/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-java/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/LICENSE b/sca-java-1.x/branches/sca-android/modules/contribution-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-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-android/modules/contribution-xml/META-INF/README b/sca-java-1.x/branches/sca-android/modules/contribution-xml/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/NOTICE b/sca-java-1.x/branches/sca-android/modules/contribution-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/contribution-xml/pom.xml b/sca-java-1.x/branches/sca-android/modules/contribution-xml/pom.xml
new file mode 100644
index 0000000000..b1a06c2d11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/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-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-xml</artifactId>
+ <name>Apache Tuscany SCA XML Contribution Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.xml</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.contribution.xml*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java
new file mode 100644
index 0000000000..a4cf1b3566
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.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.xml;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * URLArtifactProcessor that handles sca-contribution-generated.xml files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionGeneratedMetadataDocumentProcessor extends ContributionMetadataDocumentProcessor {
+
+ public ContributionGeneratedMetadataDocumentProcessor(XMLInputFactory inputFactory,
+ StAXArtifactProcessor staxProcessor,
+ Monitor monitor) {
+ super(inputFactory, staxProcessor, monitor);
+ }
+
+ public ContributionGeneratedMetadataDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor staxProcessor,
+ Monitor monitor) {
+ super(modelFactories, staxProcessor, monitor);
+ }
+
+ @Override
+ public String getArtifactType() {
+ return "sca-contribution-generated.xml";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
new file mode 100644
index 0000000000..e2e97239e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.contribution.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ContributionMetadata;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * URLArtifactProcessor that handles sca-contribution.xml files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionMetadataDocumentProcessor implements URLArtifactProcessor<ContributionMetadata>{
+ private final StAXArtifactProcessor staxProcessor;
+ private final XMLInputFactory inputFactory;
+ private final Monitor monitor;
+
+ public ContributionMetadataDocumentProcessor(XMLInputFactory inputFactory,
+ StAXArtifactProcessor staxProcessor,
+ Monitor monitor) {
+ this.inputFactory = inputFactory;
+ this.staxProcessor = staxProcessor;
+ this.monitor = monitor;
+ }
+
+ public ContributionMetadataDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor staxProcessor,
+ Monitor monitor) {
+ this.inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ this.staxProcessor = staxProcessor;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-xml-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ public String getArtifactType() {
+ return "sca-contribution.xml";
+ }
+
+ public Class<ContributionMetadata> getModelType() {
+ return ContributionMetadata.class;
+ }
+
+ public ContributionMetadata read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+
+ // Create a stream reader
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ urlStream = connection.getInputStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+ reader.nextTag();
+
+ // Read the contribution model
+ ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader);
+
+ return contribution;
+
+ } catch (XMLStreamException e) {
+ ContributionReadException ex = new ContributionReadException(e);
+ error("XMLStreamException", inputFactory, ex);
+ throw ex;
+ } catch (IOException e) {
+ ContributionReadException ex = new ContributionReadException(e);
+ error("IOException", inputFactory, ex);
+ throw ex;
+ } finally {
+ try {
+ if (urlStream != null) {
+ urlStream.close();
+ urlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(ContributionMetadata contribution, ModelResolver resolver) throws ContributionResolveException {
+ staxProcessor.resolve(contribution, resolver);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
new file mode 100644
index 0000000000..3f5aacb541
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.xml;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ContributionMetadata;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * Processor for contribution metadata
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionMetadataProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<ContributionMetadata> {
+
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private static final QName CONTRIBUTION_QNAME = new QName(SCA10_NS, "contribution");
+ private static final QName DEPLOYABLE_QNAME = new QName(SCA10_NS, "deployable");
+
+ private final AssemblyFactory assemblyFactory;
+ private final ContributionFactory contributionFactory;
+
+ private final StAXArtifactProcessor<Object> extensionProcessor;
+ private Monitor monitor;
+
+ public ContributionMetadataProcessor(AssemblyFactory assemblyFactory,
+ ContributionFactory contributionFactory,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ Monitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.contributionFactory = contributionFactory;
+ this.extensionProcessor = extensionProcessor;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ public ContributionMetadataProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ Monitor monitor) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ this.extensionProcessor = extensionProcessor;
+ this.monitor = monitor;
+ }
+
+
+ public QName getArtifactType() {
+ return CONTRIBUTION_QNAME;
+ }
+
+ public Class<ContributionMetadata> getModelType() {
+ return ContributionMetadata.class;
+ }
+
+ public ContributionMetadata read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ContributionMetadata contribution = null;
+ QName name = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ name = reader.getName();
+
+ if (CONTRIBUTION_QNAME.equals(name)) {
+
+ // Read <contribution>
+ contribution = this.contributionFactory.createContributionMetadata();
+ contribution.setUnresolved(true);
+
+ } else if (DEPLOYABLE_QNAME.equals(name)) {
+
+ // Read <deployable>
+ QName compositeName = getQName(reader, "composite");
+ if (compositeName == null) {
+ error("AttributeCompositeMissing", reader);
+ //throw new ContributionReadException("Attribute 'composite' is missing");
+ } else {
+ if (contribution != null) {
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(compositeName);
+ composite.setUnresolved(true);
+ contribution.getDeployables().add(composite);
+ }
+ }
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null && contribution != null) {
+ if (extension instanceof Import) {
+ contribution.getImports().add((Import)extension);
+ } else if (extension instanceof Export) {
+ contribution.getExports().add((Export)extension);
+ }
+ }
+ }
+ break;
+
+ case XMLStreamConstants.END_ELEMENT:
+ if (CONTRIBUTION_QNAME.equals(reader.getName())) {
+ return contribution;
+ }
+ break;
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return contribution;
+ }
+
+ public void write(ContributionMetadata contribution, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <contribution>
+ writeStartDocument(writer, CONTRIBUTION_QNAME.getNamespaceURI(), CONTRIBUTION_QNAME.getLocalPart());
+
+ // Write <import>
+ for (Import imp: contribution.getImports()) {
+ extensionProcessor.write(imp, writer);
+ }
+
+ // Write <export>
+ for (Export export: contribution.getExports()) {
+ extensionProcessor.write(export, writer);
+ }
+
+ // Write <deployable>
+ for (Composite deployable: contribution.getDeployables()) {
+ writeStart(writer, DEPLOYABLE_QNAME.getNamespaceURI(), DEPLOYABLE_QNAME.getLocalPart(),
+ new XAttr("composite", deployable.getName()));
+ writeEnd(writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(ContributionMetadata contribution, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve imports and exports
+ for (Export export: contribution.getExports()) {
+ extensionProcessor.resolve(export, resolver);
+ }
+ for (Import import_: contribution.getImports()) {
+ extensionProcessor.resolve(import_, resolver);
+ }
+
+ // Resolve deployable composites
+ List<Composite> deployables = contribution.getDeployables();
+ for (int i = 0, n = deployables.size(); i < n; i++) {
+ Composite deployable = deployables.get(i);
+ Composite resolved = (Composite)resolver.resolveModel(Composite.class, deployable);
+ if (resolved != deployable) {
+ deployables.set(i, resolved);
+ }
+ }
+
+ contribution.setUnresolved(false);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java
new file mode 100644
index 0000000000..f226dbbee3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.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.contribution.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for Contribution models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionModelResolver implements ModelResolver {
+
+ private Map<String, Contribution> map = new HashMap<String, Contribution>();
+
+ public ContributionModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public void addModel(Object resolved) {
+ Contribution contribution = (Contribution)resolved;
+ map.put(contribution.getURI(), contribution);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((Contribution)resolved).getURI());
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ // Lookup a contribution for the given URI
+ String uri = ((Contribution)unresolved).getURI();
+ if (uri != null) {
+ Contribution resolved = (Contribution) map.get(uri);
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+ return unresolved;
+ } else {
+
+ // If no URI was specified, just return the first contribution
+ if (!map.isEmpty()) {
+ Contribution resolved = map.values().iterator().next();
+ return modelClass.cast(resolved);
+ } else {
+ return unresolved;
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..b73c380370
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+org.apache.tuscany.sca.contribution.xml.ContributionMetadataProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#contribution,model=org.apache.tuscany.sca.contribution.ContributionMetadata
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
new file mode 100644
index 0000000000..23adab56b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
@@ -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.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;type=sca-contribution.xml,model=org.apache.tuscany.sca.contribution.ContributionMetadata
+org.apache.tuscany.sca.contribution.xml.ContributionGeneratedMetadataDocumentProcessor;type=sca-contribution-generated.xml
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..68030bf6e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -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.
+
+org.apache.tuscany.sca.contribution.xml.ContributionModelResolver;model=org.apache.tuscany.sca.contribution.Contribution
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties
new file mode 100644
index 0000000000..3e1a0187fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties
@@ -0,0 +1,23 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+XMLStreamException = XMLStreamException occured due to:
+IOException = IOException occured due to:
+AttributeCompositeMissing = Attribute 'composite' is missing \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
new file mode 100644
index 0000000000..8f69f15cd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.contribution.xml;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.ContributionMetadata;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
+
+/**
+ * Test the contribution metadata processor.
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class ContributionMetadataProcessorTestCase extends TestCase {
+
+ private static final String VALID_XML =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable composite=\"ns:Composite2\"/>"
+ + "</contribution>";
+
+ private static final String INVALID_XML =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable/>"
+ + "</contribution>";
+
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private Monitor monitor;
+
+ @Override
+ protected void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+
+ inputFactory = XMLInputFactory.newInstance();
+ outputFactory = XMLOutputFactory.newInstance();
+
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ if (monitorFactory != null) {
+ monitor = monitorFactory.createMonitor();
+ utilities.addUtility(monitorFactory);
+ }
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
+ }
+
+ public void testRead() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+ ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader);
+ assertNotNull(contribution);
+ assertEquals(2, contribution.getDeployables().size());
+ }
+
+ public void testReadInvalid() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+ /*try {
+ staxProcessor.read(reader);
+ fail("InvalidException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }*/
+ staxProcessor.read(reader);
+ Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
+ assertNotNull(problem);
+ assertEquals("AttributeCompositeMissing", problem.getMessageId());
+ }
+
+ public void testWrite() throws Exception {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+ ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader);
+
+ validateContribution(contribution);
+
+ //write the contribution metadata contents
+ StringWriter stringWriter = new StringWriter();
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stringWriter);
+ staxProcessor.write(contribution, writer);
+ stringWriter.close();
+
+ reader = inputFactory.createXMLStreamReader(new StringReader(stringWriter.toString()));
+ contribution = (ContributionMetadata)staxProcessor.read(reader);
+
+ validateContribution(contribution);
+ }
+
+ private void validateContribution(ContributionMetadata contribution) {
+ QName deployable;
+
+ assertNotNull(contribution);
+ assertEquals(2, contribution.getDeployables().size());
+ deployable = new QName("http://ns", "Composite1");
+ assertEquals(deployable, contribution.getDeployables().get(0).getName());
+ deployable = new QName("http://ns", "Composite2");
+ assertEquals(deployable, contribution.getDeployables().get(1).getName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/LICENSE b/sca-java-1.x/branches/sca-android/modules/contribution/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/contribution/META-INF/README b/sca-java-1.x/branches/sca-android/modules/contribution/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/NOTICE b/sca-java-1.x/branches/sca-android/modules/contribution/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/contribution/pom.xml b/sca-java-1.x/branches/sca-android/modules/contribution/pom.xml
new file mode 100644
index 0000000000..5a1c4b55b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution</artifactId>
+ <name>Apache Tuscany SCA Contribution Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0-2</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.contribution</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.contribution*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java
new file mode 100644
index 0000000000..7400501d85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.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.contribution;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+
+/**
+ * Represents an artifact in an SCA contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Artifact extends Base {
+
+ /**
+ * Returns the URI that unique identifies the artifact inside the contribution.
+ *
+ * @return The artifact URI
+ */
+ String getURI();
+
+ /**
+ * Sets the URI that uniquely identifies the artifact inside the contribution.
+ *
+ * @param uri The artifact URI
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns the location of the artifact.
+ *
+ * @return The artifact location
+ */
+ String getLocation();
+
+ /**
+ * Set the location of the artifact.
+ *
+ * @param location The artifact location
+ */
+ void setLocation(String location);
+
+
+ /**
+ * Returns the in-memory model representing the artifact.
+ *
+ * @return The model object
+ */
+ Object getModel();
+
+ /**
+ * Sets the in-memory model representing the artifact.
+ *
+ * @param model The model object
+ */
+ void setModel(Object model);
+
+ /**
+ * Returns the contents of the artifact cached here.
+ * @return the contents of the artifact
+ */
+ byte[] getContents();
+
+ /**
+ * Sets the contents of the artifact.
+ * @param contents the contents of the artifact
+ */
+ void setContents(byte[] contents);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Constants.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Constants.java
new file mode 100644
index 0000000000..4cf20125b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Constants.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.contribution;
+
+/**
+ * Constants used in SCA contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Constants {
+ String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ String SCA10_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java
new file mode 100644
index 0000000000..81b0b08b9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.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.contribution;
+
+/**
+ * Constants for the main supported contribution package type.
+ *
+ * @version $Rev$ $Date$
+ */
+@Deprecated
+public interface ContentType {
+
+ /**
+ * Java compressed contribution package
+ */
+ String JAR = "application/x-compressed";
+
+ /**
+ * Filesystem folder contribution package
+ */
+ String FOLDER = "application/vnd.tuscany.folder";
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
new file mode 100644
index 0000000000..743c2356d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.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.contribution;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an SCA contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Contribution extends Artifact {
+
+ /**
+ * Default location of contribution metadata in an SCA contribution.
+ */
+ String SCA_CONTRIBUTION_META = "META-INF/sca-contribution.xml";
+
+ /**
+ * Default location of a generated contribution metadata in an SCA contribution.
+ */
+ String SCA_CONTRIBUTION_GENERATED_META = "META-INF/sca-contribution-generated.xml";
+
+ /**
+ * Default location of deployable composites in an SCA contribution.
+ */
+ String SCA_CONTRIBUTION_DEPLOYABLES = "META-INF/sca-deployables/";
+
+
+ /**
+ * Returns a list of exports based on the contribution metadata.
+ *
+ * @return The list of exports in this contribution
+ */
+ List<Export> getExports();
+
+ /**
+ * Returns a list of imports based on the contribution metadata.
+ *
+ * @return The list of imports in this contribution
+ */
+ List<Import> getImports();
+
+ /**
+ * Returns the list of deployable composites in the contribution.
+ *
+ * @return The list of deployable composites
+ */
+ List<Composite> getDeployables();
+
+ /**
+ * Returns the list of artifacts in the contribution.
+ *
+ * @return The list of artifacts in the contribution
+ */
+ List<Artifact> 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);
+
+ /**
+ * Returns the ClassLoader used to load classes and resources from
+ * this contribution
+ *
+ * FIXME Remove this, the base contribution model should not depend
+ * on Java ClassLoaders.
+ *
+ * @return The contribution ClassLoader
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Sets the ClassLoader used to load classes and resources from
+ * this contribution
+ *
+ * FIXME Remove this, the base contribution model should not depend
+ * on Java ClassLoaders.
+ *
+ * @param classLoader the contribution class loader
+ */
+ void setClassLoader(ClassLoader classLoader);
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
new file mode 100644
index 0000000000..67c9a05a0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.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.contribution;
+
+
+/**
+ * A factory for the contribution model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionFactory {
+
+ /**
+ * Create a contribution model object
+ *
+ * @return The new contribution model object
+ */
+ Contribution createContribution();
+
+ /**
+ * Create a contribution metadata model object
+ *
+ * @return The new contribution metadata model object
+ */
+ ContributionMetadata createContributionMetadata();
+
+ /**
+ * Create a deployedArtifact model object
+ *
+ * @return The new deployedArtifact model object
+ */
+ @Deprecated
+ DeployedArtifact createDeployedArtifact();
+
+ /**
+ * Create an artifact model object
+ *
+ * @return The new artifact model object
+ */
+ Artifact createArtifact();
+
+ /**
+ * Create a default import model object.
+ *
+ * @return the new default import model object
+ */
+ DefaultImport createDefaultImport();
+
+ /**
+ * Create a default export model object.
+ *
+ * @return the new default export model object
+ */
+ DefaultExport createDefaultExport();
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java
new file mode 100644
index 0000000000..4043fb9eda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.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;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Composite;
+
+/**
+ * The representation of SCA contribution metadata.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionMetadata extends Base {
+
+ /**
+ * Returns a list of exports based on the contribution metadata.
+ *
+ * @return The list of exports
+ */
+ List<Export> getExports();
+
+ /**
+ * Returns a list of imports based on the contribution metadata.
+ *
+ * @return The list of imports
+ */
+ List<Import> getImports();
+
+ /**
+ * Returns the list of deployable based on the contribution metadata.
+ *
+ * @return The list of deployable composites
+ */
+ List<Composite> getDeployables();
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java
new file mode 100644
index 0000000000..98954c288a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.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.contribution;
+
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+
+
+/**
+ * Default implementation of a contribution model factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultContributionFactory extends ContributionFactoryImpl {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultExport.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultExport.java
new file mode 100644
index 0000000000..b2eddb8336
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultExport.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.contribution;
+
+
+/**
+ * The representation of an export that exports all artifacts in
+ * a contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DefaultExport extends Export {
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultImport.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultImport.java
new file mode 100644
index 0000000000..20798dcd17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultImport.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.contribution;
+
+
+/**
+ * The representation of a default import that imports artifacts from
+ * all contributions.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DefaultImport extends Import {
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java
new file mode 100644
index 0000000000..b69c58a0ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.contribution;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+
+/**
+ * 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>();
+
+ /**
+ * Constructs a new DefaultModelFactoryExtensionPoint.
+ */
+ public DefaultModelFactoryExtensionPoint() {
+ }
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ public void addFactory(Object factory) {
+ Class<?>[] interfaces = factory.getClass().getInterfaces();
+ if (interfaces.length == 0) {
+ Class<?> sc = factory.getClass().getSuperclass();
+ if (sc != Object.class) {
+ factories.put(sc, factory);
+ }
+ } else {
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.put(interfaces[i], factory);
+ }
+ }
+ }
+
+ /**
+ * Remove a model factory.
+ *
+ * @param factory The factory to remove
+ */
+ public void removeFactory(Object factory) {
+ Class<?>[] interfaces = factory.getClass().getInterfaces();
+ if (interfaces.length == 0) {
+ Class<?> sc = factory.getClass().getSuperclass();
+ if (sc != Object.class) {
+ factories.remove(sc);
+ }
+ } else {
+ 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);
+ if (factory == null) {
+
+ if (factoryInterface.isInterface()) {
+
+ // Dynamically load a factory class declared under META-INF/services
+ try {
+ Class<?> factoryClass = ServiceDiscovery.getInstance().loadFirstServiceClass(factoryInterface);
+ if (factoryClass != null) {
+
+ try {
+ // Default empty constructor
+ Constructor<?> constructor = factoryClass.getConstructor();
+ factory = constructor.newInstance();
+ } catch (NoSuchMethodException e) {
+
+ // Constructor taking the model factory extension point
+ Constructor<?> constructor = factoryClass.getConstructor(ModelFactoryExtensionPoint.class);
+ factory = constructor.newInstance(this);
+ }
+
+ // Cache the loaded factory
+ addFactory(factory);
+ }
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ } else {
+
+ // Call the newInstance static method on the factory abstract class
+ try {
+ factory = ServiceDiscovery.getInstance().newFactoryClassInstance(factoryInterface);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+
+ // Cache the factory
+ addFactory(factory);
+ }
+ }
+ return factoryInterface.cast(factory);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java
new file mode 100644
index 0000000000..ffe190132c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.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;
+
+/**
+ * Representation of a deployed artifact
+ *
+ * @version $Rev$ $Date$
+ */
+@Deprecated
+public interface DeployedArtifact extends Artifact {
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java
new file mode 100644
index 0000000000..bfa16b1ce3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.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.contribution;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an export.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Export {
+
+ /**
+ * 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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java
new file mode 100644
index 0000000000..35076f55a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.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;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * The representation of an import.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Import {
+
+ /**
+ * 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);
+
+ /**
+ * Verify that a specific export actually exports what is being imported.
+ *
+ * @param export The Exported being verified
+ * @return true/false
+ */
+ boolean match(Export export);
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java
new file mode 100644
index 0000000000..0ada4ebec3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/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.contribution;
+
+/**
+ * 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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java
new file mode 100644
index 0000000000..c0dd5431d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.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;
+
+/**
+ * Constants for the main supported contribution package types.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PackageType {
+
+ /**
+ * Java compressed contribution package
+ */
+ String JAR = "application/x-compressed";
+
+ /**
+ * Filesystem folder contribution package
+ */
+ String FOLDER = "application/vnd.tuscany.folder";
+
+
+ String BUNDLE = "application/osgi.bundle";
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
new file mode 100644
index 0000000000..881987f622
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.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.impl;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+
+
+/**
+ * The model representing an artifact in a contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+class ArtifactImpl implements Artifact {
+ private String uri;
+ private String location;
+ private Object model;
+ private boolean unresolved;
+ private byte[] contents;
+
+ ArtifactImpl() {
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public void setModel(Object model) {
+ this.model = model;
+ }
+
+ public byte[] getContents() {
+ return contents;
+ }
+
+ public void setContents(byte[] contents) {
+ this.contents = contents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof Artifact) {
+ return uri.equals(((Artifact)obj).getURI());
+ } else {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Artifact:" + uri + "\n" +
+ "at: " + location;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java
new file mode 100644
index 0000000000..c678c2eaef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.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.impl;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ContributionMetadata;
+import org.apache.tuscany.sca.contribution.DefaultExport;
+import org.apache.tuscany.sca.contribution.DefaultImport;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+
+
+/**
+ * Default implementation of a contribution model factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionFactoryImpl implements ContributionFactory {
+
+ protected ContributionFactoryImpl() {
+ }
+
+ public Contribution createContribution() {
+ return new ContributionImpl();
+ }
+
+ public ContributionMetadata createContributionMetadata() {
+ return new ContributionMetadataImpl();
+ }
+
+ public Artifact createArtifact() {
+ return new ArtifactImpl();
+ }
+
+ public DefaultExport createDefaultExport() {
+ return new DefaultExportImpl();
+ }
+
+ public DefaultImport createDefaultImport() {
+ return new DefaultImportImpl();
+ }
+
+ @Deprecated
+ public DeployedArtifact createDeployedArtifact() {
+ class DeployedArtifactImpl extends ArtifactImpl implements DeployedArtifact {
+ }
+ return new DeployedArtifactImpl();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
new file mode 100644
index 0000000000..fc9ae607e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.contribution.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of a deployed contribution
+ *
+ * @version $Rev$ $Date$
+ */
+class ContributionImpl implements Contribution {
+ private String uri;
+ private String location;
+ private Object model;
+ private byte[] contents;
+ private boolean unresolved;
+ private List<Export> exports = new ArrayList<Export>();
+ private List<Import> imports = new ArrayList<Import>();
+ private List<Composite> deployables = new ArrayList<Composite>();
+ private List<Artifact> artifacts = new ArrayList<Artifact>();
+ private ModelResolver modelResolver;
+
+ // FIXME remove this dependency on Java ClassLoaders
+ private ClassLoader classLoader;
+
+ ContributionImpl() {
+ }
+
+ public String getLocation() {
+ return this.location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ //FIXME Remove dependency on Java ClassLoaders
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ //FIXME Remove dependency on Java ClassLoaders
+ public void setClassLoader(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+
+ public String getURI() {
+ return this.uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public void setModel(Object model) {
+ this.model = model;
+ }
+
+ public byte[] getContents() {
+ return contents;
+ }
+
+ public void setContents(byte[] contents) {
+ this.contents = contents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+ public List<Export> getExports() {
+ return exports;
+ }
+
+ public List<Import> getImports() {
+ return imports;
+ }
+
+ public List<Composite> getDeployables() {
+ return deployables;
+ }
+
+ public List<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ @Override
+ public int hashCode() {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof Artifact) {
+ return uri.equals(((Artifact)obj).getURI());
+ } else {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Contribution : " + uri + " \n" +
+ "from: " + location;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java
new file mode 100644
index 0000000000..75b12b1260
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.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.contribution.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.ContributionMetadata;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+
+/**
+ * The representation of a deployed contribution
+ *
+ * @version $Rev$ $Date$
+ */
+class ContributionMetadataImpl implements ContributionMetadata {
+ private boolean unresolved;
+ private List<Export> exports = new ArrayList<Export>();
+ private List<Import> imports = new ArrayList<Import>();
+ private List<Composite> deployables = new ArrayList<Composite>();
+
+ ContributionMetadataImpl() {
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public List<Export> getExports() {
+ return exports;
+ }
+
+ public List<Import> getImports() {
+ return imports;
+ }
+
+ public List<Composite> getDeployables() {
+ return deployables;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultExportImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultExportImpl.java
new file mode 100644
index 0000000000..e67395337a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultExportImpl.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.impl;
+
+import org.apache.tuscany.sca.contribution.DefaultExport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an export for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultExportImpl implements DefaultExport {
+ private ModelResolver modelResolver;
+
+ protected DefaultExportImpl() {
+ super();
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultImportImpl.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultImportImpl.java
new file mode 100644
index 0000000000..17c09f2cbc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultImportImpl.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.impl;
+
+import org.apache.tuscany.sca.contribution.DefaultExport;
+import org.apache.tuscany.sca.contribution.DefaultImport;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an import for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultImportImpl implements DefaultImport {
+ private ModelResolver modelResolver;
+
+ protected DefaultImportImpl() {
+ super();
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+
+ public boolean match(Export export) {
+ if (export instanceof DefaultExport) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java
new file mode 100644
index 0000000000..b5f536c431
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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;
+
+/**
+ * Base interface for artifact processors.
+ *
+ * @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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
new file mode 100644
index 0000000000..f23797a831
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
@@ -0,0 +1,539 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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 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.NamespaceContext;
+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;
+
+
+/**
+ * A base class with utility methods for the other artifact processors in this module.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseStAXArtifactProcessor {
+
+ /**
+ * 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) {
+ return false;
+ }
+ return Boolean.valueOf(value);
+ }
+
+ /**
+ * 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 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();
+ }
+ }
+
+ /**
+ * Returns the string value of an attribute.
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected String getString(XMLStreamReader reader, String name) {
+ return reader.getAttributeValue(null, name);
+ }
+
+ /**
+ * Test if an attribute is explicitly set
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected boolean isSet(XMLStreamReader reader, String name) {
+ return reader.getAttributeValue(null, name) != null;
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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--;
+ }
+ }
+ }
+
+ /**
+ *
+ * @param writer
+ * @param uri
+ * @throws XMLStreamException
+ */
+ private String writeElementPrefix(XMLStreamWriter writer, String uri) throws XMLStreamException {
+ if (uri == null) {
+ return null;
+ }
+ String prefix = writer.getPrefix(uri);
+ if (prefix != null) {
+ return null;
+ } 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);
+ return prefix;
+ }
+
+ }
+
+ /**
+ * Start an element.
+ * @param uri
+ * @param name
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStart(XMLStreamWriter writer, String uri, String name, XAttr... attrs) throws XMLStreamException {
+ String prefix = writeElementPrefix(writer, uri);
+ writer.writeStartElement(uri, name);
+ if (prefix != null){
+ writer.writeNamespace(prefix,uri);
+ }
+ writeAttributePrefixes(writer, attrs);
+ writeAttributes(writer, attrs);
+ }
+
+ /**
+ * Start an element.
+ * @param qname
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStart(XMLStreamWriter writer, QName qname, XAttr... attrs) throws XMLStreamException {
+ writeStart(writer, qname.getNamespaceURI(), qname.getLocalPart(), 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 uri, String name, XAttr... attrs) throws XMLStreamException {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(uri);
+ writeStart(writer, uri, name, attrs);
+ writer.writeDefaultNamespace(uri);
+ }
+
+ /**
+ * Start a document.
+ * @param writer
+ * @param qname
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStartDocument(XMLStreamWriter writer, QName qname, XAttr... attrs) throws XMLStreamException {
+ writeStartDocument(writer, qname.getNamespaceURI(), qname.getLocalPart(), attrs);
+ }
+
+ /**
+ * 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 attribute prefixes to the current element.
+ * @param writer
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeAttributePrefixes(XMLStreamWriter writer, XAttr... attrs) throws XMLStreamException {
+ for (XAttr attr : attrs) {
+ if (attr != null)
+ attr.writePrefix(writer);
+ }
+ }
+
+ /**
+ * Represents an XML attribute that needs to be written to a document.
+ */
+ public static class XAttr {
+
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private String uri = SCA10_NS;
+ private String name;
+ private 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(null, name, value);
+ }
+
+ public XAttr(String uri, String name, List<?> values) {
+ this.uri = uri;
+ this.name = name;
+ this.value = values;
+ }
+
+ public XAttr(String name, List<?> values) {
+ this(null, name, values);
+ }
+
+ public XAttr(String uri, String name, Boolean value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String name, Boolean value) {
+ this(null, name, value);
+ }
+
+ public XAttr(String uri, String name, Integer value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String name, Integer value) {
+ this(null, name, value);
+ }
+
+ public XAttr(String uri, String name, Double value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String name, Double value) {
+ this(null, name, 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(null, name, value);
+ }
+
+ /**
+ * Writes a string from a QName and registers a prefix for its namespace.
+ * @param reader
+ * @param value
+ * @return
+ */
+ private 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
+ if (prefix.length() > 0) {
+ return prefix + ":" + qname.getLocalPart();
+ } else {
+
+ // Empty prefix, just return the local part of the given qname
+ return 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;
+ }
+ }
+
+ /**
+ * Registers a prefix for the namespace of a QName.
+ * @param reader
+ * @param value
+ * @return
+ */
+ private void writeQNamePrefix(XMLStreamWriter writer, QName qname) throws XMLStreamException {
+ if (qname != null) {
+ String prefix = qname.getPrefix();
+ String uri = qname.getNamespaceURI();
+ prefix = writer.getPrefix(uri);
+ if (prefix != null) {
+ return;
+ } 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);
+ }
+ }
+ }
+
+ /**
+ * Write to document
+ * @param writer
+ * @throws XMLStreamException
+ */
+ public void write(XMLStreamWriter writer) throws XMLStreamException {
+ String str;
+ if (value instanceof QName) {
+
+ // Write a QName
+ str = writeQNameValue(writer, (QName)value);
+
+ } else if (value instanceof List) {
+
+ // Write a list of values
+ List<?> values = (List<?>)value;
+ if (values.isEmpty()) {
+ return;
+ }
+ StringBuffer buffer = new StringBuffer();
+ for (Object v: values) {
+ if (v == null) {
+ // Skip null values
+ continue;
+ }
+
+ if (v instanceof XAttr) {
+ // Write an XAttr value
+ ((XAttr)v).write(writer);
+ continue;
+ }
+
+ if (buffer.length() != 0) {
+ buffer.append(' ');
+ }
+ if (v instanceof QName) {
+ // Write a QName value
+ buffer.append(writeQNameValue(writer, (QName)v));
+ } else {
+ // Write value as a string
+ buffer.append(String.valueOf(v));
+ }
+ }
+ str = buffer.toString();
+
+ } else {
+
+ // Write a string
+ if (value == null) {
+ return;
+ }
+ str = String.valueOf(value);
+ }
+ if (str.length() == 0) {
+ return;
+ }
+
+ // Write the attribute
+ if (uri != null && !uri.equals(SCA10_NS)) {
+ writer.writeAttribute(uri, name, str);
+ } else {
+ writer.writeAttribute(name,str);
+ }
+ }
+
+ /**
+ * Registers a prefix for the namespace of a QName or list of QNames
+ * @param writer
+ * @throws XMLStreamException
+ */
+ public void writePrefix(XMLStreamWriter writer) throws XMLStreamException {
+ if (value instanceof QName) {
+
+ // Write prefix for a single QName value
+ writeQNamePrefix(writer, (QName)value);
+
+ } else if (value instanceof List) {
+
+ // Write prefixes for a list of values
+ for (Object v: (List<?>)value) {
+ if (v instanceof QName) {
+ // Write prefix for a QName value
+ writeQNamePrefix(writer, (QName)v);
+
+ } else if (v instanceof XAttr) {
+ // Write prefix for an XAttr value
+ ((XAttr)v).writePrefix(writer);
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..3c67a8c550
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 extension point.
+ *
+ * @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.
+ */
+ 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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java
new file mode 100644
index 0000000000..426d7beb29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.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.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a package processor extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultPackageProcessorExtensionPoint implements PackageProcessorExtensionPoint {
+
+ private Map<String, PackageProcessor> processors = new HashMap<String, PackageProcessor>();
+ private boolean loaded;
+
+ public DefaultPackageProcessorExtensionPoint() {
+ }
+
+ public void addPackageProcessor(PackageProcessor processor) {
+ processors.put(processor.getPackageType(), processor);
+ }
+
+ public void removePackageProcessor(PackageProcessor processor) {
+ processors.remove(processor.getPackageType());
+ }
+
+ public PackageProcessor getPackageProcessor(String contentType) {
+ loadProcessors();
+ return processors.get(contentType);
+ }
+
+ private void loadProcessors() {
+ if (loaded)
+ return;
+
+ // Get the processor service declarations
+ Set<ServiceDeclaration> processorDeclarations;
+ try {
+ processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(PackageProcessor.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration processorDeclaration: processorDeclarations) {
+ Map<String, String> attributes = processorDeclaration.getAttributes();
+
+ // Load a URL artifact processor
+ String packageType = attributes.get("type");
+
+ // Create a processor wrapper and register it
+ PackageProcessor processor = new LazyPackageProcessor(packageType, processorDeclaration);
+ addPackageProcessor(processor);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A facade for package processors.
+ */
+ private static class LazyPackageProcessor implements PackageProcessor {
+
+ private ServiceDeclaration processorDeclaration;
+ private String packageType;
+ private PackageProcessor processor;
+
+ private LazyPackageProcessor(String packageType, ServiceDeclaration processorDeclaration) {
+ this.processorDeclaration = processorDeclaration;
+ this.packageType = packageType;
+ }
+
+ public URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException {
+ return getProcessor().getArtifactURL(packageSourceURL, artifact);
+ }
+
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException, IOException {
+ return getProcessor().getArtifacts(packageSourceURL, inputStream);
+ }
+
+ public String getPackageType() {
+ return packageType;
+ }
+
+ @SuppressWarnings("unchecked")
+ private PackageProcessor getProcessor() {
+ if (processor == null) {
+ try {
+ Class<PackageProcessor> processorClass = (Class<PackageProcessor>)processorDeclaration.loadClass();
+ Constructor<PackageProcessor> constructor = processorClass.getConstructor();
+ processor = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return processor;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..f23ebc2c36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
@@ -0,0 +1,388 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.lang.reflect.Constructor;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+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.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * The default implementation of an extension point for StAX artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultStAXArtifactProcessorExtensionPoint extends
+ DefaultArtifactProcessorExtensionPoint<StAXArtifactProcessor> implements StAXArtifactProcessorExtensionPoint {
+
+ private ExtensionPointRegistry extensionPoints;
+ private ModelFactoryExtensionPoint modelFactories;
+ private MonitorFactory monitorFactory;
+ private boolean loaded;
+ private StAXArtifactProcessor<Object> extensibleStAXProcessor;
+ private StAXAttributeProcessor<Object> extensibleStAXAttributeProcessor;
+ private Monitor monitor = null;
+
+ /**
+ * Constructs a new extension point.
+ */
+ public DefaultStAXArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+ this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ UtilityExtensionPoint utilities = this.extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ if (monitorFactory != null)
+ this.monitor = monitorFactory.createMonitor();
+ this.extensibleStAXProcessor = new ExtensibleStAXArtifactProcessor(this, inputFactory, outputFactory, this.monitor);
+
+ StAXAttributeProcessorExtensionPoint attributeExtensionPoint = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
+ this.extensibleStAXAttributeProcessor = new ExtensibleStAXAttributeProcessor(attributeExtensionPoint ,inputFactory, outputFactory, this.monitor);
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ public void addArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
+ if (artifactProcessor.getArtifactType() != null) {
+ processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
+ }
+ if (artifactProcessor.getModelType() != null) {
+ processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
+ }
+ }
+
+ public void removeArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
+ if (artifactProcessor.getArtifactType() != null) {
+ processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
+ }
+ if (artifactProcessor.getModelType() != null) {
+ processorsByModelType.remove(artifactProcessor.getModelType());
+ }
+ }
+
+ @Override
+ public StAXArtifactProcessor getProcessor(Class<?> modelType) {
+ loadArtifactProcessors();
+ return super.getProcessor(modelType);
+ }
+
+ @Override
+ public StAXArtifactProcessor getProcessor(Object artifactType) {
+ loadArtifactProcessors();
+ return super.getProcessor(artifactType);
+ }
+
+ /**
+ * Returns a QName object from a QName expressed as {ns}name
+ * or ns#name.
+ *
+ * @param qname
+ * @return
+ */
+ private static QName getQName(String qname) {
+ if (qname == null) {
+ return null;
+ }
+ qname = qname.trim();
+ if (qname.startsWith("{")) {
+ int h = qname.indexOf('}');
+ if (h != -1) {
+ return new QName(qname.substring(1, h), qname.substring(h + 1));
+ }
+ } else {
+ int h = qname.indexOf('#');
+ if (h != -1) {
+ return new QName(qname.substring(0, h), qname.substring(h + 1));
+ }
+ }
+ throw new IllegalArgumentException("Invalid qname: "+qname);
+ }
+
+ /**
+ * Lazily load artifact processors registered in the extension point.
+ */
+ private void loadArtifactProcessors() {
+ if (loaded)
+ return;
+
+ // Get the processor service declarations
+ Set<ServiceDeclaration> processorDeclarations;
+ try {
+ processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(StAXArtifactProcessor.class);
+ } catch (IOException e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", extensibleStAXProcessor, ie);
+ throw ie;
+ }
+
+ for (ServiceDeclaration processorDeclaration : processorDeclarations) {
+ Map<String, String> attributes = processorDeclaration.getAttributes();
+
+ // Load a StAX artifact processor
+
+ // Get the model QName
+ QName artifactType = getQName(attributes.get("qname"));
+
+ // Get the model class name
+ String modelTypeName = attributes.get("model");
+
+ // Get the model factory class name
+ String factoryName = attributes.get("factory");
+
+ // Create a processor wrapper and register it
+ StAXArtifactProcessor processor =
+ new LazyStAXArtifactProcessor(artifactType, modelTypeName, factoryName,
+ processorDeclaration, extensionPoints, modelFactories,
+ extensibleStAXProcessor,extensibleStAXAttributeProcessor, monitor);
+ addArtifactProcessor(processor);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A wrapper around an Artifact processor class allowing lazy loading and
+ * initialization of artifact processors.
+ */
+ private static class LazyStAXArtifactProcessor implements StAXArtifactProcessor {
+
+ private ExtensionPointRegistry extensionPoints;
+ private QName artifactType;
+ private String modelTypeName;
+ private String factoryName;
+ private ServiceDeclaration processorDeclaration;
+ private StAXArtifactProcessor processor;
+ private Class<?> modelType;
+ private StAXArtifactProcessor<Object> extensionProcessor;
+ private StAXAttributeProcessor<Object> extensionAttributeProcessor;
+ private Monitor monitor;
+
+ LazyStAXArtifactProcessor(QName artifactType,
+ String modelTypeName,
+ String factoryName,
+ ServiceDeclaration processorDeclaration,
+ ExtensionPointRegistry extensionPoints,
+ ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ StAXAttributeProcessor<Object> extensionAttributeProcessor,
+ Monitor monitor) {
+
+ this.extensionPoints = extensionPoints;
+ this.artifactType = artifactType;
+ this.modelTypeName = modelTypeName;
+ this.factoryName = factoryName;
+ this.processorDeclaration = processorDeclaration;
+ this.extensionProcessor = extensionProcessor;
+ this.extensionAttributeProcessor = extensionAttributeProcessor;
+ this.monitor = monitor;
+ }
+
+ public QName getArtifactType() {
+ return artifactType;
+ }
+
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private StAXArtifactProcessor getProcessor() {
+ if (processor == null) {
+
+ if (processorDeclaration.getClassName()
+ .equals("org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor")) {
+
+ // Specific initialization for the DefaultBeanModelProcessor
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ try {
+ Class<StAXArtifactProcessor> processorClass =
+ (Class<StAXArtifactProcessor>)processorDeclaration.loadClass();
+ Object modelFactory;
+ if (factoryName != null) {
+ Class<?> factoryClass = (Class<?>)processorDeclaration.loadClass(factoryName);
+ modelFactory = modelFactories.getFactory(factoryClass);
+ } else {
+ modelFactory = null;
+ }
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(AssemblyFactory.class,
+ PolicyFactory.class,
+ QName.class,
+ Class.class,
+ Object.class,
+ Monitor.class);
+ processor =
+ constructor.newInstance(assemblyFactory,
+ policyFactory,
+ artifactType,
+ getModelType(),
+ modelFactory,
+ monitor);
+ } catch (Exception e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", processor, ie);
+ throw ie;
+ }
+ } else {
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ // Load and instantiate the processor class
+ try {
+ Class<StAXArtifactProcessor> processorClass =
+ (Class<StAXArtifactProcessor>)processorDeclaration.loadClass();
+ try {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class);
+ processor = constructor.newInstance(modelFactories, monitor);
+ } catch (NoSuchMethodException e) {
+ try {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ExtensionPointRegistry.class, Monitor.class);
+ processor = constructor.newInstance(extensionPoints, monitor);
+ } catch (NoSuchMethodException e1) {
+ try {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class);
+ processor = constructor.newInstance(modelFactories, extensionProcessor, monitor);
+ } catch (NoSuchMethodException e2) {
+ try {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, StAXAttributeProcessor.class, Monitor.class);
+ processor = constructor.newInstance(modelFactories, extensionProcessor, extensionAttributeProcessor, monitor);
+ } catch (NoSuchMethodException e2a) {
+ try {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class, Monitor.class);
+ processor = constructor.newInstance(extensionPoints, extensionProcessor, monitor);
+ } catch (NoSuchMethodException e3) {
+ try {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class, StAXAttributeProcessor.class, Monitor.class);
+ processor = constructor.newInstance(extensionPoints, extensionProcessor, extensionAttributeProcessor, monitor);
+ } catch (NoSuchMethodException e3a) {
+
+ try {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class);
+ processor = constructor.newInstance(modelFactories);
+ } catch (NoSuchMethodException e4) {
+ try {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ExtensionPointRegistry.class);
+ processor = constructor.newInstance(extensionPoints);
+ } catch (NoSuchMethodException e4a) {
+ try {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class);
+ processor = constructor.newInstance(modelFactories, extensionProcessor);
+ } catch (NoSuchMethodException e5) {
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class);
+ processor = constructor.newInstance(extensionPoints, extensionProcessor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", processor, ie);
+ throw ie;
+ }
+ }
+ }
+ return processor;
+ }
+
+ public Object read(XMLStreamReader inputSource) throws ContributionReadException, XMLStreamException {
+ return getProcessor().read(inputSource);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException,
+ XMLStreamException {
+ getProcessor().write(model, outputSource);
+ }
+
+ public Class<?> getModelType() {
+ if (modelTypeName != null && modelType == null) {
+ try {
+ modelType = processorDeclaration.loadClass(modelTypeName);
+ } catch (Exception e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", processorDeclaration, ie);
+ throw ie;
+ }
+ }
+ return modelType;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+ getProcessor().resolve(model, resolver);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
new file mode 100644
index 0000000000..d81e236b40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
@@ -0,0 +1,327 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.contribution.processor;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+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.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * The default implementation of an extension point for StAX artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultStAXAttributeProcessorExtensionPoint extends
+ DefaultArtifactProcessorExtensionPoint<StAXAttributeProcessor> implements StAXAttributeProcessorExtensionPoint {
+
+ private ExtensionPointRegistry extensionPoints;
+ private ModelFactoryExtensionPoint modelFactories;
+ private StAXAttributeProcessor<Object> extensibleStAXAttributeProcessor;
+ private boolean loaded;
+ private Monitor monitor = null;
+
+ /**
+ * Constructs a new extension point.
+ */
+ public DefaultStAXAttributeProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+ this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ UtilityExtensionPoint utilities = this.extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ if (monitorFactory != null) {
+ this.monitor = monitorFactory.createMonitor();
+ }
+ this.extensibleStAXAttributeProcessor = new ExtensibleStAXAttributeProcessor(this, inputFactory, outputFactory, this.monitor);
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ public void addArtifactProcessor(StAXAttributeProcessor artifactProcessor) {
+ if (artifactProcessor.getArtifactType() != null) {
+ processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
+ }
+ if (artifactProcessor.getModelType() != null) {
+ processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
+ }
+ }
+
+ public void removeArtifactProcessor(StAXAttributeProcessor artifactProcessor) {
+ if (artifactProcessor.getArtifactType() != null) {
+ processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
+ }
+ if (artifactProcessor.getModelType() != null) {
+ processorsByModelType.remove(artifactProcessor.getModelType());
+ }
+ }
+
+ @Override
+ public StAXAttributeProcessor getProcessor(Class<?> modelType) {
+ loadArtifactProcessors();
+ return super.getProcessor(modelType);
+ }
+
+ @Override
+ public StAXAttributeProcessor getProcessor(Object artifactType) {
+ loadArtifactProcessors();
+ return super.getProcessor(artifactType);
+ }
+
+ /**
+ * Returns a QName object from a QName expressed as {ns}name
+ * or ns#name.
+ *
+ * @param qname
+ * @return
+ */
+ private static QName getQName(String qname) {
+ if (qname == null) {
+ return null;
+ }
+ qname = qname.trim();
+ if (qname.startsWith("{")) {
+ int h = qname.indexOf('}');
+ if (h != -1) {
+ return new QName(qname.substring(1, h), qname.substring(h + 1));
+ }
+ } else {
+ int h = qname.indexOf('#');
+ if (h != -1) {
+ return new QName(qname.substring(0, h), qname.substring(h + 1));
+ }
+ }
+ throw new IllegalArgumentException("Invalid qname: "+qname);
+ }
+
+ /**
+ * Lazily load artifact processors registered in the extension point.
+ */
+ private void loadArtifactProcessors() {
+ if (loaded)
+ return;
+
+ // Get the processor service declarations
+ Set<ServiceDeclaration> processorDeclarations;
+ try {
+ processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(StAXAttributeProcessor.class);
+ } catch (IOException e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", extensibleStAXAttributeProcessor, ie);
+ throw ie;
+ }
+
+ for (ServiceDeclaration processorDeclaration : processorDeclarations) {
+ Map<String, String> attributes = processorDeclaration.getAttributes();
+
+ // Load a StAX artifact processor
+
+ // Get the model QName
+ QName artifactType = getQName(attributes.get("qname"));
+
+ // Get the model class name
+ String modelTypeName = attributes.get("model");
+
+ // Get the model factory class name
+ String factoryName = attributes.get("factory");
+
+ // Create a processor wrapper and register it
+ StAXAttributeProcessor processor =
+ new LazyStAXAttributeProcessor(artifactType, modelTypeName, factoryName,
+ processorDeclaration, extensionPoints, modelFactories,
+ extensibleStAXAttributeProcessor, monitor);
+ addArtifactProcessor(processor);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A wrapper around an Artifact processor class allowing lazy loading and
+ * initialization of artifact processors.
+ */
+ private static class LazyStAXAttributeProcessor implements StAXAttributeProcessor {
+
+ private ExtensionPointRegistry extensionPoints;
+ private QName artifactType;
+ private String modelTypeName;
+ private String factoryName;
+ private ServiceDeclaration processorDeclaration;
+ private StAXAttributeProcessor processor;
+ private Class<?> modelType;
+ private StAXAttributeProcessor<Object> extensionProcessor;
+ private Monitor monitor;
+
+ LazyStAXAttributeProcessor(QName artifactType,
+ String modelTypeName,
+ String factoryName,
+ ServiceDeclaration processorDeclaration,
+ ExtensionPointRegistry extensionPoints,
+ ModelFactoryExtensionPoint modelFactories,
+ StAXAttributeProcessor<Object> extensionProcessor,
+ Monitor monitor) {
+
+ this.extensionPoints = extensionPoints;
+ this.artifactType = artifactType;
+ this.modelTypeName = modelTypeName;
+ this.factoryName = factoryName;
+ this.processorDeclaration = processorDeclaration;
+ this.extensionProcessor = extensionProcessor;
+ this.monitor = monitor;
+ }
+
+ public QName getArtifactType() {
+ return artifactType;
+ }
+
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private StAXAttributeProcessor getProcessor() {
+ if (processor == null) {
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ // Load and instantiate the processor class
+ try {
+ Class<StAXAttributeProcessor> processorClass =
+ (Class<StAXAttributeProcessor>)processorDeclaration.loadClass();
+ try {
+ Constructor<StAXAttributeProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class);
+ processor = constructor.newInstance(modelFactories, monitor);
+ } catch (NoSuchMethodException e) {
+ try {
+ Constructor<StAXAttributeProcessor> constructor =
+ processorClass.getConstructor(ExtensionPointRegistry.class, Monitor.class);
+ processor = constructor.newInstance(extensionPoints, monitor);
+ } catch (NoSuchMethodException e1) {
+ try {
+ Constructor<StAXAttributeProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class);
+ processor = constructor.newInstance(modelFactories, extensionProcessor, monitor);
+ } catch (NoSuchMethodException e2) {
+ try {
+ Constructor<StAXAttributeProcessor> constructor =
+ processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class, Monitor.class);
+ processor = constructor.newInstance(extensionPoints, extensionProcessor, monitor);
+ } catch (NoSuchMethodException e3) {
+ try {
+ Constructor<StAXAttributeProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class);
+ processor = constructor.newInstance(modelFactories);
+ } catch (NoSuchMethodException e4) {
+ try {
+ Constructor<StAXAttributeProcessor> constructor =
+ processorClass.getConstructor(ExtensionPointRegistry.class);
+ processor = constructor.newInstance(extensionPoints);
+ } catch (NoSuchMethodException e4a) {
+ try {
+ Constructor<StAXAttributeProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class);
+ processor = constructor.newInstance(modelFactories, extensionProcessor);
+ } catch (NoSuchMethodException e5) {
+ Constructor<StAXAttributeProcessor> constructor =
+ processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class);
+ processor = constructor.newInstance(extensionPoints, extensionProcessor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", processor, ie);
+ throw ie;
+ }
+
+ }
+ return processor;
+ }
+
+ public Object read(QName attributeName, XMLStreamReader inputSource) throws ContributionReadException, XMLStreamException {
+ return getProcessor().read(attributeName, inputSource);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
+ getProcessor().write(model, outputSource);
+ }
+
+ public Class<?> getModelType() {
+ if (modelTypeName != null && modelType == null) {
+ try {
+ modelType = processorDeclaration.loadClass(modelTypeName);
+ } catch (Exception e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", processorDeclaration, ie);
+ throw ie;
+ }
+ }
+ return modelType;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+ getProcessor().resolve(model, resolver);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..045c201638
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.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.contribution.processor;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.URI;
+import java.net.URL;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+
+/**
+ * The default implementation of a URL artifact processor extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultURLArtifactProcessorExtensionPoint
+ extends DefaultArtifactProcessorExtensionPoint<URLArtifactProcessor>
+ implements URLArtifactProcessorExtensionPoint {
+
+ private ExtensionPointRegistry extensionPoints;
+ private StAXArtifactProcessor<?> staxProcessor;
+ private boolean loaded;
+ private Monitor monitor = null;
+
+ /**
+ * Constructs a new extension point.
+ */
+ public DefaultURLArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+ ModelFactoryExtensionPoint modelFactories = this.extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ UtilityExtensionPoint utilities = this.extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ if (monitorFactory != null)
+ this.monitor = monitorFactory.createMonitor();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, this.monitor);
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ public void addArtifactProcessor(URLArtifactProcessor artifactProcessor) {
+ if (artifactProcessor.getArtifactType() != null) {
+ processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
+ }
+ if (artifactProcessor.getModelType() != null) {
+ processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
+ }
+ }
+
+ public void removeArtifactProcessor(URLArtifactProcessor artifactProcessor) {
+ if (artifactProcessor.getArtifactType() != null) {
+ processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
+ }
+ if (artifactProcessor.getModelType() != null) {
+ processorsByModelType.remove(artifactProcessor.getModelType());
+ }
+ }
+
+ @Override
+ public URLArtifactProcessor getProcessor(Class<?> modelType) {
+ loadProcessors();
+ return super.getProcessor(modelType);
+ }
+
+ @Override
+ public URLArtifactProcessor getProcessor(Object artifactType) {
+ loadProcessors();
+ return super.getProcessor(artifactType);
+ }
+
+ /**
+ * Lazily load artifact processors registered in the extension point.
+ */
+ private void loadProcessors() {
+ if (loaded)
+ return;
+
+ // Get the processor service declarations
+ Set<ServiceDeclaration> processorDeclarations;
+ try {
+ processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(URLArtifactProcessor.class);
+ } catch (IOException e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", staxProcessor, ie);
+ throw ie;
+ }
+
+ for (ServiceDeclaration processorDeclaration: processorDeclarations) {
+ Map<String, String> attributes = processorDeclaration.getAttributes();
+ // Load a URL artifact processor
+ String artifactType = attributes.get("type");
+ String modelTypeName = attributes.get("model");
+
+ // Create a processor wrapper and register it
+ URLArtifactProcessor processor = new LazyURLArtifactProcessor(artifactType, modelTypeName,
+ processorDeclaration, extensionPoints, staxProcessor, monitor);
+ addArtifactProcessor(processor);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A wrapper around an Artifact processor class allowing lazy loading and
+ * initialization of artifact processors.
+ */
+ private static class LazyURLArtifactProcessor implements URLArtifactProcessor {
+
+ private ExtensionPointRegistry extensionPoints;
+ private String artifactType;
+ private String modelTypeName;
+ private ServiceDeclaration processorDeclaration;
+ private URLArtifactProcessor processor;
+ private Class<?> modelType;
+ private StAXArtifactProcessor<?> staxProcessor;
+ private Monitor monitor;
+
+ LazyURLArtifactProcessor(String artifactType,
+ String modelTypeName,
+ ServiceDeclaration processorDeclaration,
+ ExtensionPointRegistry extensionPoints,
+ StAXArtifactProcessor<?> staxProcessor,
+ Monitor monitor) {
+ this.artifactType = artifactType;
+ this.modelTypeName = modelTypeName;
+ this.processorDeclaration = processorDeclaration;
+ this.extensionPoints = extensionPoints;
+ this.staxProcessor = staxProcessor;
+ this.monitor = monitor;
+ }
+
+ public String getArtifactType() {
+ return artifactType;
+ }
+
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private URLArtifactProcessor getProcessor() {
+ if (processor == null) {
+ try {
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ Class<URLArtifactProcessor> processorClass = (Class<URLArtifactProcessor>)processorDeclaration.loadClass();
+ try {
+ Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class);
+ processor = constructor.newInstance(modelFactories, monitor);
+ } catch (NoSuchMethodException e) {
+ try {
+ Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class);
+ processor = constructor.newInstance(modelFactories, staxProcessor, monitor);
+ } catch (NoSuchMethodException e2) {
+ Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class, Monitor.class);
+ processor = constructor.newInstance(extensionPoints, staxProcessor, monitor);
+ }
+ }
+ } catch (Exception e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", processor, ie);
+ throw ie;
+ }
+ }
+ return processor;
+ }
+
+ public Object read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ return getProcessor().read(contributionURL, artifactURI, artifactURL);
+ }
+
+ public Class<?> getModelType() {
+ if (modelTypeName != null && modelType == null) {
+ try {
+ modelType = processorDeclaration.loadClass(modelTypeName);
+ } catch (ClassNotFoundException e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", processorDeclaration, ie);
+ throw ie;
+ }
+ }
+ return modelType;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+ getProcessor().resolve(model, resolver);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultUnknownElementProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultUnknownElementProcessor.java
new file mode 100644
index 0000000000..d52a110c05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultUnknownElementProcessor.java
@@ -0,0 +1,272 @@
+package org.apache.tuscany.sca.contribution.processor;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.traversal.DocumentTraversal;
+import org.w3c.dom.traversal.NodeFilter;
+import org.w3c.dom.traversal.NodeIterator;
+import org.w3c.dom.traversal.TreeWalker;
+
+public class DefaultUnknownElementProcessor{
+
+ private Monitor monitor;
+ private static final Logger logger = Logger.getLogger(DefaultUnknownElementProcessor.class.getName());
+
+ public DefaultUnknownElementProcessor(Monitor monitor){
+ this.monitor = monitor;
+ }
+ private DocumentBuilderFactory documentBuilderFactory;
+ private Document document;
+
+ /**
+ * Reads the contetns of the unknown elements and generates the DOM
+ * @param reader
+ * @param name
+ * @return
+ * @throws XMLStreamException
+ */
+ public Object read(XMLStreamReader reader, QName name) throws XMLStreamException{
+
+ int event = reader.getEventType();
+ int level = 0;
+ ArrayList<String> elementList = new ArrayList<String>();
+ document = createDocument();
+ while(reader.hasNext()){
+ switch(event){
+ case START_ELEMENT:
+ elementList.add(reader.getName().getLocalPart());
+ if(level == 0){
+ generateDOM(reader,null);
+ level++;
+ }
+ else{
+ generateDOM(reader,elementList.get(elementList.size()-2).toString());
+ }
+
+ break;
+ case END_ELEMENT:
+ elementList.remove(reader.getName().getLocalPart());
+ }
+ if(reader.hasNext()){
+ event = reader.next();
+ }
+
+ if(event == START_ELEMENT || event == END_ELEMENT){
+ if(reader.getName().equals(name)){
+ break;
+ }
+ }
+ }
+ return document;
+ }
+
+ /**
+ * Writes unknown portions back to the writer
+ * @param model
+ * @param writer
+ */
+ public void write(Object model, XMLStreamWriter writer) {
+
+ if( ! (model instanceof Document)) {
+ return;
+ }
+
+ Document doc = (Document)model;
+ try{
+ DocumentTraversal traversal = (DocumentTraversal)doc;
+ TreeWalker walker = traversal.createTreeWalker(doc.getDocumentElement(),NodeFilter.SHOW_ALL, null, true);
+ writeDOM(walker,writer);
+ }
+ catch(Exception e){
+ if (logger.isLoggable(Level.SEVERE)) {
+ logger.log(Level.SEVERE, "Document not created ");
+ }
+ error("Document not created",document,e);
+ }
+ }
+
+ /**
+ * Method to generate the DOM
+ * @param reader
+ * @param parent
+ * @throws Exception
+ */
+ //private void generateDOM(String elementText, String parent) {
+ private void generateDOM(XMLStreamReader reader, String parent) {
+ try{
+ String elePrefix = reader.getPrefix();
+ String eleQName = reader.getLocalName();
+ if (elePrefix != null && elePrefix.length() != 0) {
+ eleQName = elePrefix + ":" + eleQName;
+ }
+
+ Element element = document.createElementNS(reader.getNamespaceURI(), eleQName);
+
+ int attributeCount = reader.getAttributeCount();
+ for(int i = 0;i < attributeCount;i++){
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+ if (prefix != null && prefix.length() != 0) {
+ qname = prefix + ":" + qname;
+ }
+ element.setAttributeNS(ns,qname,value);
+ }
+ if(parent == null){
+ if(document != null){
+ document.appendChild(element);
+ }
+ else{
+ if (logger.isLoggable(Level.SEVERE)) {
+ logger.log(Level.SEVERE, "Document not created ");
+ }
+ error("Document not created",document,element);
+ }
+ }
+ else{
+ Node parentNode = getParentNode(document,parent);
+ if(parentNode != null){
+ parentNode.appendChild(element);
+ }
+ else{
+ if (logger.isLoggable(Level.SEVERE)) {
+ logger.log(Level.SEVERE, "Parent node not found");
+ }
+ error("Parent node not found",document,parentNode.getNodeName());
+ }
+ }
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ if (logger.isLoggable(Level.SEVERE)) {
+ logger.log(Level.SEVERE, "Document not created ");
+ }
+ error("Document not created",document,e);
+ }
+ }
+
+ /**
+ * Method to create an empty document
+ * @return
+ */
+ private Document createDocument() {
+ try {
+ if (documentBuilderFactory == null) {
+ documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ }
+ document = documentBuilderFactory.newDocumentBuilder().newDocument();
+ return document;
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * Method to traverse the DOM structure and write the elements
+ * @param walker
+ * @param writer
+ * @throws XMLStreamException
+ */
+ private void writeDOM(TreeWalker walker,XMLStreamWriter writer) throws XMLStreamException {
+
+ Node parent = walker.getCurrentNode();
+
+ writer.writeStartElement(parent.getPrefix(), parent.getLocalName(), parent.getNamespaceURI());
+
+ NamedNodeMap attributes = parent.getAttributes();
+
+ for(int i = 0;i<attributes.getLength();i++){
+ writer.writeAttribute(attributes.item(i).getPrefix(), attributes.item(i).getNamespaceURI(), attributes.item(i).getLocalName(), attributes.item(i).getNodeValue());
+ }
+
+ for (Node n = walker.firstChild();n != null;n = walker.nextSibling()) {
+ writeDOM(walker,writer);
+ }
+ writer.writeEndElement();
+
+ walker.setCurrentNode(parent);
+ }
+
+ /**
+ * Method to get the Parent node out of the DOM structure
+ * @param doc
+ * @param parent
+ * @return
+ */
+ private Node getParentNode(Node doc,String parent) {
+ Node parentNode = null;
+ try{
+ DocumentTraversal traversal = (DocumentTraversal)doc;
+
+ CharSequence prefixChar = ":";
+ NodeIterator iterator = traversal.createNodeIterator(document.getDocumentElement(), NodeFilter.SHOW_ELEMENT, null, true);
+ for (Node n = iterator.nextNode(); n != null; n = iterator.nextNode()) {
+ String nodeName = n.getNodeName();
+ String[] str = null;
+ if(n.getNodeName().contains(prefixChar)){
+ str = nodeName.split(":");
+ nodeName = str[str.length-1];
+ }
+ if(parent.equalsIgnoreCase(nodeName)){
+ parentNode = n;
+ }
+ }
+ return parentNode;
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ }
+ return parentNode;
+ }
+
+ /**
+ * Marshals exceptions into the monitor
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
new file mode 100644
index 0000000000..7be5566113
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLReporter;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.XMLEventAllocator;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * Default implementation of an XMLInputFactory that creates validating
+ * XMLStreamReaders.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultValidatingXMLInputFactory extends ValidatingXMLInputFactory {
+
+ private XMLInputFactory inputFactory;
+ private ValidationSchemaExtensionPoint schemas;
+ private Monitor monitor;
+ private boolean initialized;
+ private boolean hasSchemas;
+ private Schema aggregatedSchema;
+
+ /**
+ * Constructs a new XMLInputFactory.
+ *
+ * @param inputFactory
+ * @param schemas
+ */
+ public DefaultValidatingXMLInputFactory(XMLInputFactory inputFactory, ValidationSchemaExtensionPoint schemas, Monitor monitor) {
+ this.inputFactory = inputFactory;
+ this.schemas = schemas;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Initialize the registered schemas and create an aggregated schema for
+ * validation.
+ */
+ private void initializeSchemas() {
+ if (initialized) {
+ return;
+ }
+ initialized = true;
+
+ // Load the XSDs registered in the validation schema extension point
+ try {
+ List<String> uris = schemas.getSchemas();
+ int n = uris.size();
+ if (n ==0) {
+ return;
+ } else {
+ hasSchemas = true;
+ }
+ final Source[] sources = new Source[n];
+ for (int i =0; i < n; i++) {
+ final String uri = uris.get(i);
+ // Allow privileged access to open URL stream. Requires FilePermission in security policy.
+ final URL url = new URL( uri );
+ InputStream urlStream;
+ try {
+ urlStream = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
+ public InputStream run() throws IOException {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ return connection.getInputStream();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ error("PrivilegedActionException", url, (IOException)e.getException());
+ throw (IOException)e.getException();
+ }
+ sources[i] = new StreamSource(urlStream, uri);
+ }
+
+ // Create an aggregated validation schemas from all the XSDs
+ final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ // Allow privileged access to check files. Requires FilePermission
+ // in security policy.
+ try {
+ aggregatedSchema = AccessController.doPrivileged(new PrivilegedExceptionAction<Schema>() {
+ public Schema run() throws SAXException {
+ return schemaFactory.newSchema(sources);
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ error("PrivilegedActionException", schemaFactory, (SAXException)e.getException());
+ throw (SAXException)e.getException();
+ }
+
+ } catch (Error e) {
+ // FIXME Log this, some old JDKs don't support XMLSchema validation
+ //e.printStackTrace();
+ } catch (SAXParseException e) {
+ IllegalStateException ie = new IllegalStateException(e);
+ error("IllegalStateException", schemas, ie);
+ throw ie;
+ } catch (Exception e) {
+ //FIXME Log this, some old JDKs don't support XMLSchema validation
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public XMLEventReader createFilteredReader(XMLEventReader arg0, EventFilter arg1) throws XMLStreamException {
+ return inputFactory.createFilteredReader(arg0, arg1);
+ }
+
+ @Override
+ public XMLStreamReader createFilteredReader(XMLStreamReader arg0, StreamFilter arg1) throws XMLStreamException {
+ return inputFactory.createFilteredReader(arg0, arg1);
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(InputStream arg0, String arg1) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0, arg1);
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(InputStream arg0) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0);
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(Reader arg0) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0);
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(Source arg0) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0);
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(String arg0, InputStream arg1) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0, arg1);
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(String arg0, Reader arg1) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0, arg1);
+ }
+
+ @Override
+ public XMLEventReader createXMLEventReader(XMLStreamReader arg0) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0);
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(InputStream arg0, String arg1) throws XMLStreamException {
+ initializeSchemas();
+ if (hasSchemas) {
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
+ }else {
+ return inputFactory.createXMLStreamReader(arg0, arg1);
+ }
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(InputStream arg0) throws XMLStreamException {
+ initializeSchemas();
+ if (hasSchemas) {
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
+ } else {
+ return inputFactory.createXMLStreamReader(arg0);
+ }
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(Reader arg0) throws XMLStreamException {
+ initializeSchemas();
+ if (hasSchemas) {
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
+ } else {
+ return inputFactory.createXMLStreamReader(arg0);
+ }
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(Source arg0) throws XMLStreamException {
+ initializeSchemas();
+ if (hasSchemas) {
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
+ } else {
+ return inputFactory.createXMLStreamReader(arg0);
+ }
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(String arg0, InputStream arg1) throws XMLStreamException {
+ initializeSchemas();
+ if (hasSchemas) {
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
+ } else {
+ return inputFactory.createXMLStreamReader(arg0, arg1);
+ }
+ }
+
+ @Override
+ public XMLStreamReader createXMLStreamReader(String arg0, Reader arg1) throws XMLStreamException {
+ initializeSchemas();
+ if (hasSchemas) {
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
+ } else {
+ return inputFactory.createXMLStreamReader(arg0, arg1);
+ }
+ }
+
+ @Override
+ public XMLEventAllocator getEventAllocator() {
+ return inputFactory.getEventAllocator();
+ }
+
+ @Override
+ public Object getProperty(String arg0) throws IllegalArgumentException {
+ return inputFactory.getProperty(arg0);
+ }
+
+ @Override
+ public XMLReporter getXMLReporter() {
+ return inputFactory.getXMLReporter();
+ }
+
+ @Override
+ public XMLResolver getXMLResolver() {
+ return inputFactory.getXMLResolver();
+ }
+
+ @Override
+ public boolean isPropertySupported(String arg0) {
+ return inputFactory.isPropertySupported(arg0);
+ }
+
+ @Override
+ public void setEventAllocator(XMLEventAllocator arg0) {
+ inputFactory.setEventAllocator(arg0);
+ }
+
+ @Override
+ public void setProperty(String arg0, Object arg1) throws IllegalArgumentException {
+ inputFactory.setProperty(arg0, arg1);
+ }
+
+ @Override
+ public void setXMLReporter(XMLReporter arg0) {
+ inputFactory.setXMLReporter(arg0);
+ }
+
+ @Override
+ public void setXMLResolver(XMLResolver arg0) {
+ inputFactory.setXMLResolver(arg0);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.java
new file mode 100644
index 0000000000..a6631f498e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.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.contribution.processor;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of an extension point for XML schemas.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultValidationSchemaExtensionPoint implements ValidationSchemaExtensionPoint {
+
+ private List<String> schemas = new ArrayList<String>();
+ private boolean loaded;
+
+ public void addSchema(String uri) {
+ schemas.add(uri);
+ }
+
+ public void removeSchema(String uri) {
+ schemas.remove(uri);
+ }
+
+ /**
+ * Load schema declarations from META-INF/services/
+ * org.apache.tuscany.sca.contribution.processor.ValidationSchema files
+ */
+ private void loadSchemas() {
+ if (loaded)
+ return;
+
+ // Get the schema declarations
+ Set<ServiceDeclaration> schemaDeclarations;
+ try {
+ schemaDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations("org.apache.tuscany.sca.contribution.processor.ValidationSchema");
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // TODO - temp fix to ensure that the schema tuscany-sca.xsd always comes first
+ String tuscanyScaXsd = null;
+
+ // Find each schema
+ for (ServiceDeclaration schemaDeclaration: schemaDeclarations) {
+ URL url = schemaDeclaration.getResource(schemaDeclaration.getClassName());
+ if (url == null) {
+ throw new IllegalArgumentException(new FileNotFoundException(schemaDeclaration.getClassName()));
+ }
+
+ if (url.toString().contains("tuscany-sca.xsd")){
+ tuscanyScaXsd = url.toString();
+ } else {
+ schemas.add(url.toString());
+ }
+ }
+
+ if (tuscanyScaXsd != null){
+ schemas.add(0, tuscanyScaXsd);
+ }
+
+ loaded = true;
+ }
+
+ public List<String> getSchemas() {
+ loadSchemas();
+ return schemas;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java
new file mode 100644
index 0000000000..7ed2d45c2f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.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.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.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+import org.apache.tuscany.sca.contribution.service.UnsupportedPackageTypeException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * Implementation of an extensible package processor.
+ *
+ * Takes a package processor extension point and delegates to the proper package
+ * processor from the extension point based on the package's content type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensiblePackageProcessor implements PackageProcessor {
+
+ private PackageProcessorExtensionPoint processors;
+ private TypeDescriber packageTypeDescriber;
+ private Monitor monitor;
+
+ public ExtensiblePackageProcessor(PackageProcessorExtensionPoint processors,
+ TypeDescriber packageTypeDescriber,
+ Monitor monitor) {
+ this.processors = processors;
+ this.packageTypeDescriber = packageTypeDescriber;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Marshals errors into the monitor
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ protected void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream)
+ throws ContributionException, IOException {
+ String packageType = this.packageTypeDescriber.getType(packageSourceURL, null);
+ if (packageType == null) {
+ error("UnsupportedPackageTypeException", packageTypeDescriber, packageSourceURL.toString());
+ throw new UnsupportedPackageTypeException("Unsupported contribution package type: " + packageSourceURL.toString());
+ }
+
+ PackageProcessor packageProcessor = this.processors.getPackageProcessor(packageType);
+ if (packageProcessor == null) {
+ error("UnsupportedPackageTypeException", packageTypeDescriber, packageType);
+ throw new UnsupportedPackageTypeException("Unsupported contribution package type: " + packageType);
+ }
+
+ 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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java
new file mode 100644
index 0000000000..ca5c36fe98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.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.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+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.builder.impl.ProblemImpl;
+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;
+import org.apache.tuscany.sca.contribution.processor.DefaultUnknownElementProcessor;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * Implementation of an extensible StAX artifact processor.
+ *
+ * Takes a StAXArtifactProcessorExtensionPoint and delegates to the proper
+ * StAXArtifactProcessor by element QName
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleStAXArtifactProcessor
+ implements StAXArtifactProcessor<Object> {
+
+ private static final Logger logger = Logger.getLogger(ExtensibleStAXArtifactProcessor.class.getName());
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessorExtensionPoint processors;
+ private Monitor monitor;
+
+ /**
+ * Constructs a new ExtensibleStAXArtifactProcessor.
+ * @param processors
+ * @param inputFactory
+ * @param outputFactory
+ */
+ public ExtensibleStAXArtifactProcessor(StAXArtifactProcessorExtensionPoint processors,
+ XMLInputFactory inputFactory,
+ XMLOutputFactory outputFactory,
+ Monitor monitor) {
+ super();
+ this.processors = processors;
+ this.inputFactory = inputFactory;
+ this.outputFactory = outputFactory;
+ if (this.outputFactory != null) {
+ this.outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
+ }
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+
+ public Object read(XMLStreamReader source) throws ContributionReadException, XMLStreamException {
+
+ // Delegate to the processor associated with the element QName
+ int event = source.getEventType();
+ if (event == XMLStreamConstants.START_DOCUMENT) {
+ source.nextTag();
+ }
+ QName name = source.getName();
+ StAXArtifactProcessor<?> processor = (StAXArtifactProcessor<?>)processors.getProcessor(name);
+ if (processor == null) {
+ DefaultUnknownElementProcessor unknownElementProcessor = new DefaultUnknownElementProcessor(monitor);
+ Location location = source.getLocation();
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("Element " + name + " cannot be processed. (" + location + ")");
+ }
+ warning("ElementCannotBeProcessed", processors, name, location);
+ //return null;
+ return unknownElementProcessor.read(source,name);
+ }
+ return processor.read(source);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ StAXArtifactProcessor processor = processors.getProcessor(model.getClass());
+ if (processor != null) {
+ processor.write(model, outputSource);
+ } else {
+ DefaultUnknownElementProcessor unknownElementProcessor = new DefaultUnknownElementProcessor(monitor);
+ unknownElementProcessor.write(model,outputSource);
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("No StAX processor is configured to handle " + model.getClass());
+ }
+ warning("NoStaxProcessor", processors, model.getClass());
+ }
+ }
+ }
+
+ @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 InputStream.
+ * @param is The artifact InputStream
+ * @param type Model type
+ * @return The model
+ * @throws ContributionReadException
+ */
+ public <M> M read(InputStream is, Class<M> 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 {
+ error("UnrecognizedElementException", reader, name);
+ UnrecognizedElementException e = new UnrecognizedElementException(name);
+ throw e;
+ }
+ } catch (ContributionReadException e) {
+ Location location = reader.getLocation();
+ e.setLine(location.getLineNumber());
+ e.setColumn(location.getColumnNumber());
+ error("ContributionReadException", reader, e);
+ 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);
+ error("ContributionReadException", inputFactory, ce);
+ throw ce;
+ }
+ }
+
+ /**
+ * Write a model to an OutputStream.
+ * @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) {
+ ContributionWriteException cw = new ContributionWriteException(e);
+ error("ContributionWriteException", outputFactory, cw);
+ throw cw;
+ }
+ }
+
+ public QName getArtifactType() {
+ return null;
+ }
+
+ public Class<Object> getModelType() {
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXAttributeProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXAttributeProcessor.java
new file mode 100644
index 0000000000..3329f0bf1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXAttributeProcessor.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.contribution.processor;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+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.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.Constants;
+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.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * Implementation of an extensible StAX attribute processor.
+ *
+ * Takes a StAXAttributeProcessorExtensionPoint and delegates to the proper
+ * StAXAttributeProcessor by attribute QName
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleStAXAttributeProcessor
+ implements StAXAttributeProcessor<Object> {
+
+ private static final Logger logger = Logger.getLogger(ExtensibleStAXAttributeProcessor.class.getName());
+
+ private static final QName UNKNOWN_ATTRIBUTE = new QName(Constants.SCA10_TUSCANY_NS, "unknown");
+
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXAttributeProcessorExtensionPoint processors;
+ private Monitor monitor;
+
+ /**
+ * Constructs a new ExtensibleStAXArtifactProcessor.
+ * @param processors
+ * @param inputFactory
+ * @param outputFactory
+ */
+ public ExtensibleStAXAttributeProcessor(StAXAttributeProcessorExtensionPoint processors,
+ XMLInputFactory inputFactory,
+ XMLOutputFactory outputFactory,
+ Monitor monitor) {
+ super();
+ this.processors = processors;
+ this.inputFactory = inputFactory;
+ this.outputFactory = outputFactory;
+ if (this.outputFactory != null) {
+ this.outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
+ }
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+
+ public Object read(QName attributeName, XMLStreamReader source) throws ContributionReadException, XMLStreamException {
+
+ // Delegate to the processor associated with the attribute QName
+ int event = source.getEventType();
+ if (event == XMLStreamConstants.START_DOCUMENT) {
+ source.nextTag();
+ }
+
+ StAXAttributeProcessor<?> processor = null;
+
+ //lookup for registered attribute processors
+ processor = (StAXAttributeProcessor<?>)processors.getProcessor(attributeName);
+ if (processor == null) {
+ Location location = source.getLocation();
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("Attribute " + attributeName + " cannot be processed. (" + location + ")");
+ }
+ warning("AttributeCannotBeProcessed", processors, attributeName, location);
+ } else {
+ return processor.read(attributeName, source);
+ }
+
+ return processor == null ? null : processor.read(attributeName, source);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
+
+ if(model == null) {
+ return;
+ }
+
+ // Delegate to the processor associated with the model type
+ StAXAttributeProcessor processor = processors.getProcessor(model.getClass());
+ if(processor == null) {
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("No StAX processor is configured to handle " + model.getClass());
+ }
+ warning("NoStaxProcessor", processors, model.getClass());
+ } else {
+ processor.write(model, outputSource);
+ return;
+ }
+ }
+
+
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ StAXAttributeProcessor processor = processors.getProcessor(model.getClass());
+ if (processor != null) {
+ processor.resolve(model, resolver);
+ }
+ }
+ }
+
+ /**
+ * Read a model from an InputStream.
+ * @param is The artifact InputStream
+ * @param type Model type
+ * @return The model
+ * @throws ContributionReadException
+ */
+ public <M> M read(InputStream is, Class<M> type) throws ContributionReadException {
+ return null;
+ }
+
+ /**
+ * Write a model to an OutputStream.
+ * @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) {
+ ContributionWriteException cw = new ContributionWriteException(e);
+ error("ContributionWriteException", outputFactory, cw);
+ throw cw;
+ }
+ }
+
+ public QName getArtifactType() {
+ return null;
+ }
+
+ public Class<Object> getModelType() {
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java
new file mode 100644
index 0000000000..2fa9469b93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.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.sca.contribution.processor;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+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;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * Implementation of an extensible URL artifact processor.
+ *
+ * Takes a URLArtifactProcessorExtensionPoint and delegates to the proper URLArtifactProcessor
+ * by either fileName or fileExtention
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleURLArtifactProcessor
+ implements URLArtifactProcessor<Object> {
+
+ private URLArtifactProcessorExtensionPoint processors;
+ private Monitor monitor;
+
+ /**
+ * Constructs a new ExtensibleURLArtifactProcessor.
+ *
+ * @param processors
+ */
+ public ExtensibleURLArtifactProcessor(URLArtifactProcessorExtensionPoint processors, Monitor monitor) {
+ this.processors = processors;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ @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 fileName = getFileName(sourceURL);
+
+ //try to retrieve a processor for the specific filename
+ processor = (URLArtifactProcessor<Object>)processors.getProcessor(fileName);
+
+ if (processor == null) {
+ //try to find my file type (extension)
+ String extension = sourceURL.getPath();
+
+ 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 <M> M read(URL contributionURL, URI artifactURI, URL artifactUrl, Class<M> 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());
+ error("UnrecognizedElementException", processors, artifactURI.toString());
+ throw e;
+ }
+ }
+
+ public String getArtifactType() {
+ return null;
+ }
+
+ public Class<Object> getModelType() {
+ return null;
+ }
+
+ /**
+ * Returns the file name from a URL.
+ * @param url
+ * @return
+ */
+ private static String getFileName(URL url){
+ String fileName = url.getPath();
+ int pos = fileName.lastIndexOf("/");
+
+ return fileName.substring(pos +1);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java
new file mode 100644
index 0000000000..f17f31edb1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.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.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;
+
+/**
+ * Interface for contribution package processors
+ *
+ * Package processors understand the format of the contribution and how to get the
+ * artifacts in the contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PackageProcessor {
+
+ /**
+ * Returns the type of package supported by this package processor.
+ *
+ * @return the package type
+ */
+ String getPackageType();
+
+ /**
+ * Returns a list of artifacts in the contribution.
+ *
+ * @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 for archives such as jar files that have specific URL schemes
+ * for the artifacts they contain.
+ *
+ * @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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java
new file mode 100644
index 0000000000..ed99239b19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java
new file mode 100644
index 0000000000..fcf9347564
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.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.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 XMLStreamReader.
+ *
+ * @param reader The XMLStreamReader
+ * @return A model representation of the input.
+ */
+ M read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException;
+
+ /**
+ * Writes a model to an XMLStreamWriter.
+ *
+ * @param model A model representing the source
+ * @param writer The XML stream writer
+ * @throws ContributionWriteException
+ * @throws XMLStreamException
+ */
+ void write(M model, XMLStreamWriter writer) 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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..9700e2bc60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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;
+
+/**
+ * An extension point for StAX artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StAXArtifactProcessorExtensionPoint extends
+ ArtifactProcessorExtensionPoint<StAXArtifactProcessor> {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessor.java
new file mode 100644
index 0000000000..e8edb743a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessor.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 attributes from a StAX XMLStreamReader.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StAXAttributeProcessor<M> extends ArtifactProcessor<M>{
+
+ /**
+ * Reads a model from an XMLStreamReader.
+ *
+ * @param reader The XMLStreamReader
+ * @return A model representation of the input.
+ */
+ M read(QName attributeName, XMLStreamReader reader) throws ContributionReadException, XMLStreamException;
+
+ /**
+ * Writes a model to an XMLStreamWriter.
+ *
+ * @param model A model representing the source
+ * @param writer The XML stream writer
+ * @throws ContributionWriteException
+ * @throws XMLStreamException
+ */
+ void write(M model, XMLStreamWriter writer) 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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessorExtensionPoint.java
new file mode 100644
index 0000000000..ebad243c1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessorExtensionPoint.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;
+
+/**
+ * An extension point for StAX artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StAXAttributeProcessorExtensionPoint extends
+ ArtifactProcessorExtensionPoint<StAXAttributeProcessor> {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java
new file mode 100644
index 0000000000..2ecddf5465
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.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.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * An artifact processor that can read models from a URL.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface URLArtifactProcessor<M> extends ArtifactProcessor<M> {
+
+ /**
+ * Reads a model from a URL.
+ *
+ * @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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..7714586951
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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;
+
+/**
+ * An extension point for URL artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface URLArtifactProcessorExtensionPoint extends
+ ArtifactProcessorExtensionPoint<URLArtifactProcessor> {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java
new file mode 100644
index 0000000000..da249a09e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.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;
+
+import javax.xml.stream.XMLInputFactory;
+
+/**
+ * Base marker class for validating XML input factories.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ValidatingXMLInputFactory extends XMLInputFactory {
+
+ /**
+ * Create a new default validating XML input factory.
+ * @return
+ */
+ public static ValidatingXMLInputFactory newInstance() {
+ return new DefaultValidatingXMLInputFactory(
+ XMLInputFactory.newInstance(),
+ new DefaultValidationSchemaExtensionPoint(),
+ null);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
new file mode 100644
index 0000000000..c136c62d33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
@@ -0,0 +1,388 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.logging.Logger;
+
+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 javax.xml.stream.util.StreamReaderDelegate;
+import javax.xml.validation.Schema;
+import javax.xml.validation.ValidatorHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.AttributesImpl;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ *
+ * A validating XMLStreamReader that reports XMLSchema validation errors.
+ *
+ * @version $Rev$ $Date$
+ */
+class ValidatingXMLStreamReader extends StreamReaderDelegate implements XMLStreamReader {
+ private static final Logger logger = Logger.getLogger(ValidatingXMLStreamReader.class.getName());
+
+ private int level;
+ private ValidatorHandler handler;
+ private final Monitor monitor;
+
+ /**
+ * Constructs a new ValidatingXMLStreamReader.
+ *
+ * @param reader
+ * @param schema
+ * @throws XMLStreamException
+ */
+ ValidatingXMLStreamReader(XMLStreamReader reader, Schema schema, Monitor monitor) throws XMLStreamException {
+ super(reader);
+ this.monitor = monitor;
+ if (schema == null) {
+ return;
+ }
+
+ handler = schema.newValidatorHandler();
+ handler.setDocumentLocator(new LocatorAdapter());
+ try {
+ handler.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ } catch (SAXException e) {
+ XMLStreamException xse = new XMLStreamException(e);
+ error("XMLStreamException", handler, xse);
+ throw xse;
+ }
+
+ // These validation errors are just warnings for us as we want to support
+ // running from an XML document with XSD validation errors, as long as we can
+ // get the metadata we need from the document
+ handler.setErrorHandler(new ErrorHandler() {
+ private String getMessage(SAXParseException e) {
+ return "XMLSchema validation problem in: " + e.getSystemId() + ", line: " + e.getLineNumber() + ", column: " + e.getColumnNumber() + "\n" + e.getMessage();
+ }
+
+ public void error(SAXParseException exception) throws SAXException {
+ if (ValidatingXMLStreamReader.this.monitor == null)
+ logger.warning(getMessage(exception));
+ else
+ ValidatingXMLStreamReader.this.error("SchemaError", ValidatingXMLStreamReader.this.getClass(), exception.getSystemId(),
+ exception.getLineNumber(), exception.getColumnNumber(), exception.getMessage());
+ }
+
+ public void fatalError(SAXParseException exception) throws SAXException {
+ if (ValidatingXMLStreamReader.this.monitor == null)
+ logger.warning(getMessage(exception));
+ else
+ ValidatingXMLStreamReader.this.error("SchemaFatalError", ValidatingXMLStreamReader.this.getClass(), exception.getSystemId(),
+ exception.getLineNumber(), exception.getColumnNumber(), exception.getMessage());
+ }
+
+ public void warning(SAXParseException exception) throws SAXException {
+ if (ValidatingXMLStreamReader.this.monitor == null)
+ logger.warning(getMessage(exception));
+ else
+ ValidatingXMLStreamReader.this.warning("SchemaWarning", ValidatingXMLStreamReader.this.getClass(), exception.getSystemId(),
+ exception.getLineNumber(), exception.getColumnNumber(), exception.getMessage());
+ }
+ });
+ }
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ @Override
+ public int next() throws XMLStreamException {
+ if (handler == null) {
+ return super.next();
+ }
+
+ int event = super.next();
+ try {
+ switch (event) {
+ case XMLStreamConstants.START_DOCUMENT:
+ level++;
+ handler.startDocument();
+ break;
+ case XMLStreamConstants.START_ELEMENT:
+ level++;
+ handleStartElement();
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ handler.processingInstruction(super.getPITarget(), super.getPIData());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ case XMLStreamConstants.CDATA:
+ case XMLStreamConstants.SPACE:
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ handler.characters(super.getTextCharacters(), super.getTextStart(), super.getTextLength());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ handleEndElement();
+ level--;
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ handler.endDocument();
+ break;
+ }
+ } catch (SAXException e) {
+ XMLStreamException xse = new XMLStreamException(e.getMessage(), e);
+ error("XMLStreamException", handler, xse);
+ throw xse;
+ }
+ return event;
+ }
+
+ @Override
+ public int nextTag() throws XMLStreamException {
+ if (handler == null) {
+ return super.nextTag();
+ }
+
+ for (;;) {
+ int event = super.getEventType();
+ try {
+ switch (event) {
+ case XMLStreamConstants.START_DOCUMENT:
+ level++;
+ handler.startDocument();
+ break;
+ case XMLStreamConstants.START_ELEMENT:
+ level++;
+ handleStartElement();
+ return event;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ handler.processingInstruction(super.getPITarget(), super.getPIData());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ case XMLStreamConstants.CDATA:
+ case XMLStreamConstants.SPACE:
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ handler.characters(super.getTextCharacters(), super.getTextStart(), super.getTextLength());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ handleEndElement();
+ level--;
+ return event;
+ case XMLStreamConstants.END_DOCUMENT:
+ handler.endDocument();
+ return event;
+ }
+ } catch (SAXException e) {
+ XMLStreamException xse = new XMLStreamException(e);
+ error("XMLStreamException", handler, xse);
+ throw xse;
+ }
+ super.next();
+ }
+ }
+
+ @Override
+ public String getElementText() throws XMLStreamException {
+ if (handler == null) {
+ return super.getElementText();
+ }
+
+ if (getEventType() != XMLStreamConstants.START_ELEMENT) {
+ return super.getElementText();
+ }
+ StringBuffer text = new StringBuffer();
+
+ for (;;) {
+ int event = next();
+ switch (event) {
+ case XMLStreamConstants.END_ELEMENT:
+ return text.toString();
+
+ case XMLStreamConstants.COMMENT:
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ continue;
+
+ case CHARACTERS:
+ case CDATA:
+ case SPACE:
+ case ENTITY_REFERENCE:
+ text.append(getText());
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ /**
+ * Handle a start element event.
+ *
+ * @throws SAXException
+ */
+ private void handleStartElement() throws SAXException {
+
+ // send startPrefixMapping events immediately before startElement event
+ int nsCount = super.getNamespaceCount();
+ for (int i = 0; i < nsCount; i++) {
+ String prefix = super.getNamespacePrefix(i);
+ if (prefix == null) { // true for default namespace
+ prefix = "";
+ }
+ handler.startPrefixMapping(prefix, super.getNamespaceURI(i));
+ }
+
+ // fire startElement
+ QName qname = super.getName();
+ String prefix = qname.getPrefix();
+ String rawname;
+ if (prefix == null || prefix.length() == 0) {
+ rawname = qname.getLocalPart();
+ } else {
+ rawname = prefix + ':' + qname.getLocalPart();
+ }
+ Attributes attrs = getAttributes();
+ handler.startElement(qname.getNamespaceURI(), qname.getLocalPart(), rawname, attrs);
+ }
+
+ /**
+ * Handle an endElement event.
+ *
+ * @throws SAXException
+ */
+ private void handleEndElement() throws SAXException {
+
+ // fire endElement
+ QName qname = super.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 = super.getNamespaceCount();
+ for (int i = nsCount - 1; i >= 0; i--) {
+ String prefix = super.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() {
+ AttributesImpl attrs = new AttributesImpl();
+
+ // add namespace declarations
+ for (int i = 0; i < super.getNamespaceCount(); i++) {
+ String prefix = super.getNamespacePrefix(i);
+ String uri = super.getNamespaceURI(i);
+ if (prefix == null) {
+ attrs.addAttribute("", "", "xmlns", "CDATA", uri);
+ } else {
+ attrs.addAttribute("", "", "xmlns:" + prefix, "CDATA", uri);
+ }
+ }
+
+ // Regular attributes
+ for (int i = 0; i < super.getAttributeCount(); i++) {
+ String uri = super.getAttributeNamespace(i);
+ if (uri == null) {
+ uri = "";
+ }
+ String localName = super.getAttributeLocalName(i);
+ String prefix = super.getAttributePrefix(i);
+ String qname;
+ if (prefix == null || prefix.length() == 0) {
+ qname = localName;
+ } else {
+ qname = prefix + ':' + localName;
+ }
+ String type = super.getAttributeType(i);
+ String value = super.getAttributeValue(i);
+
+ attrs.addAttribute(uri, localName, qname, type, value);
+ }
+
+ return attrs;
+ }
+
+ /**
+ * Adapter for mapping Locator information.
+ */
+ private final class LocatorAdapter implements Locator {
+
+ private LocatorAdapter() {
+ }
+
+ public int getColumnNumber() {
+ Location location = getLocation();
+ return location == null ? 0 : location.getColumnNumber();
+ }
+
+ public int getLineNumber() {
+ Location location = getLocation();
+ return location == null ? 0 : location.getLineNumber();
+ }
+
+ public String getPublicId() {
+ Location location = getLocation();
+ return location == null ? "" : location.getPublicId();
+ }
+
+ public String getSystemId() {
+ Location location = getLocation();
+ return location == null ? "" : location.getSystemId();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java
new file mode 100644
index 0000000000..cc3bb59a5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.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.util.List;
+
+
+/**
+ * An extension point for XML schemas used for validation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ValidationSchemaExtensionPoint {
+
+ /**
+ * Add a schema.
+ *
+ * @param uri the URI of the schema
+ */
+ void addSchema(String uri);
+
+ /**
+ * Remove a schema.
+ *
+ * @param uri the URI of the schema
+ */
+ void removeSchema(String uri);
+
+ /**
+ * Returns the list of schemas registered in the extension point.
+ * @return the list of schemas
+ */
+ List<String> getSchemas();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java
new file mode 100644
index 0000000000..f3555ee71e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.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.contribution.resolver;
+
+import java.lang.ref.WeakReference;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+/**
+ * A weak reference to a class, which should be used to register classes
+ * with an ArtifactResolver and resolve these classes later.
+ *
+ * FIXME The core contribution model should not have dependencies on classes
+ * and ClassLoaders. This should move to the Java import support module.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ClassReference implements Base {
+
+ 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;
+ }
+
+ public boolean isUnresolved() {
+ return clazz == null;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ throw new IllegalStateException();
+ }
+
+ @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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultDelegatingModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultDelegatingModelResolver.java
new file mode 100644
index 0000000000..13c622adf0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultDelegatingModelResolver.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.contribution.resolver;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+/**
+ * A model resolver implementation that delegates to a list of model resolvers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultDelegatingModelResolver implements ModelResolver {
+
+ private List<ModelResolver> resolvers;
+
+ public DefaultDelegatingModelResolver(List<ModelResolver> resolvers) {
+ this.resolvers = resolvers;
+ }
+
+ public void addModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public Object removeModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ //TODO optimize and cache results of the resolution later
+
+ // Go over all resolvers
+ for (ModelResolver resolver: resolvers) {
+
+ Object resolved = resolver.resolveModel(modelClass, unresolved);
+
+ // Return the resolved model object
+ if (resolved instanceof Base) {
+ if (!((Base)resolved).isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+
+ // Model object was not resolved
+ return unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java
new file mode 100644
index 0000000000..c6facd2b02
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.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.contribution.resolver;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+
+/**
+ * A model resolver implementation that considers Exports in a list of contributions.
+ *
+ * @version $Rev: 560435 $ $Date: 2007-07-27 18:26:55 -0700 (Fri, 27 Jul 2007) $
+ */
+public class DefaultImportAllModelResolver implements ModelResolver {
+
+ private Import import_;
+ private List<Contribution> contributions;
+
+ public DefaultImportAllModelResolver(Import import_, List<Contribution> contributions) {
+ this.import_ = import_;
+ this.contributions = contributions;
+ }
+
+ public void addModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public Object removeModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ //TODO optimize and cache results of the resolution later
+
+ // Go over all available contributions
+ for (Contribution contribution : contributions) {
+
+ // Go over all exports in the contribution
+ for (Export export : contribution.getExports()) {
+
+ // If the export matches the export, try to resolve the model object
+ if (import_.match(export)) {
+ Object resolved = export.getModelResolver().resolveModel(modelClass, unresolved);
+
+ // Return the resolved model object
+ if (resolved instanceof Base) {
+ if (!((Base)resolved).isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ }
+
+ // Model object was not resolved
+ return unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportModelResolver.java
new file mode 100644
index 0000000000..9ae57c41d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportModelResolver.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.contribution.resolver;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.contribution.Export;
+
+/**
+ * A model resolver implementation that delegates to a list of exports.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultImportModelResolver implements ModelResolver {
+
+ private List<Export> exports;
+
+ public DefaultImportModelResolver(List<Export> exports) {
+ this.exports = exports;
+ }
+
+ public void addModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public Object removeModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ //TODO optimize and cache results of the resolution later
+
+ // Go over all exports
+ for (Export export: exports) {
+
+ Object resolved = export.getModelResolver().resolveModel(modelClass, unresolved);
+
+ // Return the resolved model object
+ if (resolved instanceof Base) {
+ if (!((Base)resolved).isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+
+ // Model object was not resolved
+ return unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java
new file mode 100644
index 0000000000..bf175813f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * A default implementation of a model resolver based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelResolver implements ModelResolver {
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public DefaultModelResolver() {
+ }
+
+ 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);
+ }
+
+ // FIXME: TUSCANY-2499: temporarily give access to the models to get the jms binding
+ // use of definitions.xml working while the definitions.xml processing is being refactored
+ public Map getModels() {
+ return map;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java
new file mode 100644
index 0000000000..77570aa13d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.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.contribution.resolver;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+
+/**
+ * The default implementation of a model resolver extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelResolverExtensionPoint implements ModelResolverExtensionPoint {
+
+ private final Map<Class<?>, Class<? extends ModelResolver>> resolvers = new HashMap<Class<?>, Class<? extends ModelResolver>>();
+ private Map<String, ServiceDeclaration> loadedResolvers;
+
+ /**
+ * Constructs a new DefaultModelResolverExtensionPoint.
+ */
+ public DefaultModelResolverExtensionPoint() {
+ }
+
+ public void addResolver(Class<?> modelType, Class<? extends ModelResolver> resolver) {
+ resolvers.put(modelType, resolver);
+ }
+
+ public void removeResolver(Class<?> modelType) {
+ resolvers.remove(modelType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class<? extends ModelResolver> getResolver(Class<?> modelType) {
+ loadModelResolvers();
+
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c : classes) {
+ Class<? extends ModelResolver> resolver = resolvers.get(c);
+ if (resolver == null) {
+ ServiceDeclaration resolverClass = loadedResolvers.get(c.getName());
+ if (resolverClass != null) {
+ try {
+ return (Class<? extends ModelResolver>)resolverClass.loadClass();
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ } else {
+ return resolver;
+ }
+ }
+
+ Class<? extends ModelResolver > resolver = resolvers.get(modelType);
+ if (resolver == null) {
+ ServiceDeclaration resolverClass = loadedResolvers.get(modelType.getName());
+ if (resolverClass != null) {
+ try {
+ return (Class<? extends ModelResolver>)resolverClass.loadClass();
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ }
+ return resolver;
+ }
+
+ /**
+ * Dynamically load model resolvers declared under META-INF/services
+ */
+ private void loadModelResolvers() {
+ if (loadedResolvers != null)
+ return;
+ loadedResolvers = new HashMap<String, ServiceDeclaration>();
+
+ // Get the model resolver service declarations
+ Set<ServiceDeclaration> modelResolverDeclarations;
+ try {
+ modelResolverDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ModelResolver.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load model resolvers
+ for (ServiceDeclaration modelResolverDeclaration: modelResolverDeclarations) {
+ Map<String, String> attributes = modelResolverDeclaration.getAttributes();
+ String model = attributes.get("model");
+
+ loadedResolvers.put(model, modelResolverDeclaration);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java
new file mode 100644
index 0000000000..de54d54f94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+/**
+ * An implementation of an extensible model resolver which delegates to the
+ * proper resolver extension based on the class of the model to resolve.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleModelResolver implements ModelResolver {
+ private final ModelResolverExtensionPoint resolverExtensions;
+ private final ModelFactoryExtensionPoint modelFactories;
+ private final Contribution contribution;
+ private ModelResolver defaultResolver;
+ private final Map<Class<?>, ModelResolver> resolversByModelType = new HashMap<Class<?>, ModelResolver>();
+ private final Map<Class<?>, ModelResolver> resolversByImplementationClass = new HashMap<Class<?>, ModelResolver>();
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+ private Object lastUnresolved;
+
+ /**
+ * Constructs an extensible model resolver
+ *
+ * @param contribution
+ * @param resolverExtensions
+ * @param modelFactories
+ * @param defaultResolver
+ */
+ @Deprecated
+ public ExtensibleModelResolver(Contribution contribution,
+ ModelResolverExtensionPoint resolverExtensions,
+ ModelFactoryExtensionPoint modelFactories,
+ ModelResolver defaultResolver) {
+ this.contribution = contribution;
+ this.resolverExtensions = resolverExtensions;
+ this.modelFactories = modelFactories;
+ //FIXME Remove this default resolver, this is currently used to resolve policy declarations
+ // but they should be handled by the contribution import/export mechanism instead of this
+ // defaultResolver hack.
+ this.defaultResolver = defaultResolver;
+ }
+
+ /**
+ * Constructs an extensible model resolver
+ *
+ * @param resolverExtensions
+ * @param contribution
+ * @param modelFactories
+ */
+ public ExtensibleModelResolver(Contribution contribution,
+ ModelResolverExtensionPoint resolverExtensions,
+ ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ this.resolverExtensions = resolverExtensions;
+ this.modelFactories = modelFactories;
+ }
+
+ /**
+ * Returns the proper resolver instance based on the interfaces of the model
+ * If one is not available on the registry, instantiate on demand
+ *
+ * @param modelType
+ * @return
+ */
+ private ModelResolver getModelResolverInstance(Class<?> modelType) {
+ // Look up a model resolver instance for the model class or
+ // each implemented interface
+ Class<?>[] interfaces = modelType.getInterfaces();
+ Class<?>[] classes = new Class<?>[interfaces.length + 1];
+ classes[0] = modelType;
+ if (interfaces.length != 0) {
+ System.arraycopy(interfaces, 0, classes, 1, interfaces.length);
+ }
+ for (Class<?> c : classes) {
+
+ // Look up an existing model resolver instance
+ ModelResolver resolverInstance = resolversByModelType.get(c);
+ if (resolverInstance != null) {
+ return resolverInstance;
+ }
+
+ // We don't have an instance, lookup a model resolver class
+ // and instantiate it
+ Class<? extends ModelResolver> resolverClass = resolverExtensions.getResolver(c);
+ if (resolverClass != null) {
+
+ // Construct the model resolver instance and cache it
+ resolverInstance = resolversByImplementationClass.get(resolverClass);
+ if (resolverInstance != null) {
+ resolversByModelType.put(c, resolverInstance);
+ return resolverInstance;
+ }
+ try {
+ Constructor<? extends ModelResolver> constructor =
+ resolverClass
+ .getConstructor(new Class[] {Contribution.class, ModelFactoryExtensionPoint.class});
+ if (constructor != null) {
+
+ resolverInstance = constructor.newInstance(contribution, modelFactories);
+ resolversByImplementationClass.put(resolverClass, resolverInstance);
+ resolversByModelType.put(c, resolverInstance);
+ return resolverInstance;
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void addModel(Object resolved) {
+ ModelResolver resolver = getModelResolverInstance(resolved.getClass());
+ if (resolver != null) {
+ resolver.addModel(resolved);
+ } else {
+ map.put(resolved, resolved);
+ }
+ }
+
+ public Object removeModel(Object resolved) {
+ ModelResolver resolver = getModelResolverInstance(resolved.getClass());
+ if (resolver != null) {
+ return resolver.removeModel(resolved);
+ } else {
+ return map.remove(resolved);
+ }
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ // Protect against dependency cycles causing infinite recursion
+ // Save the current unresolved object and check later if we are trying
+ // to resolve the same object again
+ if (unresolved == lastUnresolved) {
+ return unresolved;
+ }
+ lastUnresolved = unresolved;
+
+ ModelResolver resolver = getModelResolverInstance(unresolved.getClass());
+ if (resolver != null) {
+ Object resolved = resolver.resolveModel(modelClass, unresolved);
+ if (resolved != null && resolved != unresolved) {
+ lastUnresolved = null;
+ return modelClass.cast(resolved);
+ }
+ } else {
+ //FIXME Remove this default resolver, this is currently used to resolve policy declarations
+ // but they should be handled by the contribution import/export mechanism instead of this
+ // defaultResolver hack.
+ if (defaultResolver != null) {
+ Object resolved = defaultResolver.resolveModel(modelClass, unresolved);
+ if (resolved != null && resolved != unresolved) {
+ lastUnresolved = null;
+ return modelClass.cast(resolved);
+ }
+ }
+
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+ // Return the resolved object
+ lastUnresolved = null;
+ return modelClass.cast(resolved);
+ }
+ }
+
+ return unresolved;
+ }
+
+ // FIXME: TUSCANY-2499: temporarily give access to the defaultResolver to get the jms binding
+ // use of definitions.xml working while the definitions.xml processing is being refactored
+ public ModelResolver getDefaultModelResolver() {
+ return defaultResolver;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java
new file mode 100644
index 0000000000..2831bebbc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.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.contribution.resolver;
+
+/**
+ * A model resolver, responsible for resolving models in the scope of an
+ * SCA contribution.
+ *
+ * SCA Assemblies reference 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 logical URIs. Model resolvers are used to resolve these references
+ * and get the in-memory models representing the referenced artifacts.
+ *
+ * @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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java
new file mode 100644
index 0000000000..4a25059792
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.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.resolver;
+
+
+/**
+ * An extension point for model resolvers
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModelResolverExtensionPoint {
+
+ /**
+ * Register a model resolver class using the model type as the key
+ *
+ * @param modelType The model type
+ * @param resolver The model resolver Class
+ */
+ void addResolver(Class<?> modelType, Class <? extends ModelResolver> resolver);
+
+ /**
+ * Remove the model resolver class for a specific model type
+ *
+ * @param modelType The model type
+ */
+ void removeResolver(Class<?> modelType);
+
+ /**
+ * Retrieve a model resolver class for a specific model type
+ *
+ * @param modelType The model artifact type
+ * @return The model resolver Class
+ */
+ Class <? extends ModelResolver> getResolver(Class<?> modelType);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java
new file mode 100644
index 0000000000..74f0f2d71d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.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.resolver;
+
+/**
+ * Extension to assembly model implementations to provide a model resolver.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResolverExtension {
+
+ /**
+ * 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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java
new file mode 100644
index 0000000000..2394f4510b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.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.net.URL;
+
+/**
+ * A resource URL, which should be used to register resources
+ * with an ArtifactResolver and resolve these resources later.
+ *
+ * FIXME Don't use as its deprecated, use Artifact instead.
+ *
+ * @version $Rev$ $Date$
+ */
+@Deprecated
+public class ResourceReference {
+
+ private URL resourceURL;
+ private String resourceName;
+
+ /**
+ * Constructs a new ResourceReference.
+ *
+ * @param resourceName Name of resource
+ * @param resourceURL The resource URL
+ */
+ public ResourceReference(String resourceName, URL resourceURL) {
+ this.resourceURL = resourceURL;
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * Constructs a new ResourceReference.
+ *
+ * @param resourceName Name of resource
+ */
+ public ResourceReference(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * Get the resource URL.
+ *
+ * @return The resource URL
+ */
+ public URL getResource() {
+ return resourceURL;
+ }
+
+ /**
+ * Get the resource name.
+ *
+ * @return The resource name
+ */
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ /**
+ * Returns true if the resource reference is unresolved.
+ *
+ * @return Whether or not the resource has been resolved
+ */
+ public boolean isUnresolved() {
+ return resourceURL == null;
+ }
+
+ @Override
+ public int hashCode() {
+ return resourceName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof ResourceReference) {
+ return resourceName.equals(((ResourceReference)obj).resourceName);
+ } else {
+ return false;
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java
new file mode 100644
index 0000000000..2d03381c8a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.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.contribution.scanner;
+
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Interface for contribution package scanners
+ *
+ * Contribution scanners understand the format of the contribution and how to get the
+ * artifacts in the contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionScanner {
+
+ /**
+ * Returns the type of package supported by this package scanner.
+ *
+ * @return the package type
+ */
+ String getContributionType();
+
+ /**
+ * Returns a list of artifacts in the contribution.
+ *
+ * @param contributionURL Contribution URL
+ * @return List of artifact URIs
+ * @throws ContributionException
+ * @throws IOException
+ */
+ List<String> getArtifacts(URL contributionURL) throws ContributionReadException;
+
+ /**
+ * Return the URL for an artifact in the contribution.
+ *
+ * This is needed for archives such as jar files that have specific URL schemes
+ * for the artifacts they contain.
+ *
+ * @param contributionURL Contribution URL
+ * @param artifact The relative URI for the artifact
+ * @return The artifact URL
+ */
+ URL getArtifactURL(URL contributionURL, String artifact) throws ContributionReadException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java
new file mode 100644
index 0000000000..1ca9def4ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.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.scanner;
+
+/**
+ * An extension point for contribution scanners
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionScannerExtensionPoint {
+
+ /**
+ * Add a ContributionScanner using the contribution type as the key.
+ *
+ * @param scanner The contribution scanner
+ */
+ void addContributionScanner(ContributionScanner scanner);
+
+ /**
+ * Remove a ContributionScanner.
+ *
+ * @param scanner The contribution scanner
+ */
+ void removeContributionScanner(ContributionScanner scanner);
+
+ /**
+ * Returns the ContributionScanner for the given contribution type.
+ *
+ * @param contributionType The contribution type
+ * @return The contribution scanner
+ */
+ ContributionScanner getContributionScanner(String contributionType);
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java
new file mode 100644
index 0000000000..24aae45b59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.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.contribution.scanner;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a contribution scanner extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultContributionScannerExtensionPoint implements ContributionScannerExtensionPoint {
+
+ private Map<String, ContributionScanner> scanners = new HashMap<String, ContributionScanner>();
+ private boolean loaded;
+
+ public DefaultContributionScannerExtensionPoint() {
+ }
+
+ public void addContributionScanner(ContributionScanner scanner) {
+ scanners.put(scanner.getContributionType(), scanner);
+ }
+
+ public void removeContributionScanner(ContributionScanner scanner) {
+ scanners.remove(scanner.getContributionType());
+ }
+
+ public ContributionScanner getContributionScanner(String contentType) {
+ loadScanners();
+ return scanners.get(contentType);
+ }
+
+ private void loadScanners() {
+ if (loaded)
+ return;
+
+ // Get the scanner service declarations
+ Set<ServiceDeclaration> scannerDeclarations;
+ try {
+ scannerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ContributionScanner.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration scannerDeclaration: scannerDeclarations) {
+ Map<String, String> attributes = scannerDeclaration.getAttributes();
+
+ // Load a URL artifact scanner
+ String contributionType = attributes.get("type");
+
+ // Create a scanner wrapper and register it
+ ContributionScanner scanner = new LazyContributionScanner(contributionType, scannerDeclaration);
+ addContributionScanner(scanner);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A facade for contribution scanners.
+ */
+ private static class LazyContributionScanner implements ContributionScanner {
+
+ private ServiceDeclaration scannerDeclaration;
+ private String contributionType;
+ private ContributionScanner scanner;
+
+ private LazyContributionScanner(String contributionType, ServiceDeclaration scannerDeclaration) {
+ this.scannerDeclaration = scannerDeclaration;
+ this.contributionType = contributionType;
+ }
+
+ public URL getArtifactURL(URL contributionSourceURL, String artifact) throws ContributionReadException {
+ return getScanner().getArtifactURL(contributionSourceURL, artifact);
+ }
+
+ public List<String> getArtifacts(URL contributionSourceURL) throws ContributionReadException {
+ return getScanner().getArtifacts(contributionSourceURL);
+ }
+
+ public String getContributionType() {
+ return contributionType;
+ }
+
+ private ContributionScanner getScanner() {
+ if (scanner == null) {
+ try {
+ Class<ContributionScanner> scannerClass = (Class<ContributionScanner>)scannerDeclaration.loadClass();
+ Constructor<ContributionScanner> constructor = scannerClass.getConstructor();
+ scanner = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return scanner;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java
new file mode 100644
index 0000000000..e183206894
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.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.service;
+
+/**
+ * Base class for exceptions raised by contribution services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionException extends Exception {
+
+ private static final long serialVersionUID = 4432880414927652578L;
+
+ protected ContributionException() {
+ super();
+ }
+
+ protected ContributionException(String message) {
+ super(message);
+ }
+
+ protected ContributionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java
new file mode 100644
index 0000000000..5158eaf85c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.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.service;
+
+import java.util.EventListener;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * A listener interface used to listen to contribution repository events.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionListener extends EventListener {
+
+ /**
+ * Notifies the listener that a contribution has been added.
+ *
+ * @param repository The contribution repository
+ * @param contribution The new contribution
+ */
+ void contributionAdded(ContributionRepository repository, Contribution contribution);
+
+ /**
+ * Notifies the listener that a contribution has been removed.
+ *
+ * @param repository The contribution repository
+ * @param contribution The removed contribution.
+ */
+ void contributionRemoved(ContributionRepository repository, Contribution contribution);
+
+ /**
+ * Notifies the listener that a contribution has been updated.
+ *
+ * @param repository The contribution repository
+ * @param oldContribution The old contribution
+ * @param contribution The new contribution
+ */
+ void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java
new file mode 100644
index 0000000000..ce2b4b13c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.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;
+
+import java.util.List;
+
+public interface ContributionListenerExtensionPoint {
+
+ /**
+ * Adds a contribution repository listener extension.
+ * @param listener The listener to add
+ */
+ void addContributionListener(ContributionListener listener);
+
+ /**
+ * Removes a contribution repository listener extension.
+ * @param listener The listener to remove
+ */
+ void removeContributionListener(ContributionListener listener);
+
+ /**
+ * Returns the contribution repository listeners.
+ * @return
+ */
+ List<ContributionListener> getContributionListeners();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java
new file mode 100644
index 0000000000..33399dcc2f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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$ $Date$
+ */
+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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java
new file mode 100644
index 0000000000..d7d8216f66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.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.contribution.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * 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();
+
+ /**
+ * Returns the contributions available in the repository.
+ * @return The list of contributions.
+ */
+ List<Contribution> getContributions();
+
+ /**
+ * Adds a contribution to the repository.
+ * @param contribution The new contribution.
+ */
+ void addContribution(Contribution contribution);
+
+ /**
+ * Removes a contribution from the repository.
+ * @param contribution The contribution to remove
+ */
+ void removeContribution(Contribution contribution);
+
+ /**
+ * Updates a contribution in the repository
+ * @param contribution The contribution to update
+ */
+ void updateContribution(Contribution contribution);
+
+ /**
+ * Returns the contribution with the given URI.
+ * @param uri the URI of the contribution
+ * @return The contribution
+ */
+ Contribution getContribution(String uri);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java
new file mode 100644
index 0000000000..ecb774ac0c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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$ $Date$
+ */
+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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java
new file mode 100644
index 0000000000..4bf29a3993
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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$ $Date$
+ */
+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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java
new file mode 100644
index 0000000000..dcdb8733b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.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$ $Date$
+ */
+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 storeInRepository Flag that identifies if you want to copy the
+ * contribution to the repository
+ * @return The contribution model representing the contribution
+ * @throws ContributionException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the resource
+ */
+ Contribution contribute(String contributionURI, URL sourceURL, boolean storeInRepository) throws ContributionException,
+ IOException;
+
+ /**
+ * 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 ContributionException 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 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 ContributionException 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)
+ 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 ContributionException 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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java
new file mode 100644
index 0000000000..8bfdedf180
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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$ $Date$
+ */
+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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java
new file mode 100644
index 0000000000..1ab80e344b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.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.contribution.service;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a contribution listener extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultContributionListenerExtensionPoint implements ContributionListenerExtensionPoint {
+
+ private List<ContributionListener> listeners = new CopyOnWriteArrayList<ContributionListener>();
+ private boolean loadedListeners;
+ private ModelFactoryExtensionPoint modelFactories;
+
+ /**
+ * Constructs a new DefaultContributionListenerExtensionPoint.
+ *
+ */
+ public DefaultContributionListenerExtensionPoint(ModelFactoryExtensionPoint modelFactories) {
+ this.modelFactories = modelFactories;
+ }
+
+ /**
+ * Constructs a new DefaultContributionListenerExtensionPoint.
+ *
+ */
+ public DefaultContributionListenerExtensionPoint(ExtensionPointRegistry extensionPoints) {
+ this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ }
+
+ public void addContributionListener(ContributionListener listener) {
+ listeners.add(listener);
+ }
+
+ public List<ContributionListener> getContributionListeners() {
+ loadListeners();
+ return listeners;
+ }
+
+ public void removeContributionListener(ContributionListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Dynamically load listeners declared under META-INF/services
+ */
+ @SuppressWarnings("unchecked")
+ private synchronized void loadListeners() {
+ if (loadedListeners)
+ return;
+
+ // Get the listener service declarations
+ Set<ServiceDeclaration> listenerDeclarations;
+ try {
+ listenerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ContributionListener.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load and instantiate the listeners
+ for (ServiceDeclaration listenerDeclaration: listenerDeclarations) {
+ ContributionListener listener;
+ try {
+ Class<ContributionListener> listenerClass = (Class<ContributionListener>)listenerDeclaration.loadClass();
+ try {
+ Constructor<ContributionListener> constructor = listenerClass.getConstructor(ModelFactoryExtensionPoint.class);
+ try {
+ listener = constructor.newInstance(modelFactories);
+ } catch (InvocationTargetException e) {
+ throw new IllegalArgumentException(e);
+ }
+ } catch (NoSuchMethodException e) {
+ listener = listenerClass.newInstance();
+ }
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(e);
+ }
+ addContributionListener(listener);
+ }
+
+ loadedListeners = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java
new file mode 100644
index 0000000000..fc0dc3aa99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.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.contribution.service;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+public class ExtensibleContributionListener implements ContributionListener {
+ private final ContributionListenerExtensionPoint listeners;
+
+ /**
+ * Default constructor receiving the listener extension point
+ *
+ * @param listeners
+ */
+ public ExtensibleContributionListener(ContributionListenerExtensionPoint listeners) {
+ this.listeners = listeners;
+ }
+
+ /**
+ * Process "contributionAdded" event to all registered listeners
+ */
+ public void contributionAdded(ContributionRepository repository, Contribution contribution) {
+ for (ContributionListener listener : listeners.getContributionListeners()) {
+ try {
+ listener.contributionAdded(repository, contribution);
+ } catch (Exception e) {
+ // ignore, continue to the next listener
+ }
+ }
+ }
+
+ /**
+ * Process "contributionRemoved" event to all registered listeners
+ */
+ public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
+ for (ContributionListener listener : listeners.getContributionListeners()) {
+ try {
+ listener.contributionRemoved(repository, contribution);
+ } catch (Exception e) {
+ // ignore, continue to the next listener
+ }
+
+ }
+ }
+
+ /**
+ * Process "contributionUpdated" event to all registered listeners
+ */
+ public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
+ for (ContributionListener listener : listeners.getContributionListeners()) {
+ try {
+ listener.contributionUpdated(repository, oldContribution, contribution);
+ } catch (Exception e) {
+ // ignore, continue to the next listener
+ }
+
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java
new file mode 100644
index 0000000000..74f303a5a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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$ $Date$
+ */
+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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java
new file mode 100644
index 0000000000..ff21c894de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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$ $Date$
+ */
+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);
+ 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-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java
new file mode 100644
index 0000000000..0660d69897
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.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;
+
+/**
+ * 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.
+ *
+ * FIXME Don't use as it's deprecated and replaced by UnsupportedPackageTypeException.
+ *
+ * @version $Rev$ $Date$
+ */
+@Deprecated
+public class UnsupportedContentTypeException extends ContributionException {
+ private static final long serialVersionUID = -1831797280021355672L;
+
+ /**
+ * Constructs a new UnsupportedContentTypeException.
+ *
+ * @param message
+ */
+ public UnsupportedContentTypeException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java
new file mode 100644
index 0000000000..33c847a049
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.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.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$ $Date$
+ */
+public class UnsupportedPackageTypeException extends ContributionException {
+ private static final long serialVersionUID = -1831797280021355672L;
+
+ /**
+ * Constructs a new UnsupportedPackageTypeException.
+ *
+ * @param message
+ */
+ public UnsupportedPackageTypeException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory
new file mode 100644
index 0000000000..bcc346d9f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory
@@ -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.
+
+org.apache.tuscany.sca.contribution.DefaultContributionFactory \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint
new file mode 100644
index 0000000000..6b4d2ebdeb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint
new file mode 100644
index 0000000000..9e6433ba6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.processor.DefaultContributionPostProcessorExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint
new file mode 100644
index 0000000000..7609eda0d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.processor.DefaultPackageProcessorExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint
new file mode 100644
index 0000000000..8ea5fc0a7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint
new file mode 100644
index 0000000000..607725bcfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.processor.DefaultStAXAttributeProcessorExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint
new file mode 100644
index 0000000000..9d78ca93d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint
new file mode 100644
index 0000000000..ae6e876df6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.processor.DefaultValidationSchemaExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint
new file mode 100644
index 0000000000..4bb65e55e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint
new file mode 100644
index 0000000000..727f8f6ce7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.scanner.DefaultContributionScannerExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint
new file mode 100644
index 0000000000..6e61bebf79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.contribution.service.DefaultContributionListenerExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/contribution-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/contribution-validation-messages.properties
new file mode 100644
index 0000000000..bd650fe457
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/contribution/src/main/resources/contribution-validation-messages.properties
@@ -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.
+#
+#
+SchemaError = XMLSchema validation error occured in: {0} ,line = {1}, column = {2}, Message = {3}
+SchemaFatalError = XMLSchema validation fatal error occured in: {0} ,line = {1}, column = {2}, Message = {3}
+SchemaWarning = XMLSchema validation warning occured in: {0} ,line = {1}, column = {2}, Message = {3}
+UnsupportedPackageTypeException = Unsupported contribution package type: {0}
+ElementCannotBeProcessed = Element {0} cannot be processed. ({1})
+NoStaxProcessor = No StAX processor is configured to handle {0}
+ContributionWriteException = ContributionWriteException occured due to :
+ContributionReadException = ContributionReadException occured due to :
+UnrecognizedElementException = Unrecognized Element : {0}
+IllegalArgumentException = Invalid qname: {0}
+PrivilegedActionException = PrivilegedActionException occured due to :
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/LICENSE b/sca-java-1.x/branches/sca-android/modules/core-databinding/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core-databinding/META-INF/README b/sca-java-1.x/branches/sca-android/modules/core-databinding/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/NOTICE b/sca-java-1.x/branches/sca-android/modules/core-databinding/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/core-databinding/pom.xml b/sca-java-1.x/branches/sca-android/modules/core-databinding/pom.xml
new file mode 100644
index 0000000000..cb88bcd176
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/pom.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>1.4-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 SCA Core/DataBinding Integration</name>
+
+ <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-databinding-jaxb</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</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.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-jaxws</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.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.core.databinding</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.core.databinding*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java
new file mode 100644
index 0000000000..2056789089
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.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.core.databinding.module;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor;
+import org.apache.tuscany.sca.core.databinding.transformers.Array2ArrayTransformer;
+import org.apache.tuscany.sca.core.databinding.transformers.CallableReference2XMLStreamReader;
+import org.apache.tuscany.sca.core.databinding.transformers.CallableReferenceDataBinding;
+import org.apache.tuscany.sca.core.databinding.transformers.CallableReferenceXMLAdapter;
+import org.apache.tuscany.sca.core.databinding.transformers.Exception2ExceptionTransformer;
+import org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer;
+import org.apache.tuscany.sca.core.databinding.transformers.Output2OutputTransformer;
+import org.apache.tuscany.sca.core.databinding.transformers.XMLStreamReader2CallableReference;
+import org.apache.tuscany.sca.core.databinding.wire.DataBindingRuntimeWireProcessor;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.Group2GroupTransformer;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSFaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+import org.osoa.sca.CallableReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataBindingModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+
+ XMLAdapterExtensionPoint xmlAdapterExtensionPoint = registry.getExtensionPoint(XMLAdapterExtensionPoint.class);
+ xmlAdapterExtensionPoint.addAdapter(CallableReference.class, CallableReferenceXMLAdapter.class);
+ FaultExceptionMapper faultExceptionMapper = new JAXWSFaultExceptionMapper(dataBindings, xmlAdapterExtensionPoint);
+
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ Input2InputTransformer input2InputTransformer = new Input2InputTransformer();
+ input2InputTransformer.setMediator(mediator);
+ transformers.addTransformer(input2InputTransformer, true);
+
+ Output2OutputTransformer output2OutputTransformer = new Output2OutputTransformer();
+ output2OutputTransformer.setMediator(mediator);
+ transformers.addTransformer(output2OutputTransformer, true);
+
+ Exception2ExceptionTransformer exception2ExceptionTransformer = new Exception2ExceptionTransformer(mediator, faultExceptionMapper);
+ transformers.addTransformer(exception2ExceptionTransformer, false);
+
+ Array2ArrayTransformer array2ArrayTransformer = new Array2ArrayTransformer();
+ array2ArrayTransformer.setMediator(mediator);
+ transformers.addTransformer(array2ArrayTransformer, true);
+
+ Group2GroupTransformer group2GroupTransformer = new Group2GroupTransformer();
+ group2GroupTransformer.setMediator(mediator);
+ transformers.addTransformer(group2GroupTransformer, true);
+
+ dataBindings.addDataBinding(new CallableReferenceDataBinding());
+ transformers.addTransformer(new CallableReference2XMLStreamReader(), true);
+ transformers.addTransformer(new XMLStreamReader2CallableReference(), false);
+
+ ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+
+ // [rfeng] The JAX-WS processor should come before the Databinding processor to make sure @WebService
+ // is honored as Remoteable
+ javaFactory.addInterfaceVisitor(new JAXWSJavaInterfaceProcessor(dataBindings, faultExceptionMapper, xmlAdapterExtensionPoint));
+
+ javaFactory.addInterfaceVisitor(new DataBindingJavaInterfaceProcessor(dataBindings));
+
+ RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint = registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+ if (wireProcessorExtensionPoint != null) {
+ wireProcessorExtensionPoint.addWireProcessor(new DataBindingRuntimeWireProcessor(mediator, dataBindings, faultExceptionMapper));
+ }
+
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
new file mode 100644
index 0000000000..e182b472d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
@@ -0,0 +1,210 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.databinding.processor;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
+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.JavaOperation;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+
+/**
+ * The databinding annotation processor for java interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataBindingJavaInterfaceProcessor implements JavaInterfaceVisitor {
+ private static final String JAXB_DATABINDING = "javax.xml.bind.JAXBElement";
+ private DataBindingExtensionPoint dataBindingRegistry;
+
+ public DataBindingJavaInterfaceProcessor(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 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.wrapped();
+ }
+
+ Map<String, Operation> opMap = new HashMap<String, Operation>();
+ for (Operation op : javaInterface.getOperations()) {
+ opMap.put(op.getName(), op);
+ // In the case of @WebMethod, the method name can be different from the operation name
+ if (op instanceof JavaOperation) {
+ opMap.put(((JavaOperation)op).getJavaMethod().getName(), op);
+ }
+ if (dataBindingId != null) {
+ op.setDataBinding(dataBindingId);
+ op.setWrapperStyle(wrapperStyle);
+ }
+ }
+ for (Method method : clazz.getMethods()) {
+ if (method.getDeclaringClass() == Object.class) {
+ continue;
+ }
+ Operation operation = opMap.get(method.getName());
+ if (operation == null) { // @WebMethod exclude=true
+ continue;
+ }
+ DataBinding methodDataBinding = clazz.getAnnotation(DataBinding.class);
+ if (methodDataBinding == null) {
+ methodDataBinding = dataBinding;
+ }
+ dataBindingId = null;
+ wrapperStyle = false;
+ if (dataBinding != null) {
+ dataBindingId = dataBinding.value();
+ wrapperStyle = dataBinding.wrapped();
+ operation.setDataBinding(dataBindingId);
+ operation.setWrapperStyle(wrapperStyle);
+ }
+
+ // FIXME: We need a better way to identify simple java types
+ int i = 0;
+ for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getInputType().getLogical()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBindingId);
+ }
+ for (Annotation a : method.getParameterAnnotations()[i]) {
+ if (a.annotationType() == org.apache.tuscany.sca.databinding.annotation.DataType.class) {
+ String value = ((org.apache.tuscany.sca.databinding.annotation.DataType)a).value();
+ d.setDataBinding(value);
+ }
+ }
+ dataBindingRegistry.introspectType(d, operation);
+ i++;
+ }
+ if (operation.getOutputType() != null) {
+ DataType<?> d = operation.getOutputType();
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBindingId);
+ }
+ org.apache.tuscany.sca.databinding.annotation.DataType dt =
+ method.getAnnotation(org.apache.tuscany.sca.databinding.annotation.DataType.class);
+ if (dt != null) {
+ d.setDataBinding(dt.value());
+ }
+ dataBindingRegistry.introspectType(d, operation);
+ }
+ for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getFaultTypes()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBindingId);
+ }
+ // TODO: Handle exceptions
+ dataBindingRegistry.introspectType(d, operation);
+ }
+
+ // JIRA: TUSCANY-842
+ String db = operation.getDataBinding();
+ if (db == null || JAXB_DATABINDING.equals(db)) {
+ assignOperationDataBinding(operation);
+ db = operation.getDataBinding();
+ }
+
+ // Introspect the wrapper data type
+ if (operation.getWrapper() != null) {
+ org.apache.tuscany.sca.databinding.DataBinding dbObj =
+ dataBindingRegistry.getDataBinding(db);
+ WrapperHandler handler = dbObj == null ? null : dbObj.getWrapperHandler();
+ if (handler != null) {
+ WrapperInfo wrapper = operation.getWrapper();
+ wrapper.setInputWrapperType(handler.getWrapperType(operation, true));
+ wrapper.setOutputWrapperType(handler.getWrapperType(operation, false));
+ }
+ if (dbObj != null && handler == null) {
+ // To avoid JAXB wrapper bean generation
+ WrapperInfo wrapper = operation.getWrapper();
+ wrapper.setInputWrapperType(null);
+ wrapper.setOutputWrapperType(null);
+ }
+ }
+ }
+ }
+
+ /*
+ * Assigns an operation DB if one of the input types, output type, fault types has a non-default DB.
+ * However, if two of the input types, output type, fault types have two different non-default DBs
+ * ( e.g. SDO and JAXB), then we do nothing to the operation DB.
+ *
+ * The method logic assumes the JavaBeans DataBinding is the default
+ */
+ private void assignOperationDataBinding(Operation operation) {
+
+ Set<String> dbs = new HashSet<String>();
+
+ // Can't use DataType<?> since operation.getInputType() returns: DataType<List<DataType>>
+ List<DataType> opDataTypes = new LinkedList<DataType>();
+
+ opDataTypes.addAll(operation.getInputType().getLogical());
+ opDataTypes.add(operation.getOutputType());
+ for (DataType<DataType> ft : operation.getFaultTypes()) {
+ opDataTypes.add(ft.getLogical());
+ }
+
+ for (DataType<?> d : opDataTypes) {
+ if (d != null) {
+ String dataBinding = d.getDataBinding();
+ if ("java:array".equals(dataBinding)) {
+ dataBinding = ((DataType)d.getLogical()).getDataBinding();
+ }
+ if (dataBinding != null) {
+ dbs.add(dataBinding);
+ }
+ }
+ }
+
+ dbs.remove(JavaBeansDataBinding.NAME);
+ dbs.remove(SimpleJavaDataBinding.NAME);
+
+ if (dbs.size() == 1) {
+ operation.setDataBinding(dbs.iterator().next());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java
new file mode 100644
index 0000000000..38ca2cd10c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.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.core.databinding.transformers;
+
+import java.lang.reflect.Array;
+
+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.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This is a special transformer to transform the output from one IDL to the
+ * other one
+ *
+ * @version $Rev$ $Date$
+ */
+public class Array2ArrayTransformer extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
+
+ protected Mediator mediator;
+
+ public Array2ArrayTransformer() {
+ super();
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ @Reference
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return "java:array";
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return "java:array";
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class<Object> getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class<Object> getTargetType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object transform(Object array, TransformationContext context) {
+ try {
+ if (array == null) {
+ return null;
+ }
+ DataType<DataType> sourceType = context.getSourceDataType();
+ DataType<DataType> targetType = context.getTargetDataType();
+ int length = Array.getLength(array);
+ Object targetArray = Array.newInstance(targetType.getPhysical().getComponentType(), length);
+ for (int i = 0; i < length; i++) {
+ Object sourceItem = Array.get(array, i);
+ Object targetItem =
+ mediator.mediate(sourceItem, sourceType.getLogical(), targetType.getLogical(), context
+ .getMetadata());
+ Array.set(targetArray, i, targetItem);
+ }
+ return targetArray;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java
new file mode 100644
index 0000000000..124928db24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.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.core.databinding.transformers;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+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.StAXHelper;
+import org.osoa.sca.CallableReference;
+
+public class CallableReference2XMLStreamReader extends BaseTransformer<CallableReference, XMLStreamReader> implements
+ PullTransformer<CallableReference, XMLStreamReader> {
+
+ @Override
+ protected Class<CallableReference> getSourceType() {
+ return CallableReference.class;
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public XMLStreamReader transform(CallableReference source, TransformationContext context) {
+ try {
+ if (source != null) {
+ if (source instanceof CallableReferenceImpl) {
+ XMLStreamReader xmlReader = ((CallableReferenceImpl)source).getXMLReader();
+ if (xmlReader != null) {
+ return xmlReader;
+ } else {
+ String xmlString = ((CallableReferenceImpl)source).toXMLString();
+
+ // remove "<?xml...?>" processing instruction and wrap with a top-level element
+ return StAXHelper.createXMLStreamReader("<reference xmlns=\"http://callable\">"
+ + xmlString.substring(xmlString.indexOf("?>") + 2)
+ + "</reference>");
+ }
+ } else {
+ throw new TransformationException("Unrecognized transformation source object");
+ }
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java
new file mode 100644
index 0000000000..012950e215
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.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.databinding.transformers;
+
+import org.apache.tuscany.sca.databinding.XMLTypeHelper;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.osoa.sca.CallableReference;
+
+public class CallableReferenceDataBinding extends BaseDataBinding {
+
+ public static final String NAME = CallableReference.class.getName();
+ public static final String[] ALIASES = new String[] {"callablereference"};
+
+ private CallableReferenceTypeHelper xmlTypeHelper;
+
+ public CallableReferenceDataBinding() {
+ super(NAME, ALIASES, CallableReference.class);
+ this.xmlTypeHelper = new CallableReferenceTypeHelper();
+ }
+
+ @Override
+ public XMLTypeHelper getXMLTypeHelper() {
+ return xmlTypeHelper;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java
new file mode 100644
index 0000000000..97629ea7b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.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.core.databinding.transformers;
+
+import java.beans.Introspector;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.databinding.XMLTypeHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.xsd.XSDFactory;
+import org.apache.tuscany.sca.xsd.XSDefinition;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallableReferenceTypeHelper implements XMLTypeHelper {
+ private static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
+ private static final String ANYTYPE_NAME = "anyType";
+ private static final QName ANYTYPE_QNAME = new QName(SCHEMA_NS, ANYTYPE_NAME);
+
+ public CallableReferenceTypeHelper() {
+ super();
+ }
+
+ public TypeInfo getTypeInfo(Class javaType, Object logical) {
+ QName xmlType = JavaXMLMapper.getXMLType(javaType);
+ if (xmlType != null) {
+ return new TypeInfo(xmlType, true, null);
+ } else if (javaType.isInterface()) {
+ return new TypeInfo(ANYTYPE_QNAME, true, null);
+ } else {
+ if (logical instanceof XMLType) {
+ xmlType = ((XMLType)logical).getTypeName();
+ }
+ if (xmlType == null) {
+ xmlType = new QName(Introspector.decapitalize(javaType.getSimpleName()));
+ }
+ return new TypeInfo(xmlType, false, null);
+ }
+ }
+
+ public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, Interface intf) {
+ return new ArrayList<XSDefinition>();
+ }
+
+ public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, List<DataType> dataTypes) {
+ return new ArrayList<XSDefinition>();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java
new file mode 100644
index 0000000000..ff6e444dcd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.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.databinding.transformers;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;
+import org.osoa.sca.CallableReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CallableReferenceXMLAdapter extends XmlAdapter<Source, CallableReference> {
+ private TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ private XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ @Override
+ public CallableReference unmarshal(Source v) throws Exception {
+ StringWriter sw = new StringWriter();
+ StreamResult result = new StreamResult(sw);
+ transformerFactory.newTransformer().transform(v, result);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(sw.toString()));
+ XMLStreamReader2CallableReference t2 = new XMLStreamReader2CallableReference();
+ return t2.transform(reader, null);
+ }
+
+ @Override
+ public Source marshal(CallableReference v) throws Exception {
+ CallableReference2XMLStreamReader t = new CallableReference2XMLStreamReader();
+ XMLStreamReader reader = t.transform(v, null);
+ XMLStreamReader2String t2 = new XMLStreamReader2String();
+ String xml = t2.transform(reader, null);
+ return new StreamSource(new StringReader(xml));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java
new file mode 100644
index 0000000000..6e2e714bdb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.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.core.databinding.transformers;
+
+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.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+
+/**
+ * This is a special transformer to transform the exception from one IDL to the
+ * other one
+ *
+ * @version $Rev$ $Date$
+ */
+public class Exception2ExceptionTransformer extends BaseTransformer<Throwable, Throwable> implements
+ PullTransformer<Throwable, Throwable> {
+
+ protected Mediator mediator;
+ protected FaultExceptionMapper faultExceptionMapper;
+
+ public Exception2ExceptionTransformer(Mediator mediator, FaultExceptionMapper faultExceptionMapper) {
+ super();
+ this.mediator = mediator;
+ this.faultExceptionMapper = faultExceptionMapper;
+ }
+
+ 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
+ */
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class<Throwable> getSourceType() {
+ return Throwable.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class<Throwable> getTargetType() {
+ return Throwable.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Throwable transform(Throwable source, TransformationContext context) {
+ DataType<DataType> sourceType = context.getSourceDataType();
+
+ DataType<DataType> targetType = context.getTargetDataType();
+
+ Object sourceFaultInfo = faultExceptionMapper.getFaultInfo(source, sourceType.getLogical().getPhysical(), context.getSourceOperation());
+ Object targetFaultInfo =
+ mediator.mediate(sourceFaultInfo, sourceType.getLogical(), targetType.getLogical(), context.getMetadata());
+
+ Throwable targetException =
+ faultExceptionMapper.wrapFaultInfo(targetType, source.getMessage(), targetFaultInfo, source.getCause(), context.getTargetOperation());
+
+ // FIXME
+ return targetException == null ? source : targetException;
+
+ }
+
+ public void setFaultExceptionMapper(FaultExceptionMapper faultExceptionMapper) {
+ this.faultExceptionMapper = faultExceptionMapper;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
new file mode 100644
index 0000000000..fb5f939edb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.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.core.databinding.transformers;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+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.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.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This is a special transformer to transform the input from one IDL to the
+ * other one
+ *
+ * @version $Rev$ $Date$
+ */
+public class Input2InputTransformer extends BaseTransformer<Object[], Object[]> implements
+ PullTransformer<Object[], Object[]> {
+ private static final Logger logger = Logger.getLogger(Input2InputTransformer.class.getName());
+
+ 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<Object[]> getSourceType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class<Object[]> getTargetType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+
+ /**
+ * Match the structure of the wrapper element. If it matches, then we can do
+ * wrapper to wrapper transformation. Otherwise, we do child to child.
+ * @param w1
+ * @param w2
+ * @return
+ */
+ private boolean matches(WrapperInfo w1, WrapperInfo w2) {
+ if (w1 == null || w2 == null) {
+ return false;
+ }
+ if (!w1.getInputWrapperElement().equals(w2.getInputWrapperElement())) {
+ return false;
+ }
+
+ // Compare the child elements
+ List<ElementInfo> list1 = w1.getInputChildElements();
+ List<ElementInfo> list2 = w2.getInputChildElements();
+ if (list1.size() != list2.size()) {
+ return false;
+ }
+ // FXIME: [rfeng] At this point, the J2W generates local elments under the namespace
+ // of the interface instead of "". We only compare the local parts only to work around
+ // the namespace mismatch
+ for (int i = 0; i < list1.size(); i++) {
+ String n1 = list1.get(i).getQName().getLocalPart();
+ String n2 = list2.get(i).getQName().getLocalPart();
+ if (!n1.equals(n2)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] transform(Object[] source, TransformationContext context) {
+ // Check if the source operation is wrapped
+ DataType<List<DataType>> sourceType = context.getSourceDataType();
+ Operation sourceOp = context.getSourceOperation();
+ boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle() && sourceOp.getWrapper() != null;
+ boolean sourceBare = sourceOp != null && !sourceOp.isWrapperStyle() && sourceOp.getWrapper() == null;
+
+ // Find the wrapper handler for source data
+ WrapperHandler sourceWrapperHandler = null;
+ String sourceDataBinding = getDataBinding(sourceOp);
+ sourceWrapperHandler = getWrapperHandler(sourceDataBinding, sourceWrapped);
+
+ // Check if the target operation is wrapped
+ DataType<List<DataType>> targetType = context.getTargetDataType();
+ Operation targetOp = (Operation)context.getTargetOperation();
+ boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle() && targetOp.getWrapper() != null;
+ boolean targetBare = targetOp != null && !targetOp.isWrapperStyle() && targetOp.getWrapper() == null;
+
+ // Find the wrapper handler for target data
+ WrapperHandler targetWrapperHandler = null;
+ String targetDataBinding = getDataBinding(targetOp);
+ targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped);
+
+ if ((!sourceWrapped && !sourceBare) && targetWrapped) {
+ // Unwrapped --> Wrapped
+ WrapperInfo wrapper = targetOp.getWrapper();
+ // ElementInfo wrapperElement = wrapper.getInputWrapperElement();
+
+ // Class<?> targetWrapperClass = wrapper != null ? wrapper.getInputWrapperClass() : null;
+
+ if (source == null) {
+ // Empty child elements
+ Object targetWrapper = targetWrapperHandler.create(targetOp, true);
+ return new Object[] {targetWrapper};
+ }
+
+ // If the source can be wrapped, wrapped it first
+ if (sourceWrapperHandler != null) {
+ WrapperInfo sourceWrapperInfo = sourceOp.getWrapper();
+ DataType sourceWrapperType = sourceWrapperInfo != null ? sourceWrapperInfo.getInputWrapperType() : null;
+
+ // We only do wrapper to wrapper transformation if the source has a wrapper and both sides
+ // match by XML structure
+ if (sourceWrapperType != null && matches(sourceOp.getWrapper(), targetOp.getWrapper())) {
+ Class<?> sourceWrapperClass = sourceWrapperType.getPhysical();
+
+ // Create the source wrapper
+ Object sourceWrapper = sourceWrapperHandler.create(sourceOp, true);
+
+ // Populate the source wrapper
+ if (sourceWrapper != null) {
+ sourceWrapperHandler.setChildren(sourceWrapper,
+ source,
+ sourceOp,
+ true);
+
+ // Transform the data from source wrapper to target wrapper
+ Object targetWrapper =
+ mediator.mediate(sourceWrapper, sourceWrapperType, targetType.getLogical().get(0), context
+ .getMetadata());
+ return new Object[] {targetWrapper};
+ }
+ }
+ }
+ // Fall back to child by child transformation
+ Object targetWrapper = targetWrapperHandler.create(targetOp, true);
+ List<DataType> argTypes = wrapper.getUnwrappedInputType().getLogical();
+ Object[] targetChildren = new Object[source.length];
+ for (int i = 0; i < source.length; i++) {
+ // ElementInfo argElement = wrapper.getInputChildElements().get(i);
+ DataType<XMLType> argType = argTypes.get(i);
+ targetChildren[i] =
+ mediator.mediate(source[i], sourceType.getLogical().get(i), argType, context.getMetadata());
+ }
+ targetWrapperHandler.setChildren(targetWrapper,
+ targetChildren,
+ targetOp,
+ true);
+ return new Object[] {targetWrapper};
+
+ } else if (sourceWrapped && (!targetWrapped && !targetBare)) {
+ // Wrapped to Unwrapped
+ Object sourceWrapper = source[0];
+ Object[] target = null;
+
+ // List<ElementInfo> childElements = sourceOp.getWrapper().getInputChildElements();
+ if (targetWrapperHandler != null) {
+ // ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
+ // FIXME: This is a workaround for the wsdless support as it passes in child elements
+ // under the wrapper that only matches by position
+ if (sourceWrapperHandler.isInstance(sourceWrapper, sourceOp, true)) {
+
+ WrapperInfo targetWrapperInfo = targetOp.getWrapper();
+ DataType targetWrapperType =
+ targetWrapperInfo != null ? targetWrapperInfo.getInputWrapperType() : null;
+ if (targetWrapperType != null && matches(sourceOp.getWrapper(), targetOp.getWrapper())) {
+ Object targetWrapper =
+ mediator.mediate(sourceWrapper, sourceType.getLogical().get(0), targetWrapperType, context
+ .getMetadata());
+ target = targetWrapperHandler.getChildren(targetWrapper, targetOp, true).toArray();
+ return target;
+ }
+ }
+ }
+ Object[] sourceChildren = sourceWrapperHandler.getChildren(sourceWrapper, sourceOp, true).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) {
+ WrapperInfo wrapper = operation.getWrapper();
+ if (wrapper != null) {
+ return wrapper.getDataBinding();
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
new file mode 100644
index 0000000000..8d586905c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.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.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.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This is a special transformer to transform the output from one IDL to the
+ * other one
+ *
+ * @version $Rev$ $Date$
+ */
+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<Object> getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class<Object> getTargetType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+ private String getDataBinding(Operation operation) {
+ WrapperInfo wrapper = operation.getWrapper();
+ if (wrapper != null) {
+ return wrapper.getDataBinding();
+ } else {
+ return null;
+ }
+ }
+
+ 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;
+ }
+
+ /**
+ * Match the structure of the wrapper element. If it matches, then we can do
+ * wrapper to wrapper transformation. Otherwise, we do child to child.
+ * @param w1
+ * @param w2
+ * @return
+ */
+ private boolean matches(WrapperInfo w1, WrapperInfo w2) {
+ if (w1 == null || w2 == null) {
+ return false;
+ }
+ if (!w1.getOutputWrapperElement().equals(w2.getOutputWrapperElement())) {
+ return false;
+ }
+
+ // Compare the child elements
+ List<ElementInfo> list1 = w1.getOutputChildElements();
+ List<ElementInfo> list2 = w2.getOutputChildElements();
+ if (list1.size() != list2.size()) {
+ return false;
+ }
+ // FXIME: [rfeng] At this point, the J2W generates local elments under the namespace
+ // of the interface instead of "". We only compare the local parts only to work around
+ // the namespace mismatch
+ for (int i = 0; i < list1.size(); i++) {
+ String n1 = list1.get(i).getQName().getLocalPart();
+ String n2 = list2.get(i).getQName().getLocalPart();
+ if (!n1.equals(n2)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @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() && sourceOp.getWrapper() != null;
+ boolean sourceBare = sourceOp != null && !sourceOp.isWrapperStyle() && sourceOp.getWrapper() == null;
+
+ WrapperHandler sourceWrapperHandler = null;
+ String sourceDataBinding = getDataBinding(sourceOp);
+ sourceWrapperHandler = getWrapperHandler(sourceDataBinding, sourceWrapped);
+
+ DataType<DataType> targetType = context.getTargetDataType();
+ Operation targetOp = (Operation)context.getTargetOperation();
+ boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle() && targetOp.getWrapper() != null;
+ boolean targetBare = targetOp != null && !targetOp.isWrapperStyle() && targetOp.getWrapper() == null;
+
+ WrapperHandler targetWrapperHandler = null;
+ String targetDataBinding = getDataBinding(targetOp);
+ targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped);
+
+ if ((!sourceWrapped &&!sourceBare) && targetWrapped) {
+ // Unwrapped --> Wrapped
+ WrapperInfo wrapper = targetOp.getWrapper();
+ ElementInfo wrapperElement = wrapper.getOutputWrapperElement();
+ List<ElementInfo> childElements = wrapper.getOutputChildElements();
+ Class<?> targetWrapperClass = wrapper != null ? wrapper.getOutputWrapperClass() : null;
+
+ // If the source can be wrapped, wrapped it first
+ if (sourceWrapperHandler != null) {
+ WrapperInfo sourceWrapperInfo = sourceOp.getWrapper();
+ DataType sourceWrapperType =
+ sourceWrapperInfo != null ? sourceWrapperInfo.getOutputWrapperType() : null;
+
+ if (sourceWrapperType != null && matches(sourceOp.getWrapper(), targetOp.getWrapper())) {
+ Class<?> sourceWrapperClass = sourceWrapperType.getPhysical();
+
+ Object sourceWrapper = sourceWrapperHandler.create(sourceOp, false);
+ if (sourceWrapper != null) {
+ if (!childElements.isEmpty()) {
+ // Set the return value
+ sourceWrapperHandler.setChildren(sourceWrapper,
+ new Object[] {response},
+ sourceOp,
+ false);
+ }
+ Object targetWrapper =
+ mediator.mediate(sourceWrapper, sourceWrapperType, targetType.getLogical(), context
+ .getMetadata());
+ return targetWrapper;
+ }
+ }
+ }
+ Object targetWrapper = targetWrapperHandler.create(targetOp, false);
+
+ if (childElements.isEmpty()) {
+ // void output
+ return targetWrapper;
+ }
+
+ DataType<XMLType> argType = wrapper.getUnwrappedOutputType();
+ Object child = response;
+ child = mediator.mediate(response, sourceType.getLogical(), argType, context.getMetadata());
+ targetWrapperHandler.setChildren(targetWrapper, new Object[] {child}, targetOp, false);
+ return targetWrapper;
+ } else if (sourceWrapped && (!targetWrapped && !targetBare)) {
+ // Wrapped to Unwrapped
+ Object sourceWrapper = response;
+ List<ElementInfo> childElements = sourceOp.getWrapper().getOutputChildElements();
+ if (childElements.isEmpty()) {
+ // The void output
+ return null;
+ }
+ if (targetWrapperHandler != null) {
+ ElementInfo wrapperElement = sourceOp.getWrapper().getOutputWrapperElement();
+
+ // FIXME: This is a workaround for the wsdless support as it passes in child elements
+ // under the wrapper that only matches by position
+ if (sourceWrapperHandler.isInstance(sourceWrapper, sourceOp, false)) {
+
+ WrapperInfo targetWrapperInfo = targetOp.getWrapper();
+ DataType targetWrapperType =
+ targetWrapperInfo != null ? targetWrapperInfo.getOutputWrapperType() : null;
+
+ if (targetWrapperType != null && matches(sourceOp.getWrapper(), targetOp.getWrapper())) {
+ Object targetWrapper =
+ mediator.mediate(sourceWrapper, sourceType.getLogical(), targetWrapperType, context
+ .getMetadata());
+ return targetWrapperHandler.getChildren(targetWrapper, targetOp, false).get(0);
+ }
+ }
+ }
+ Object child = sourceWrapperHandler.getChildren(sourceWrapper, sourceOp, false).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-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java
new file mode 100644
index 0000000000..841efa9398
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.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.core.databinding.transformers;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.lang.reflect.Constructor;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+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.osoa.sca.CallableReference;
+
+@SuppressWarnings("unchecked")
+public class XMLStreamReader2CallableReference extends BaseTransformer<XMLStreamReader, CallableReference>
+ implements PullTransformer<XMLStreamReader, CallableReference> {
+
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ private static final String COMPOSITE = "composite";
+ public static final QName COMPOSITE_QNAME = new QName(SCA10_NS, COMPOSITE);
+
+ public CallableReference transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ if (source != null) {
+ skipTopLevelElement(source);
+ Class refType = context.getTargetDataType().getPhysical();
+ Class implType;
+ if (refType.isAssignableFrom(CallableReferenceImpl.class)) {
+ implType = CallableReferenceImpl.class;
+ } else if (refType.isAssignableFrom(ServiceReferenceImpl.class)) {
+ implType = ServiceReferenceImpl.class;
+ } else {
+ throw new TransformationException("Unrecognized transformation target type");
+ }
+ Constructor constructor = implType.getConstructor(new Class[] {XMLStreamReader.class});
+ return (CallableReference)constructor.newInstance(new Object[] {source});
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ /*
+ * Step over top-level element added by CallableReference2XMLStreamReader
+ */
+ private void skipTopLevelElement(XMLStreamReader source) throws XMLStreamException {
+ while (source.hasNext()) {
+ int event = source.getEventType();
+ if (event == START_ELEMENT) {
+ QName name = source.getName();
+ if (COMPOSITE_QNAME.equals(name)) {
+ return;
+ }
+ }
+ source.next();
+ }
+ throw new TransformationException("<composite> element not found");
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ protected Class<CallableReference> getTargetType() {
+ return CallableReference.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
new file mode 100644
index 0000000000..b41c7fb012
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.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.databinding.wire;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+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.Phase;
+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;
+ private DataBindingExtensionPoint dataBindings;
+ private FaultExceptionMapper faultExceptionMapper;
+
+ public DataBindingRuntimeWireProcessor(Mediator mediator,
+ DataBindingExtensionPoint dataBindings,
+ FaultExceptionMapper faultExceptionMapper) {
+ super();
+ this.mediator = mediator;
+ this.dataBindings = dataBindings;
+ this.faultExceptionMapper = faultExceptionMapper;
+ }
+
+ public boolean isTransformationRequired(DataType source, DataType target) {
+ if (source == null || target == null) { // void return type
+ return false;
+ }
+ if (source == target) {
+ return false;
+ }
+
+ // Output type can be null
+ if (source == null && target == null) {
+ return false;
+ } else if (source == null || target == null) {
+ return true;
+ }
+ String sourceDataBinding = source.getDataBinding();
+ String targetDataBinding = target.getDataBinding();
+ if (sourceDataBinding == targetDataBinding) {
+ return false;
+ }
+ if (sourceDataBinding == null || targetDataBinding == null) {
+ // TODO: If any of the databinding is null, then no transformation
+ return false;
+ }
+ return !sourceDataBinding.equals(targetDataBinding);
+ }
+
+ public boolean isTransformationRequired(Operation source, Operation target) {
+ if (source == target) {
+ return false;
+ }
+
+ if (source.isWrapperStyle() != target.isWrapperStyle()) {
+ return true;
+ }
+
+ // 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();
+ if (size != targetInputType.size()) {
+ // TUSCANY-1682: The wrapper style may have different arguments
+ return true;
+ }
+ 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.getInterface().isRemotable()) {
+ return;
+ }
+ List<InvocationChain> chains = wire.getInvocationChains();
+ for (InvocationChain chain : chains) {
+ Operation sourceOperation = chain.getSourceOperation();
+ Operation targetOperation = chain.getTargetOperation();
+
+ Interceptor interceptor = null;
+ if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
+ // Add the interceptor to the source side because multiple
+ // references can be wired to the same service
+ interceptor =
+ new DataTransformationInterceptor(wire, sourceOperation, targetOperation, mediator,
+ faultExceptionMapper);
+ } else {
+ // assume pass-by-values copies are required if interfaces are remotable and there is no data binding
+ // transformation, i.e. a transformation will result in a copy so another pass-by-value copy is unnecessary
+ if (!isOnMessage(targetOperation) && isRemotable(chain, sourceOperation, targetOperation)) {
+ interceptor =
+ new PassByValueInterceptor(dataBindings, faultExceptionMapper, chain, targetOperation);
+ }
+ }
+ if (interceptor != null) {
+ String phase =
+ (wire.getSource().getContract() instanceof ComponentReference) ? Phase.REFERENCE_INTERFACE
+ : Phase.SERVICE_INTERFACE;
+ chain.addInterceptor(phase, interceptor);
+ }
+ }
+
+ }
+
+ /**
+ * FIXME: TUSCANY-2586, temporary work around till the JIRA is fixed to prevent
+ * the PassByValueInterceptor being used for services when the binding protocol
+ * doesn't need the copies done.
+ */
+ protected boolean isOnMessage(Operation op) {
+ return "onMessage".equals(op.getName());
+ }
+
+ /**
+ * Pass-by-value copies are required if the interfaces are remotable unless the
+ * implementation uses the @AllowsPassByReference annotation.
+ */
+ protected boolean isRemotable(InvocationChain chain, Operation sourceOperation, Operation targetOperation) {
+ if (!sourceOperation.getInterface().isRemotable()) {
+ return false;
+ }
+ if (!targetOperation.getInterface().isRemotable()) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java
new file mode 100644
index 0000000000..5814f3d215
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.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.core.databinding.wire;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+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.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+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;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * An interceptor to transform data across databindings on the wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataTransformationInterceptor implements Interceptor, DataExchangeSemantics {
+ private Invoker next;
+
+ private Operation sourceOperation;
+
+ private Operation targetOperation;
+ private RuntimeWire wire;
+ private Mediator mediator;
+ private FaultExceptionMapper faultExceptionMapper;
+
+ public DataTransformationInterceptor(RuntimeWire wire,
+ Operation sourceOperation,
+ Operation targetOperation,
+ Mediator mediator,
+ FaultExceptionMapper faultExceptionMapper) {
+ super();
+ this.sourceOperation = sourceOperation;
+ this.targetOperation = targetOperation;
+ this.mediator = mediator;
+ this.wire = wire;
+ this.faultExceptionMapper = faultExceptionMapper;
+ }
+
+ 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) {
+ DataType faultType = (DataType)exType.getLogical();
+ if (((FaultException)result).isMatchingType(faultType.getLogical())) {
+ targetDataType = exType;
+ break;
+ }
+ } else {
+ targetDataType = exType;
+ break;
+ }
+ }
+ }
+
+ /*
+ if (targetDataType == null) {
+ // Not a business exception
+ return resultMsg;
+ }
+ */
+
+ DataType targetFaultType = getFaultType(targetDataType);
+ if (targetFaultType == null) {
+ // No matching fault type, it's a system exception
+ Throwable cause = (Throwable) result;
+ throw new ServiceRuntimeException(cause);
+ }
+
+ // 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 && typesMatch(targetFaultType.getLogical(), faultType.getLogical())) {
+ sourceDataType = exType;
+ sourceFaultType = faultType;
+ break;
+ }
+ }
+
+ if (sourceFaultType == null) {
+ // No matching fault type, it's a system exception
+ Throwable cause = (Throwable) result;
+ throw new ServiceRuntimeException(cause);
+ }
+
+ 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);
+ metadata.put("wire", wire);
+ return mediator.mediate(source, sourceType, targetType, metadata);
+ }
+
+ private DataType getFaultType(DataType exceptionType) {
+ return exceptionType == null ? null : (DataType)exceptionType.getLogical();
+ }
+
+ private boolean typesMatch(Object first, Object second) {
+ if (first.equals(second)) {
+ return true;
+ }
+ if (first instanceof XMLType && second instanceof XMLType) {
+ XMLType t1 = (XMLType)first;
+ XMLType t2 = (XMLType)second;
+ // TUSCANY-2113, we should compare element names only
+ return matches(t1.getElementName(), t2.getElementName());
+ }
+ return false;
+ }
+
+ /**
+ * @param qn1
+ * @param qn2
+ */
+ private boolean matches(QName qn1, QName qn2) {
+ if (qn1 == qn2) {
+ return true;
+ }
+ if (qn1 == null || qn2 == null) {
+ return false;
+ }
+ String ns1 = qn1.getNamespaceURI();
+ String ns2 = qn2.getNamespaceURI();
+ String e1 = qn1.getLocalPart();
+ String e2 = qn2.getLocalPart();
+ if (e1.equals(e2) && (ns1.equals(ns2) || ns1.equals(ns2 + "/") || ns2.equals(ns1 + "/"))) {
+ // Tolerating the trailing / which is required by JAX-WS java package --> xml ns mapping
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @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);
+ metadata.put("wire", wire);
+ 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;
+ }
+
+ public boolean allowsPassByReference() {
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java
new file mode 100644
index 0000000000..3586f54d71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.databinding.wire;
+
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+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;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Implementation of an interceptor that enforces pass-by-value semantics
+ * on operation invocations by copying the operation input and output data.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PassByValueInterceptor implements Interceptor {
+
+ private DataBindingExtensionPoint dataBindings;
+ private FaultExceptionMapper faultExceptionMapper;
+
+ private DataBinding[] inputDataBindings;
+ private DataBinding outputDataBinding;
+ private DataBinding javaBeanDataBinding;
+ private DataBinding jaxbDataBinding;
+ private Operation operation;
+ private Invoker nextInvoker;
+ private InvocationChain chain;
+
+ /**
+ * Constructs a new PassByValueInterceptor.
+ * @param dataBindings databinding extension point
+ * @param operation the intercepted operation
+ */
+ public PassByValueInterceptor(DataBindingExtensionPoint dataBindings,
+ FaultExceptionMapper faultExceptionMapper,
+ InvocationChain chain,
+ Operation operation) {
+ this.chain = chain;
+ this.operation = operation;
+
+ // Cache data bindings to use
+ this.dataBindings = dataBindings;
+ this.faultExceptionMapper = faultExceptionMapper;
+
+ jaxbDataBinding = dataBindings.getDataBinding(JAXBDataBinding.NAME);
+ javaBeanDataBinding = dataBindings.getDataBinding(JavaBeansDataBinding.NAME);
+
+ // Determine the input databindings
+ if (operation.getInputType() != null) {
+ List<DataType> inputTypes = operation.getInputType().getLogical();
+ inputDataBindings = new DataBinding[inputTypes.size()];
+ int i = 0;
+ for (DataType inputType : inputTypes) {
+ String id = inputType.getDataBinding();
+ inputDataBindings[i++] = dataBindings.getDataBinding(id);
+ }
+ }
+
+ // Determine the output databinding
+ if (operation.getOutputType() != null) {
+ String id = operation.getOutputType().getDataBinding();
+ outputDataBinding = dataBindings.getDataBinding(id);
+ }
+ }
+
+ public Message invoke(Message msg) {
+ if (chain.allowsPassByReference()) {
+ return nextInvoker.invoke(msg);
+ }
+
+ msg.setBody(copy((Object[])msg.getBody(), inputDataBindings, operation.getInputType().getLogical()));
+
+ Message resultMsg = nextInvoker.invoke(msg);
+
+ if (!msg.isFault() && operation.getOutputType() != null) {
+ resultMsg.setBody(copy(resultMsg.getBody(), outputDataBinding, operation.getOutputType()));
+ }
+
+ if (msg.isFault()) {
+ msg.setFaultBody(copyFault(msg.getBody()));
+ }
+ return resultMsg;
+ }
+
+ private Object copyFault(Object fault) {
+ if (faultExceptionMapper == null) {
+ return fault;
+ }
+ for (DataType et : operation.getFaultTypes()) {
+ if (et.getPhysical().isInstance(fault)) {
+ Throwable ex = (Throwable)fault;
+ DataType<DataType> exType =
+ new DataTypeImpl<DataType>(ex.getClass(), new DataTypeImpl<XMLType>(ex.getClass(), XMLType.UNKNOWN));
+ faultExceptionMapper.introspectFaultDataType(exType, operation, false);
+ DataType faultType = exType.getLogical();
+ Object faultInfo = faultExceptionMapper.getFaultInfo(ex, faultType.getPhysical(), operation);
+ faultInfo = copy(faultInfo, dataBindings.getDataBinding(faultType.getDataBinding()), faultType);
+ fault = faultExceptionMapper.wrapFaultInfo(exType, ex.getMessage(), faultInfo, ex.getCause(), operation);
+ return fault;
+ }
+ }
+ return fault;
+ }
+
+ /**
+ * Copy an array of data objects passed to an operation
+ * @param data array of objects to copy
+ * @return the copy
+ */
+ private Object[] copy(Object[] data, DataBinding[] dataBindings, List<DataType> dataTypes) {
+ if (data == null) {
+ return null;
+ }
+ Object[] copy = new Object[data.length];
+ Map<Object, Object> map = new IdentityHashMap<Object, Object>();
+ for (int i = 0; i < data.length; i++) {
+ Object arg = data[i];
+ if (arg == null) {
+ copy[i] = null;
+ } else {
+ Object copiedArg = map.get(arg);
+ if (copiedArg != null) {
+ copy[i] = copiedArg;
+ } else {
+ copiedArg = copy(arg, dataBindings[i], dataTypes.get(i));
+ map.put(arg, copiedArg);
+ copy[i] = copiedArg;
+ }
+ }
+ }
+ return copy;
+ }
+
+ /**
+ * Copy data using the specified databinding.
+ * @param data input data
+ * @param dataBinding databinding to use
+ * @param dataType TODO
+ * @return a copy of the data
+ */
+ private Object copy(Object data, DataBinding dataBinding, DataType dataType) {
+ if (data == null) {
+ return null;
+ }
+ Class<?> clazz = data.getClass();
+ if (String.class == clazz || clazz.isPrimitive()
+ || Number.class.isAssignableFrom(clazz)
+ || Boolean.class.isAssignableFrom(clazz)
+ || Character.class.isAssignableFrom(clazz)
+ || Byte.class.isAssignableFrom(clazz)
+ || URI.class == clazz
+ || UUID.class == clazz
+ || QName.class == clazz) {
+ // Immutable classes
+ return data;
+ }
+ // If no databinding was specified, introspect the given arg to
+ // determine its databinding
+ if (dataBinding == null) {
+ dataType = dataBindings.introspectType(data, operation);
+ if (dataType != null) {
+ String db = dataType.getDataBinding();
+ dataBinding = dataBindings.getDataBinding(db);
+ if (dataBinding == null && db != null) {
+ return data;
+ }
+ }
+ if (dataBinding == null) {
+
+ // Default to the JavaBean databinding
+ dataBinding = javaBeanDataBinding;
+ }
+ }
+
+ // Use the JAXB databinding to copy non-Serializable data
+ if (dataBinding == javaBeanDataBinding) {
+
+ // If the input data is an array containing non Serializable elements
+ // use JAXB
+ clazz = data.getClass();
+ if (clazz.isArray()) {
+ if (Array.getLength(data) != 0) {
+ Object element = Array.get(data, 0);
+ if (element != null && !(element instanceof Serializable)) {
+ dataBinding = jaxbDataBinding;
+ }
+ }
+ } else {
+
+ // If the input data is not Serializable use JAXB
+ if (!(data instanceof Serializable)) {
+ dataBinding = jaxbDataBinding;
+ }
+
+ if (data instanceof Cloneable) {
+ Method clone;
+ try {
+ clone = data.getClass().getMethod("clone", (Class[])null);
+ try {
+ return clone.invoke(data, (Object[])null);
+ } catch (InvocationTargetException e) {
+ if (e.getTargetException() instanceof CloneNotSupportedException) {
+ // Ignore
+ } else {
+ throw new ServiceRuntimeException(e);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ } catch (NoSuchMethodException e) {
+ // Ignore it
+ }
+ }
+ }
+ }
+
+ Object copy = dataBinding.copy(data, dataType, operation);
+ return copy;
+ }
+
+ public Invoker getNext() {
+ return nextInvoker;
+ }
+
+ public void setNext(Invoker next) {
+ this.nextInvoker = next;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..baba638c9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.sca.core.databinding.module.DataBindingModuleActivator
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java
new file mode 100644
index 0000000000..b0c39e18ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.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.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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataBindingJavaInterfaceProcessorTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ }
+
+ /**
+ * @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 = newOperation("call");
+ Operation operation1 = newOperation("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);
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCaseFIXME.java b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCaseFIXME.java
new file mode 100644
index 0000000000..7d49fb7112
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCaseFIXME.java
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.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 IDLTransformerTestCaseFIXME 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-android/modules/core-spi/LICENSE b/sca-java-1.x/branches/sca-android/modules/core-spi/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core-spi/META-INF/README b/sca-java-1.x/branches/sca-android/modules/core-spi/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/NOTICE b/sca-java-1.x/branches/sca-android/modules/core-spi/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/core-spi/pom.xml b/sca-java-1.x/branches/sca-android/modules/core-spi/pom.xml
new file mode 100644
index 0000000000..6246686d08
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/pom.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-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>tuscany-extensibility</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</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.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.core.spi</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/doc/Context Model.emx b/sca-java-1.x/branches/sca-android/modules/core-spi/src/doc/Context Model.emx
new file mode 100644
index 0000000000..0445ea5a6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java
new file mode 100644
index 0000000000..ed4b57639c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.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.context;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * Interface implemented by the provider of the ComponentContext.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentContextFactory {
+ /**
+ * Create an instance of ComponentContext
+ *
+ * @param component The runtime component
+ * @param requestContextFactory The factory to create RequestContext
+ * @return An instance of ComponentContext for the component
+ */
+ ComponentContext createComponentContext(RuntimeComponent component, RequestContextFactory requestContextFactory);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java
new file mode 100644
index 0000000000..e92a8f2844
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.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.context;
+
+/**
+ * An extension point for context factories.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContextFactoryExtensionPoint {
+
+ /**
+ * Add a context factory extension.
+ *
+ * @param factory The factory to add
+ */
+ void addFactory(Object factory);
+
+ /**
+ * Remove a context 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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java
new file mode 100644
index 0000000000..5a0aefe55d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.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.context;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a model factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultContextFactoryExtensionPoint implements ContextFactoryExtensionPoint {
+
+ /**
+ * The Map of Factories that have been registered.
+ */
+ private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>();
+
+ private ExtensionPointRegistry registry;
+
+ public DefaultContextFactoryExtensionPoint(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add.
+ * @throws IllegalArgumentException if factory is null
+ */
+ public void addFactory(Object factory) throws IllegalArgumentException {
+ if (factory == null) {
+ throw new IllegalArgumentException("Cannot add null as a 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
+ * @throws IllegalArgumentException if factory is null
+ */
+ public void removeFactory(Object factory) throws IllegalArgumentException {
+ if (factory == null) {
+ throw new IllegalArgumentException("Cannot remove null as a 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) throws IllegalArgumentException {
+ if (factoryInterface == null) {
+ throw new IllegalArgumentException("Cannot get null as a factory");
+ }
+
+ Object factory = factories.get(factoryInterface);
+ if (factory == null) {
+
+ // Dynamically load a factory class declared under META-INF/services
+ try {
+ Class<?> factoryClass = ServiceDiscovery.getInstance().loadFirstServiceClass(factoryInterface);
+ if (factoryClass != null) {
+
+ // Default empty constructor
+ Constructor<?> constructor = factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+
+ // Cache the loaded factory
+ addFactory(factory);
+ }
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+
+ }
+
+ return factoryInterface.cast(factory);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.java
new file mode 100644
index 0000000000..9766e164b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.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.context;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+
+/**
+ * Interface implemented by the provider of the property values
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PropertyValueFactory {
+
+ /**
+ * This method will create an instance of the value for the specified Property.
+ *
+ * @param property The Property from which to retrieve the property value
+ * @param type The type of the property value being retrieved from the Property
+ * @param <B> Type type of the property value being looked up
+ *
+ * @return the value for the Property
+ */
+ <B> B createPropertyValue(ComponentProperty property, Class<B> type);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java
new file mode 100644
index 0000000000..546757c766
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.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.context;
+
+import org.osoa.sca.RequestContext;
+
+/**
+ * Interface implemented by the provider of the RequestContext.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RequestContextFactory {
+ /**
+ * @return An instance of RequestContext for the current invocation
+ */
+ RequestContext createRequestContext();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java
new file mode 100644
index 0000000000..2849c27c1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.endpointresolver;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a provider factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultEndpointResolverFactoryExtensionPoint implements EndpointResolverFactoryExtensionPoint {
+
+ private ExtensionPointRegistry registry;
+ private final Map<Class<?>, EndpointResolverFactory> endpointResolverFactories = new HashMap<Class<?>, EndpointResolverFactory>();
+ private boolean loaded;
+
+ /**
+ * The default constructor. Does nothing.
+ *
+ */
+ public DefaultEndpointResolverFactoryExtensionPoint(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Add an endpoint resolver factory.
+ *
+ * @param endpointResolverFactory The resolver factory
+ */
+ public void addEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory){
+ endpointResolverFactories.put(endpointResolverFactory.getModelType(), endpointResolverFactory);
+ }
+
+ /**
+ * Remove a endpoint resolver factory.
+ *
+ * @param endpointResolverFactory The endpoint resolver factory
+ */
+ public void removeEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory){
+ endpointResolverFactories.remove(endpointResolverFactory.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 EndpointResolverFactory getEndpointResolverFactory(Class<?> modelType) {
+ loadProviderFactories();
+
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c : classes) {
+ EndpointResolverFactory factory = endpointResolverFactories.get(c);
+ if (factory != null) {
+ return factory;
+ }
+ }
+ return endpointResolverFactories.get(modelType);
+ }
+
+
+ /**
+ * Load provider factories declared under META-INF/services.
+ * @param registry
+ */
+ private void loadProviderFactories() {
+ if (loaded)
+ return;
+
+ // Get the provider factory service declarations
+ Set<ServiceDeclaration> factoryDeclarations;
+ ServiceDiscovery serviceDiscovery = ServiceDiscovery.getInstance();
+ try {
+ factoryDeclarations = serviceDiscovery.getServiceDeclarations(EndpointResolverFactory.class);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Get the extension point
+ EndpointResolverFactoryExtensionPoint factoryExtensionPoint =
+ registry.getExtensionPoint(EndpointResolverFactoryExtensionPoint.class);
+ List<EndpointResolverFactory> factories = new ArrayList<EndpointResolverFactory>();
+
+ for (ServiceDeclaration factoryDeclaration : factoryDeclarations) {
+ Map<String, String> attributes = factoryDeclaration.getAttributes();
+
+ // Find the model type that identifies this resolver
+ String modelTypeName = attributes.get("model");
+
+ // Create a provider factory wrapper and register it
+ EndpointResolverFactory factory =
+ new LazyEndpointResolverFactory(registry, modelTypeName, factoryDeclaration);
+ factoryExtensionPoint.addEndpointResolverFactory(factory);
+ factories.add(factory);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A wrapper around an endpoint provider factory allowing lazy
+ * loading and initialization of endpoint providers.
+ */
+ private class LazyEndpointResolverFactory implements EndpointResolverFactory {
+ private ExtensionPointRegistry registry;
+ private String modelTypeName;
+ private ServiceDeclaration providerClass;
+ private EndpointResolverFactory factory;
+ private Class modelType;
+
+ private LazyEndpointResolverFactory(ExtensionPointRegistry registry,
+ String modelTypeName,
+ ServiceDeclaration providerClass) {
+ this.registry = registry;
+ this.modelTypeName = modelTypeName;
+ this.providerClass = providerClass;
+ }
+
+ @SuppressWarnings("unchecked")
+ private EndpointResolverFactory getFactory() {
+ if (factory == null) {
+ try {
+ Class<EndpointResolverFactory> factoryClass = (Class<EndpointResolverFactory>)providerClass.loadClass();
+ Constructor<EndpointResolverFactory> constructor =
+ factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return factory;
+ }
+
+ public EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding) {
+ return getFactory().createEndpointResolver(endpoint, binding);
+ }
+
+ public Class getModelType() {
+ if (modelType == null) {
+ try {
+ modelType = providerClass.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.java
new file mode 100644
index 0000000000..79a10f6d84
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.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.endpointresolver;
+
+
+/**
+ * A reference binding implementation can options implement this
+ * interface to tie into the Tuscany SCA runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EndpointResolver {
+
+ /**
+ * This method will be invoked when the endpoint is
+ * activated. It gives the resolver the opportunity
+ * to do any set up ready for when it is asked to
+ * resolve the endpoint when a message arrives
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the endpoint is
+ * to be resolved. The resolver will attempt to resolve the
+ * endpoint against available services. The resolvers extending
+ * this interface will provide environment or binding specific
+ * resolution processing
+ */
+ void resolve();
+
+ /**
+ * This method will be invoked when the endpont is
+ * deactivated. It gives the resolver the opportunity
+ * to take and required resolver shutdown actions
+ */
+ void stop();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.java
new file mode 100644
index 0000000000..fdd304a9c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.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.endpointresolver;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Endpoint;
+
+/**
+ * A factory for creating the runtime artifacts that resolve endpoints.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EndpointResolverFactory <M>{
+
+ /**
+ * Creates a new endpoint resolver for the given component,
+ * reference and binding.
+ *
+ * @param component The runtime component
+ * @param reference The reference on the runtime component
+ * @param enpoint The endpoint assembly model object
+ * @return The endpoint provider
+ */
+ EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding);
+
+ Class<M> getModelType();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java
new file mode 100644
index 0000000000..be55981131
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.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.endpointresolver;
+
+import java.util.List;
+
+
+/**
+ * An extension point for resolver factories. Holds all of the resolver
+ * factories from loaded extension points. Allows a resolver factory
+ * to be located based on a given model type. Hence the runtime can
+ * generate endpoint resolvers from the in memory assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EndpointResolverFactoryExtensionPoint {
+
+
+ /**
+ * Add an endpoint resolver factory.
+ *
+ * @param endpointResolverFactory The resolver factory
+ */
+ void addEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory);
+
+ /**
+ * Remove a endpoint resolver factory.
+ *
+ * @param endpointResolverFactory The endpoint resolver factory
+ */
+ void removeEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory);
+
+ /**
+ * Returns the endpoint resolver factory associated with the given binding type.
+ * @param bindingType A binding type
+ * @return The endpoint resolver factory associated with the given binding type
+ */
+ EndpointResolverFactory getEndpointResolverFactory(Class<?> bindingType);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java
new file mode 100644
index 0000000000..992c1188f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java
new file mode 100644
index 0000000000..d17aebd7e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java
new file mode 100644
index 0000000000..f209eb8936
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 registered listeners
+ * @param object The event to publish
+ */
+ 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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java
new file mode 100644
index 0000000000..f888908340
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java
new file mode 100644
index 0000000000..957a15ce8a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.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.invocation;
+
+/**
+ * An invoker or interceptor can optionally implement this interface to indicate if they can
+ * enforce the pass-by-value semantics for an operation on remotable interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DataExchangeSemantics {
+ /**
+ * Indicate if the data can be passed in by reference as they won't be mutated.
+ * @return true if pass-by-reference is allowed
+ */
+ boolean allowsPassByReference();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
new file mode 100644
index 0000000000..75719bb0cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.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.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();
+
+ /**
+ * Updates the target operation for this invocation chain.
+ *
+ * @param operation The new target operation for this invocation chain
+ */
+ void setTargetOperation(Operation operation);
+
+ /**
+ * Returns the source operation for this invocation chain.
+ *
+ * @return The source operation for this invocation chain
+ */
+ Operation getSourceOperation();
+
+ /**
+ * Adds an interceptor to the chain. For reference side, it will be added to
+ * Phase.REFERENCE. For service side, it will be added to Phase.SERVICE
+ *
+ * @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();
+
+ /**
+ * @deprecated This method is not used
+ * Returns the last invoker in the chain.
+ *
+ * @return The last invoker in the chain
+ */
+ @Deprecated
+ Invoker getTailInvoker();
+
+ /**
+ * @deprecated Please use <code>void addInterceptor(String phase, Interceptor interceptor);</code>
+ * 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
+ */
+ @Deprecated
+ void addInterceptor(int index, Interceptor interceptor);
+
+ /**
+ * Add an interceptor to the given phase
+ * @param phase
+ * @param interceptor
+ */
+ void addInterceptor(String phase, Interceptor interceptor);
+
+ /**
+ * Indicate if the data can be passed in by reference as they won't be mutated.
+ * @return true if pass-by-reference is allowed
+ */
+ boolean allowsPassByReference();
+ /**
+ * Force the invocation to allow pass-by-reference
+ * @param allowsPBR
+ */
+ void setAllowsPassByReference(boolean allowsPBR);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
new file mode 100644
index 0000000000..a727693132
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.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.invocation;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+
+/**
+ * Represents a request, response, or exception flowing through a wire
+ *
+ * @version $Rev $Date$
+ */
+public interface Message {
+ String QOS_CTX_SECURITY_PRINCIPAL = "PRINCIPAL";
+
+ /**
+ * 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 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);
+
+ /**
+ * 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 operation that created the message.
+ *
+ * @return The operation that created the message
+ */
+ Operation getOperation();
+
+ /**
+ * Sets the operation that created the message.
+ *
+ * @param op The operation that created the message
+ */
+ void setOperation(Operation op);
+
+ /**
+ * Returns a map of objects that represents the QoS context that wraps this message such as
+ * invoking authenticated principal and so on.
+ *
+ * @return
+ */
+ Map<String, Object> getQoSContext();
+
+ /**
+ * Returns a map of objects that are contained in the message header
+ *
+ * @return
+ */
+ Map<String, Object> getHeader();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java
new file mode 100644
index 0000000000..38c900e36a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java
new file mode 100644
index 0000000000..2deb273f84
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.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.invocation;
+
+/**
+ * Tuscany built-in phases for the invocation chain
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Phase {
+ // The first phase for outgoing invocations via a reference
+ String REFERENCE = "component.reference";
+
+ // data transformation and validation
+ String REFERENCE_INTERFACE = "reference.interface";
+
+ // reference policy handling
+ String REFERENCE_POLICY = "reference.policy";
+
+ // reference binding invoker
+ String REFERENCE_BINDING = "reference.binding";
+
+ // The first phase for incoming invocations via a service
+ String SERVICE_BINDING = "service.binding";
+
+ // service policy handling
+ String SERVICE_POLICY = "service.policy";
+
+ // data validation and transformation
+ String SERVICE_INTERFACE = "service.interface";
+
+ // TODO: not sure if we need to have this face
+ String SERVICE = "component.service";
+
+ // implementation policy handling
+ String IMPLEMENTATION_POLICY = "implementation.policy";
+
+ // implementation invoker
+ String IMPLEMENTATION = "component.implementation";
+
+ // String getName();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java
new file mode 100644
index 0000000000..3887db4873
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 implementation
+ * 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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
new file mode 100644
index 0000000000..dfc3ddb468
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
@@ -0,0 +1,362 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Default implementation of a provider factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExtensionPoint {
+
+ private ExtensionPointRegistry registry;
+ private final Map<Class<?>, ProviderFactory> providerFactories = new HashMap<Class<?>, ProviderFactory>();
+ private final List<PolicyProviderFactory> policyProviderFactories = new ArrayList<PolicyProviderFactory>();
+ private boolean loaded;
+
+ /**
+ * The default constructor. Does nothing.
+ *
+ */
+ public DefaultProviderFactoryExtensionPoint(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Add a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ public void addProviderFactory(ProviderFactory providerFactory) {
+ if(providerFactory instanceof PolicyProviderFactory) {
+ policyProviderFactories.add((PolicyProviderFactory)providerFactory);
+ }
+ providerFactories.put(providerFactory.getModelType(), providerFactory);
+ }
+
+ /**
+ * Remove a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ public void removeProviderFactory(ProviderFactory providerFactory) {
+ if(providerFactory instanceof PolicyProviderFactory) {
+ policyProviderFactories.remove((PolicyProviderFactory)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) {
+ loadProviderFactories();
+
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c : classes) {
+ ProviderFactory factory = providerFactories.get(c);
+ if (factory != null) {
+ return factory;
+ }
+ }
+ return providerFactories.get(modelType);
+ }
+
+ public List<PolicyProviderFactory> getPolicyProviderFactories() {
+ loadProviderFactories();
+ return policyProviderFactories;
+ }
+
+ /**
+ * Load provider factories declared under META-INF/services.
+ * @param registry
+ */
+ private void loadProviderFactories() {
+ if (loaded)
+ return;
+
+ loadProviderFactories(BindingProviderFactory.class);
+ loadProviderFactories(ImplementationProviderFactory.class);
+ loadProviderFactories(PolicyProviderFactory.class);
+
+ loaded = true;
+ }
+
+ /**
+ * Load provider factories declared under META-INF/services.
+ * @param registry
+ * @param factoryClass
+ * @return
+ */
+ private List<ProviderFactory> loadProviderFactories(Class<?> factoryClass) {
+
+ // Get the provider factory service declarations
+ Set<ServiceDeclaration> factoryDeclarations;
+ ServiceDiscovery serviceDiscovery = ServiceDiscovery.getInstance();
+ try {
+ factoryDeclarations = serviceDiscovery.getServiceDeclarations(factoryClass);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Get the target extension point
+ ProviderFactoryExtensionPoint factoryExtensionPoint =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ List<ProviderFactory> factories = new ArrayList<ProviderFactory>();
+
+ for (ServiceDeclaration factoryDeclaration : factoryDeclarations) {
+ Map<String, String> attributes = factoryDeclaration.getAttributes();
+
+ // Load an implementation provider factory
+ if (factoryClass == ImplementationProviderFactory.class) {
+ String modelTypeName = attributes.get("model");
+
+ // Create a provider factory wrapper and register it
+ ImplementationProviderFactory factory =
+ new LazyImplementationProviderFactory(registry, modelTypeName, factoryDeclaration);
+ factoryExtensionPoint.addProviderFactory(factory);
+ factories.add(factory);
+
+ } else if (factoryClass == BindingProviderFactory.class) {
+
+ // Load a binding provider factory
+ String modelTypeName = attributes.get("model");
+
+ // Create a provider factory wrapper and register it
+ BindingProviderFactory factory =
+ new LazyBindingProviderFactory(registry, modelTypeName, factoryDeclaration);
+ factoryExtensionPoint.addProviderFactory(factory);
+ factories.add(factory);
+ } else if (factoryClass == PolicyProviderFactory.class) {
+ // Load a policy provider factory
+ String modelTypeName = attributes.get("model");
+
+ // Create a provider factory wrapper and register it
+ PolicyProviderFactory factory =
+ new LazyPolicyProviderFactory(registry, modelTypeName, factoryDeclaration);
+ factoryExtensionPoint.addProviderFactory(factory);
+ factories.add(factory);
+ }
+ }
+ return factories;
+ }
+
+ /**
+ * A wrapper around an implementation provider factory allowing lazy
+ * loading and initialization of implementation providers.
+ */
+ private static class LazyBindingProviderFactory implements BindingProviderFactory {
+
+ private ExtensionPointRegistry registry;
+ private String modelTypeName;
+ private ServiceDeclaration factoryDeclaration;
+ private BindingProviderFactory factory;
+ private Class modelType;
+
+ private LazyBindingProviderFactory(ExtensionPointRegistry registry,
+ String modelTypeName,
+ ServiceDeclaration factoryDeclaration) {
+ this.registry = registry;
+ this.modelTypeName = modelTypeName;
+ this.factoryDeclaration = factoryDeclaration;
+ }
+
+ @SuppressWarnings("unchecked")
+ private BindingProviderFactory getFactory() {
+ if (factory == null) {
+ try {
+ Class<BindingProviderFactory> factoryClass =
+ (Class<BindingProviderFactory>)factoryDeclaration.loadClass();
+ Constructor<BindingProviderFactory> constructor =
+ factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return factory;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ return getFactory().createReferenceBindingProvider(component, reference, binding);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ return getFactory().createServiceBindingProvider(component, service, binding);
+ }
+
+ public Class getModelType() {
+ if (modelType == null) {
+ try {
+ modelType = factoryDeclaration.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+
+ }
+
+ /**
+ * A wrapper around an implementation provider factory allowing lazy
+ * loading and initialization of implementation providers.
+ */
+ private class LazyImplementationProviderFactory implements ImplementationProviderFactory {
+
+ private ExtensionPointRegistry registry;
+ private String modelTypeName;
+ private ServiceDeclaration providerClass;
+ private ImplementationProviderFactory factory;
+ private Class modelType;
+
+ private LazyImplementationProviderFactory(ExtensionPointRegistry registry,
+ String modelTypeName,
+ ServiceDeclaration providerClass) {
+ this.registry = registry;
+ this.modelTypeName = modelTypeName;
+ this.providerClass = providerClass;
+ }
+
+ @SuppressWarnings("unchecked")
+ private ImplementationProviderFactory getFactory() {
+ if (factory == null) {
+ try {
+ Class<ImplementationProviderFactory> factoryClass =
+ (Class<ImplementationProviderFactory>)providerClass.loadClass();
+ Constructor<ImplementationProviderFactory> constructor =
+ factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return factory;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ Implementation Implementation) {
+ return getFactory().createImplementationProvider(component, Implementation);
+ }
+
+ public Class getModelType() {
+ if (modelType == null) {
+ try {
+
+ modelType = providerClass.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+
+ }
+
+ /**
+ * A wrapper around an policy provider factory allowing lazy
+ * loading and initialization of policy providers.
+ */
+ private class LazyPolicyProviderFactory implements PolicyProviderFactory {
+ private ExtensionPointRegistry registry;
+ private String modelTypeName;
+ private ServiceDeclaration providerClass;
+ private PolicyProviderFactory factory;
+ private Class modelType;
+
+ private LazyPolicyProviderFactory(ExtensionPointRegistry registry,
+ String modelTypeName,
+ ServiceDeclaration providerClass) {
+ this.registry = registry;
+ this.modelTypeName = modelTypeName;
+ this.providerClass = providerClass;
+ }
+
+ @SuppressWarnings("unchecked")
+ private PolicyProviderFactory getFactory() {
+ if (factory == null) {
+ try {
+ Class<PolicyProviderFactory> factoryClass = (Class<PolicyProviderFactory>)providerClass.loadClass();
+ Constructor<PolicyProviderFactory> constructor =
+ factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return factory;
+ }
+
+ public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component,
+ Implementation implementation) {
+ return getFactory().createImplementationPolicyProvider(component, implementation);
+ }
+
+ public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ return getFactory().createReferencePolicyProvider(component, reference, binding);
+ }
+
+ public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ return getFactory().createServicePolicyProvider(component, service, binding);
+ }
+
+ public Class getModelType() {
+ if (modelType == null) {
+ try {
+ modelType = providerClass.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java
new file mode 100644
index 0000000000..068d0d12d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.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.provider;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Concrete Implementation for the SCADefinitionsProviderExtensionPoint
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultSCADefinitionsProviderExtensionPoint implements
+ SCADefinitionsProviderExtensionPoint {
+
+ private ExtensionPointRegistry extensionPointRegistry = null;
+
+ private List<SCADefinitionsProvider> scaDefnsProviders = new ArrayList<SCADefinitionsProvider>();
+
+ public DefaultSCADefinitionsProviderExtensionPoint(ExtensionPointRegistry extnPtReg) {
+ this.extensionPointRegistry = extnPtReg;
+ }
+
+ public void addSCADefinitionsProvider(SCADefinitionsProvider provider) {
+ scaDefnsProviders.add(provider);
+ }
+
+ public void removeSCADefinitionsProvider(SCADefinitionsProvider provider) {
+ scaDefnsProviders.remove(provider);
+ }
+
+ public List<SCADefinitionsProvider> getSCADefinitionsProviders() {
+ if (scaDefnsProviders.isEmpty()) {
+ loadProviders();
+ }
+ return scaDefnsProviders;
+ }
+
+ private void loadProviders() {
+ // Get the provider service declarations
+ Set<ServiceDeclaration> defnProviderDecls;
+ SCADefinitionsProvider aProvider = null;
+ Class providerClass = null;
+ Constructor constructor = null;
+
+ try {
+ defnProviderDecls =
+ ServiceDiscovery.getInstance().getServiceDeclarations(SCADefinitionsProvider.class);
+
+ for (ServiceDeclaration aDefnProviderDecl : defnProviderDecls) {
+ providerClass = aDefnProviderDecl.loadClass();
+
+ try {
+ constructor = providerClass.getConstructor();
+ aProvider = (SCADefinitionsProvider)constructor.newInstance();
+ } catch (NoSuchMethodException e1) {
+ constructor = providerClass.getConstructor(ExtensionPointRegistry.class);
+ aProvider = (SCADefinitionsProvider)constructor.newInstance(extensionPointRegistry);
+ }
+
+ scaDefnsProviders.add(aProvider);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java
new file mode 100644
index 0000000000..015c673d66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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);
+
+ /**
+ * For bindings that invoke one-way callback operations asynchronously,
+ * there is no need to perform a thread switch before calling the invoker.
+ * This method indicates whether the binding has this capability.
+ *
+ * @return true if the callback invoker is able to invoke one-way operations
+ * asynchronously, false if all invocations are synchronous
+ */
+ boolean supportsOneWayInvocation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java
new file mode 100644
index 0000000000..f2b59a7c54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.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.provider;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface can be optionally implemented by the Binding or Implementation providers to
+ * indicate if they implement the policies in the binding/implementation provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PolicyImplementor {
+ /**
+ * Get a list of policy names that are implemented by this policy implementor
+ * @return A list of policy names
+ */
+ List<QName> getImplementedPolicies();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.java
new file mode 100644
index 0000000000..644283dea1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.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.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface PolicyProvider {
+ /**
+ * Create an interceptor for a given operation
+ * @param operation
+ * @return An interceptor that realize the policySet
+ */
+ Interceptor createInterceptor(Operation operation);
+
+ /**
+ * Get the phase that the interceptor should be added
+ * @return The phase that this interceptor belongs to
+ */
+ String getPhase();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.java
new file mode 100644
index 0000000000..b60a14d2da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.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.provider;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.policy.Policy;
+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 interface PolicyProviderFactory<M extends Policy> extends ProviderFactory<M> {
+ /**
+ * Create policy provider for a given reference binding
+ * @param component
+ * @param reference
+ * @param binding
+ * @return
+ */
+ PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding);
+
+ /**
+ * Create policy provider for a given service binding
+ * @param component
+ * @param service
+ * @param binding
+ * @return
+ */
+ PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding);
+
+ /**
+ * Create policy provider for a given component implementation
+ * @param component
+ * @param implementation
+ * @return
+ */
+ PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java
new file mode 100644
index 0000000000..d8f9973338
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.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.provider;
+
+import java.util.List;
+
+
+/**
+ * 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);
+
+ /**
+ * Get a list of registered PolicyProviderFactory
+ * @return a list of registered PolicyProviderFactory
+ */
+ List<PolicyProviderFactory> getPolicyProviderFactories();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java
new file mode 100644
index 0000000000..b3ab1d8b87
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.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 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
+ * @return An invoker that handles the invocation logic, null should be
+ * returned if no invoker is required
+ */
+ Invoker createInvoker(Operation operation);
+
+ /**
+ * 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();
+
+ /**
+ * For bindings that invoke one-way operations asynchronously, there is no
+ * need to perform a thread switch before calling the invoker. This method
+ * indicates whether the binding has this capability.
+ *
+ * @return true if the binding invoker is able to invoke one-way operations
+ * asynchronously, false if all invocations are synchronous
+ */
+ boolean supportsOneWayInvocation();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProvider.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProvider.java
new file mode 100644
index 0000000000..bd0f4d4b75
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProvider.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.provider;
+
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+
+/**
+ * Models a provider of SCA Definitions. Typically SCA Definitions providers
+ * may either load a definitions.xml file or create the SCA Definitions model
+ * programmatically.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCADefinitionsProvider {
+ SCADefinitions getSCADefinition() throws SCADefinitionsProviderException ;
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderException.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderException.java
new file mode 100644
index 0000000000..b05130d6c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderException.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.provider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCADefinitionsProviderException extends Exception {
+
+ public SCADefinitionsProviderException(Throwable e) {
+ super(e);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderExtensionPoint.java
new file mode 100644
index 0000000000..a5d60cc6eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderExtensionPoint.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.provider;
+
+import java.util.List;
+
+/**
+ * An extension point for SCA Definitions Providers. SCA Definition providers, load SCA Definitions
+ * items that are being specifically contributed by the module that hosts the provider in question.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCADefinitionsProviderExtensionPoint {
+
+ void addSCADefinitionsProvider(SCADefinitionsProvider provider);
+ void removeSCADefinitionsProvider(SCADefinitionsProvider provider);
+ List<SCADefinitionsProvider> getSCADefinitionsProviders();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java
new file mode 100644
index 0000000000..e15234a549
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.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.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();
+
+ /**
+ * For bindings that invoke one-way callback operations asynchronously,
+ * there is no need to perform a thread switch before calling the invoker.
+ * This method indicates whether the binding has this capability.
+ *
+ * @return true if the callback invoker is able to invoke one-way operations
+ * asynchronously, false if all invocations are synchronous
+ */
+ boolean supportsOneWayInvocation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
new file mode 100644
index 0000000000..b6fafa5fb6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.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.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 extends Cloneable {
+ /**
+ * 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();
+
+ /**
+ * Get the interface contract for the endpoint
+ * @return The interface contract
+ */
+ InterfaceContract getInterfaceContract();
+
+ /**
+ * Update the interface contract for the endpoint
+ * @param interfaceContract The updated interface contract
+ */
+ void setInterfaceContract(InterfaceContract interfaceContract);
+
+ /**
+ * Get the URI for this endpoint
+ * @return The URI of the endpoint
+ */
+ String getURI();
+
+ /**
+ * Set the URI for this endpoint
+ * @param uri The new URI of the endpoint
+ */
+ void setURI(String uri);
+
+ /**
+ * Get the callback endpoint for this endpoint
+ * @return The callback endpoint for this endpoint
+ */
+ EndpointReference getCallbackEndpoint();
+
+ /**
+ * Set the callback endpoint for this endpoint
+ * @param callbackEndpoint The new callback endpoint for this endpoint
+ */
+ void setCallbackEndpoint(EndpointReference callbackEndpoint);
+
+ Object clone() throws CloneNotSupportedException;
+
+ void setReferenceParameters(ReferenceParameters parameters);
+ ReferenceParameters getReferenceParameters();
+
+ void mergeEndpoint(EndpointReference epr);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
new file mode 100644
index 0000000000..0e19538aff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.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.runtime;
+
+/**
+ * Parameters for the EndPointReference
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ReferenceParameters extends Cloneable {
+ /**
+ * Get the callback ID
+ * @return the callbackID
+ */
+ Object getCallbackID();
+
+ /**
+ * Set the callback ID
+ * @param callbackID the callbackID to set
+ */
+ void setCallbackID(Object callbackID);
+
+ /**
+ * Get the conversation ID
+ * @return the conversationID
+ */
+ Object getConversationID();
+
+ /**
+ * Set the conversation ID
+ * @param conversationID the conversationID to set
+ */
+ void setConversationID(Object conversationID);
+
+ /**
+ * Get the ID for the non-ServiceReference callback object
+ * @return
+ */
+ Object getCallbackObjectID();
+
+ /**
+ * Set the ID for the non-ServiceReference callback object
+ * @param callbackObjectID
+ */
+ void setCallbackObjectID(Object callbackObjectID);
+
+ EndpointReference getCallbackReference();
+
+ void setCallbackReference(EndpointReference callback);
+
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java
new file mode 100644
index 0000000000..30bba78a40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.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.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+
+/**
+ * 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 {
+ /**
+ * 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 configuration for this component
+ * @return The implementation provider for this component
+ */
+ ImplementationProvider getImplementationProvider();
+
+ /**
+ * Get the associated component context
+ * @return
+ */
+ RuntimeComponentContext getComponentContext();
+
+ /**
+ * Set the associated component context
+ * @param context
+ */
+ void setComponentContext(RuntimeComponentContext context);
+
+ /**
+ * Tests if the RuntimeComponent is started
+ * @return true if the RuntimeComponent is started otherwise false
+ */
+ boolean isStarted();
+
+ /**
+ * Sets the RuntimeComponent started state
+ * @param started the state to set
+ */
+ void setStarted(boolean started);
+
+ /**
+ * Add a policy provider to the component
+ * @param policyProvider
+ */
+ void addPolicyProvider(PolicyProvider policyProvider);
+
+ /**
+ * Get a list of policy providers configured for this component
+ * @return
+ */
+ List<PolicyProvider> getPolicyProviders();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java
new file mode 100644
index 0000000000..801bb9e294
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.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.runtime;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponentContext extends ComponentContext {
+ /**
+ * Activate the reference (creating runtime wires)
+ * @param reference
+ */
+ void start(RuntimeComponentReference reference);
+
+ /**
+ * Deserialize the component reference
+ * @param reader
+ * @return A component that contains the reference
+ * @throws IOException
+ */
+ RuntimeComponent read(Reader reader) throws IOException;
+
+ /**
+ * Serialize the component reference
+ * @param reference
+ * @param writer
+ * @throws IOException
+ */
+ void write(RuntimeComponentReference reference, Writer writer) throws IOException;
+
+ /**
+ * Get the CallableReference for a given component reference
+ * @param <B>
+ * @param businessInterface The business interface
+ * @param reference The reference to be wired
+ * @param binding The binding to be used, if it's null, either binding.sca or the 1st binding
+ * will be selected
+ * @return A service reference representing the wire
+ */
+ <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
+ RuntimeComponentReference reference,
+ Binding binding);
+
+ /**
+ * Bind the reference to a target component/componentService
+ * @param <B>
+ * @param businessInterface The business interface
+ * @param reference The reference to be wired
+ * @param component The target component
+ * @param service The target component service
+ * @return A service reference representing the wire
+ */
+ <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
+ RuntimeComponentReference reference,
+ RuntimeComponent component,
+ RuntimeComponentService service);
+
+ /**
+ * Create a CallableReference for the given component service
+ * @param <B>
+ * @param businessInterface
+ * @param component
+ * @param service
+ * @return
+ */
+ <B> CallableReference<B> getCallableReference(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentService service);
+
+ /**
+ * @param <B>
+ * @param businessInterface
+ * @param service
+ * @return
+ */
+ <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
new file mode 100644
index 0000000000..44ae7f552a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.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.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+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);
+
+ /**
+ * Returns the endpoint resolver associated with this
+ * component reference and the given endpoint.
+ *
+ * @param endpont The assembly model endpoint
+ * @return The enpoint resolver
+ */
+ EndpointResolver getEndpointResolver(Endpoint endpoint);
+
+ /**
+ * Sets the endpoint resolver associated with this
+ * component reference and the given endpoint.
+ *
+ * @param binding The assembly model binding
+ * @param bindingProvider The runtime reference binding provider
+ */
+ void setEndpointResolver(Endpoint endpoint, EndpointResolver endpointResolver);
+
+ /**
+ * Add a policy provider for the given binding to the reference
+ * @param binding The assembly model binding
+ * @param policyProvider The policy handler
+ */
+ void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
+
+ /**
+ * Get a list of policy providers for the given binding
+ * @param binding The assembly model binding
+ * @return A list of policy providers for the given binding
+ */
+ List<PolicyProvider> getPolicyProviders(Binding binding);
+
+ /**
+ * 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);
+
+ /**
+ * Set the owning component
+ * @param component
+ */
+ void setComponent(RuntimeComponent component);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
new file mode 100644
index 0000000000..982724d798
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.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.InterfaceContract;
+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.PolicyProvider;
+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 associated 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);
+
+ /**
+ * Returns the service binding provider associated with this
+ * component service and the given binding.
+ *
+ * @param binding
+ * @param interfaceContract
+ * @return
+ */
+ RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract);
+
+ /**
+ * 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 invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param interfaceContract the client interface contract
+ * @param operation The assembly model operation
+ * @return The runtime invoker
+ */
+ Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation);
+
+ /**
+ * Get the invocation chain for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime invocation chain
+ */
+ InvocationChain getInvocationChain(Binding binding, Operation operation);
+
+ /**
+ * Get the invocation chain for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @param interfaceContract the client interface contract
+ * @return The runtime invocation chain
+ */
+ InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation);
+
+ /**
+ * Add a policy provider for the given binding to the service
+ * @param binding The assembly model binding
+ * @param policyProvider The policy handler
+ */
+ void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
+
+ /**
+ * Get a list of policy providers for the given binding
+ * @param binding The assembly model binding
+ * @return A list of policy providers for the given binding
+ */
+ List<PolicyProvider> getPolicyProviders(Binding binding);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
new file mode 100644
index 0000000000..da37385af1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.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.runtime;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * 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 extends Cloneable {
+
+ /**
+ * 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();
+
+ /**
+ * Rebind the runtime wire with the given target
+ * @param target The target endpoint reference
+ */
+ void setTarget(EndpointReference target);
+
+ /**
+ * Force the invocation chains to be rebuilt
+ */
+ void rebuild();
+
+ /**
+ * 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();
+
+ /**
+ * Lookup the invocation chain by operation
+ * @param operation The operation
+ * @return The invocation chain for the given operation
+ */
+ InvocationChain getInvocationChain(Operation operation);
+
+ /**
+ * Invoke an operation with given arguments
+ * @param operation The operation
+ * @param args The arguments
+ * @return The result
+ * @throws InvocationTargetException
+ */
+ Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
+
+ /**
+ * Invoke an operation with a context message
+ * @param operation The operation
+ * @param msg The message
+ * @return The result
+ * @throws InvocationTargetException
+ */
+ Object invoke(Operation operation, Message msg) throws InvocationTargetException;
+
+ /**
+ * @return a clone of the runtime wire
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java
new file mode 100644
index 0000000000..7d5cd6c54b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.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.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;
+
+ /**
+ * {@inheritDoc}
+ */
+ public DuplicateRecordException() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public DuplicateRecordException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public DuplicateRecordException(String message) {
+ super(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public DuplicateRecordException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java
new file mode 100644
index 0000000000..24eaddd3e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.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.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;
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreException() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreException(String message) {
+ super(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java
new file mode 100644
index 0000000000..4bc7facf39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 monitor 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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java
new file mode 100644
index 0000000000..c2346bddca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.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.store;
+
+/**
+ * Thrown when an error occurs reading from persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreReadException extends StoreException {
+ private static final long serialVersionUID = -8624542082121467271L;
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreReadException() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreReadException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreReadException(String message) {
+ super(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreReadException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java
new file mode 100644
index 0000000000..b37519b31c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.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.store;
+
+/**
+ * Thrown when an error occurs writing to persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreWriteException extends StoreException {
+ private static final long serialVersionUID = 5539070473942048555L;
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreWriteException() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreWriteException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreWriteException(String message) {
+ super(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public StoreWriteException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java
new file mode 100644
index 0000000000..d32af450ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.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.work;
+
+/**
+ * A callback interface that can be optionally used for registering
+ * interest in status of asynchronously scheduled unit of work.
+ *
+ * @version $Rev$ $Date$
+ */
+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 successfully 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);
+
+ /**
+ * Callback 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-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
new file mode 100644
index 0000000000..b1beac78e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.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.work;
+
+/**
+ * Defines the contract for scheduling asynchronous 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 notified with the
+ * error details.
+ * </p>
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+
+ /**
+ * Destroys the work scheduler
+ */
+ void destroy();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java
new file mode 100644
index 0000000000..18ec2dfeaa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.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.work;
+
+
+/**
+ * Exception thrown by the work scheduler in case of unexpected exceptions.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @version $Rev$ $Date$
+ */
+public class WorkSchedulerException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * {@inheritDoc}
+ */
+ public WorkSchedulerException() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public WorkSchedulerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public WorkSchedulerException(String message) {
+ super(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public WorkSchedulerException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ContextFactoryExtensionPoint b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ContextFactoryExtensionPoint
new file mode 100644
index 0000000000..ddd91bceac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ContextFactoryExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.context.DefaultContextFactoryExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint
new file mode 100644
index 0000000000..91839e998f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.endpointresolver.DefaultEndpointResolverFactoryExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint
new file mode 100644
index 0000000000..e9de1f135f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.provider.DefaultProviderFactoryExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint
new file mode 100644
index 0000000000..2f700671ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.provider.DefaultSCADefinitionsProviderExtensionPoint
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint
new file mode 100644
index 0000000000..95591dca5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.runtime.DefaultWireProcessorExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/test/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPointTestCase.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/test/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPointTestCase.java
new file mode 100644
index 0000000000..3a27569a3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/test/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPointTestCase.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.context;
+
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * This test case will test the class
+ * org.apache.tuscany.sca.context.DefaultContextFactoryExtensionPoint
+ *
+ * $Date$ $Rev$
+ */
+public class DefaultContextFactoryExtensionPointTestCase {
+
+ /**
+ * Tests adding/getting/removing a factory with no interfaces
+ */
+ @Test
+ public void testFactoryWithNoInterfaces() {
+ Object factory = new FactoryWithNoInterfaces();
+ Class<?>[] ifaces = {};
+ addGetRemoveFactory(factory, ifaces);
+ }
+
+ /**
+ * Tests adding/getting/removing a factory with one interface
+ */
+ @Test
+ public void testFactoryWithOneInterface() {
+ Object factory = new FactoryWithOneInterface();
+ Class<?>[] ifaces = { FactoryOneInterface.class };
+ addGetRemoveFactory(factory, ifaces);
+ }
+
+ /**
+ * Tests adding/getting/removing a factory with two interfaces
+ */
+ @Test
+ public void testFactoryWithTwoInterfaces() {
+ Object factory = new FactoryWithTwoInterfaces();
+ Class<?>[] ifaces = { FactoryTwoInterfacesA.class, FactoryTwoInterfacesB.class };
+ addGetRemoveFactory(factory, ifaces);
+ }
+
+ /**
+ * Tests having multiple factories registered
+ */
+ @Test
+ public void testMultipleFactories() {
+ // Create new factories
+ FactoryWithOneInterface factory1 = new FactoryWithOneInterface();
+ FactoryWithTwoInterfaces factory2 = new FactoryWithTwoInterfaces();
+
+ ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
+
+ // Register the factories
+ DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
+ ctxFactory.addFactory(factory1);
+ ctxFactory.addFactory(factory2);
+
+ // Re-get each of the factories
+ FactoryOneInterface regotFactory1 = ctxFactory.getFactory(FactoryOneInterface.class);
+ Assert.assertNotNull(regotFactory1);
+ Assert.assertSame(factory1, regotFactory1);
+ FactoryTwoInterfacesA regotFactory2A = ctxFactory.getFactory(FactoryTwoInterfacesA.class);
+ Assert.assertNotNull(regotFactory2A);
+ Assert.assertSame(factory2, regotFactory2A);
+ FactoryTwoInterfacesB regotFactory2B = ctxFactory.getFactory(FactoryTwoInterfacesB.class);
+ Assert.assertNotNull(regotFactory1);
+ Assert.assertSame(factory2, regotFactory2B);
+ }
+
+ /**
+ * Tests passing in null to addFactory()
+ */
+ @Test
+ public void testAddingNullFactory() {
+
+ ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
+ DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
+ try {
+ ctxFactory.addFactory(null);
+ Assert.fail("Should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException ex) {
+ // As expected
+ }
+ }
+
+ /**
+ * Test passing in null to removeFactory()
+ */
+ @Test
+ public void testRemovingNullFactory() {
+ ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
+ DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
+ try {
+ ctxFactory.removeFactory(null);
+ Assert.fail("Should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException ex) {
+ // As expected
+ }
+ }
+
+ /**
+ * Test passing in null to getFactory()
+ */
+ @Test
+ public void testGetNullFactory() {
+ ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
+ DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
+ try {
+ ctxFactory.getFactory(null);
+ Assert.fail("Should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException ex) {
+ // As expected
+ }
+ }
+
+ /**
+ * Utility method for testing adding and removing a factory
+ *
+ * @param factory The factory class to test
+ * @param factoryInterfaces The list of interfaces implemented by the factory
+ */
+ private void addGetRemoveFactory(Object factory, Class<?>[] factoryInterfaces) {
+ ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
+ DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
+
+ // Make sure factory not already present
+ for (Class<?> iface : factoryInterfaces) {
+ Assert.assertNull(ctxFactory.getFactory(iface));
+ }
+
+ // Add the factory
+ ctxFactory.addFactory(factory);
+
+ // Make sure we can get the factory recently registered factory
+ for (Class<?> iface : factoryInterfaces) {
+ Object regot = ctxFactory.getFactory(iface);
+ Assert.assertNotNull(regot);
+ Assert.assertSame(factory, regot);
+ }
+
+ // Remove the factory
+ ctxFactory.removeFactory(factory);
+
+ // Make sure factory is no longer registered
+ for (Class<?> iface : factoryInterfaces) {
+ Assert.assertNull(ctxFactory.getFactory(iface));
+ }
+ }
+
+ /**
+ * Simple factory with no interfaces
+ */
+ private class FactoryWithNoInterfaces {
+ }
+
+ /**
+ * Simple interface for the factory with one interface
+ */
+ private interface FactoryOneInterface {
+ }
+
+ /**
+ * Simple factory with one interface
+ */
+ private class FactoryWithOneInterface implements FactoryOneInterface {
+ }
+
+ /**
+ * Simple interface for the factory with two interfaces
+ */
+ private interface FactoryTwoInterfacesA {
+ }
+
+ /**
+ * Simple interface for the factory with two interfaces
+ */
+ private interface FactoryTwoInterfacesB {
+ }
+
+ /**
+ * Simple factory with two interfaces
+ */
+ private class FactoryWithTwoInterfaces implements FactoryTwoInterfacesA, FactoryTwoInterfacesB {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java b/sca-java-1.x/branches/sca-android/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java
new file mode 100644
index 0000000000..2425133273
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.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.event;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test case for TrueFilter
+ *
+ * @version $Rev$ $Date$
+ */
+public class TrueFilterTestCase {
+
+ /**
+ * Test TrueFilter matching an event
+ */
+ @Test
+ public void testTrueFilterMatch() {
+ EventFilter filter = new TrueFilter();
+
+ Assert.assertTrue(filter.match(new DummyEvent()));
+ }
+
+ /**
+ * Test TrueFilter matching null
+ */
+ @Test
+ public void testTrueFilterMatchNull() {
+ EventFilter filter = new TrueFilter();
+
+ Assert.assertTrue(filter.match(null));
+ }
+
+ /**
+ * Dummy Event implementation for testing
+ */
+ private class DummyEvent implements Event {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getSource() {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/LICENSE b/sca-java-1.x/branches/sca-android/modules/core/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core/META-INF/README b/sca-java-1.x/branches/sca-android/modules/core/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/core/NOTICE b/sca-java-1.x/branches/sca-android/modules/core/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/core/pom.xml b/sca-java-1.x/branches/sca-android/modules/core/pom.xml
new file mode 100644
index 0000000000..b71f001d06
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-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-extensibility</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-commonj_1.1_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.core</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.core*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java
new file mode 100644
index 0000000000..c86c876075
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/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.assembly;
+
+
+/**
+ * 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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java
new file mode 100644
index 0000000000..29dcc20f0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.assembly;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.core.context.ComponentContextHelper;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Start/stop a composite
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeActivator {
+ /**
+ * Activate a composite
+ * @param composite
+ */
+ void activate(Composite composite) throws ActivationException;
+
+ /**
+ * Activate a component reference
+ * @param component
+ * @param ref
+ */
+ void start(RuntimeComponent component, RuntimeComponentReference ref);
+
+ /**
+ * Activate a component reference
+ * @param component
+ * @param ref
+ */
+ void activate(RuntimeComponent component, RuntimeComponentReference ref);
+
+ /**
+ * Activate a component reference
+ * @param component
+ * @param ref
+ */
+ void activate(RuntimeComponent component, RuntimeComponentService service);
+
+ /**
+ * De-activate a component reference
+ * @param component
+ * @param ref
+ */
+ void deactivate(RuntimeComponent component, RuntimeComponentReference ref);
+
+ /**
+ * De-activate a component reference
+ * @param component
+ * @param ref
+ */
+ void deactivate(RuntimeComponent component, RuntimeComponentService service);
+
+ /**
+ * Stop a composite
+ * @param composite
+ */
+ void deactivate(Composite composite) throws ActivationException;
+
+ /**
+ * Start a component
+ * @param component
+ */
+ void start(Component component) throws ActivationException;
+
+ /**
+ * Stop a component
+ * @param component
+ */
+ void stop(Component component) throws ActivationException;
+
+ /**
+ * Start components in a composite
+ * @param composite
+ */
+ void start(Composite composite) throws ActivationException;
+
+ /**
+ * Stop components in a composite
+ * @param composite
+ */
+ void stop(Composite composite) throws ActivationException;
+
+ /**
+ * Get the component context helper
+ * @return
+ */
+ ComponentContextHelper getComponentContextHelper();
+
+ /**
+ * Get the proxy factory
+ * @return
+ */
+ ProxyFactory getProxyFactory();
+
+ /**
+ * Get the java interface factory
+ * @return
+ */
+ JavaInterfaceFactory getJavaInterfaceFactory();
+
+ ConversationManager getConversationManager();
+
+ /**
+ * Configure the runtime component with component context
+ * @param component
+ */
+ void configureComponentContext(RuntimeComponent component);
+
+ /**
+ * Resolve a component by URI in the domain
+ * @param componentURI
+ * @return
+ */
+ Component resolve(String componentURI);
+
+ /**
+ * Set the domain composite
+ * @param domainComposite
+ */
+ void setDomainComposite(Composite domainComposite);
+
+ /**
+ * Get the domain composite
+ * @return
+ */
+ Composite getDomainComposite();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
new file mode 100644
index 0000000000..f51931c53b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
@@ -0,0 +1,1101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.assembly;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+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.CompositeService;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.context.ComponentContextHelper;
+import org.apache.tuscany.sca.core.context.ComponentContextImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.ConversationalScopeContainer;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+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.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+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.RuntimeComponentContext;
+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.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeActivatorImpl implements CompositeActivator {
+ private static final Logger logger = Logger.getLogger(CompositeActivatorImpl.class.getName());
+
+ private final AssemblyFactory assemblyFactory;
+ private final MessageFactory messageFactory;
+ private final InterfaceContractMapper interfaceContractMapper;
+ private final ScopeRegistry scopeRegistry;
+ private final WorkScheduler workScheduler;
+ private final RuntimeWireProcessor wireProcessor;
+ private final ProviderFactoryExtensionPoint providerFactories;
+ private final EndpointResolverFactoryExtensionPoint endpointResolverFactories;
+
+ private final RequestContextFactory requestContextFactory;
+ private final ProxyFactory proxyFactory;
+ private final JavaInterfaceFactory javaInterfaceFactory;
+ private final ConversationManager conversationManager;
+
+ private final ComponentContextHelper componentContextHelper;
+
+ private Composite domainComposite;
+
+ /**
+ * @param assemblyFactory
+ * @param interfaceContractMapper
+ * @param workScheduler
+ * @param conversationManager TODO
+ * @param workContext
+ * @param wirePostProcessorRegistry
+ */
+ public CompositeActivatorImpl(AssemblyFactory assemblyFactory,
+ MessageFactory messageFactory,
+ JavaInterfaceFactory javaInterfaceFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ ScopeRegistry scopeRegistry,
+ WorkScheduler workScheduler,
+ RuntimeWireProcessor wireProcessor,
+ RequestContextFactory requestContextFactory,
+ ProxyFactory proxyFactory,
+ ProviderFactoryExtensionPoint providerFactories,
+ EndpointResolverFactoryExtensionPoint endpointResolverFactories,
+ StAXArtifactProcessorExtensionPoint processors,
+ ConversationManager conversationManager) {
+ this.assemblyFactory = assemblyFactory;
+ this.messageFactory = messageFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.scopeRegistry = scopeRegistry;
+ this.workScheduler = workScheduler;
+ this.wireProcessor = wireProcessor;
+ this.providerFactories = providerFactories;
+ this.endpointResolverFactories = endpointResolverFactories;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ this.requestContextFactory = requestContextFactory;
+ this.proxyFactory = proxyFactory;
+ this.conversationManager = conversationManager;
+ this.componentContextHelper = new ComponentContextHelper(assemblyFactory, javaInterfaceFactory, processors);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.assembly.CompositeActivator#activate(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference)
+ */
+ public void activate(RuntimeComponent component, RuntimeComponentReference ref) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Activating component reference: " + component.getURI() + "#" + ref.getName());
+ }
+ resolveTargets(ref);
+ for (Binding binding : ref.getBindings()) {
+ addReferenceBindingProvider(component, ref, binding);
+ }
+
+ for (Endpoint endpoint : ref.getEndpoints()){
+ // TODO - source component should be set in the builder but the
+ // way the builder is written it's difficult to get at it
+ endpoint.setSourceComponent(component);
+
+ addEndpointResolver(component, ref, endpoint);
+ }
+ }
+
+ public void start(RuntimeComponent component, RuntimeComponentReference ref) {
+ synchronized (ref) {
+ resolveTargets(ref);
+ for (Binding binding : ref.getBindings()) {
+ ReferenceBindingProvider provider = ref.getBindingProvider(binding);
+ if (provider == null) {
+ provider = addReferenceBindingProvider(component, ref, binding);
+ }
+ if (provider != null) {
+ provider.start();
+ }
+ addReferenceWire(component, ref, binding);
+ }
+
+ // targets now have an endpoint representation. We can use this to
+ // look for unresolved endpoints using dummy wires for late resolution
+ for (Endpoint endpoint : ref.getEndpoints()){
+ addReferenceEndpointWire(component, ref, endpoint);
+ }
+ }
+ }
+
+ public void stop(Component component, ComponentReference reference) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Stopping component reference: " + component.getURI() + "#" + reference.getName());
+ }
+ RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
+ for (Binding binding : reference.getBindings()) {
+ ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.stop();
+ }
+ }
+ }
+
+ public void deactivate(RuntimeComponent component, RuntimeComponentReference ref) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Deactivating component reference: " + component.getURI() + "#" + ref.getName());
+ }
+ removeReferenceWires(ref);
+ for (Binding binding : ref.getBindings()) {
+ removeReferenceBindingProvider(component, ref, binding);
+ }
+
+ }
+
+ /**
+ * @param component
+ * @param reference
+ * @param binding
+ */
+ private EndpointResolver addEndpointResolver(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Endpoint endpoint){
+
+ // only create endpoint resolvers for unresolved endpoints currently
+ // this will also prevent a wire from being created later
+ if (!endpoint.isUnresolved()){
+ return null;
+ }
+
+ // This souldn't happen as the endpoint resolver extension point is in core-spi but
+ // just in case returning null here will mean that no wire is created and calling
+ // the reference will fail with NPE
+ if (endpointResolverFactories == null){
+ return null;
+ }
+
+ EndpointResolverFactory<Endpoint> resolverFactory =
+ (EndpointResolverFactory<Endpoint>)endpointResolverFactories.getEndpointResolverFactory(endpoint.getClass());
+
+ if (resolverFactory != null) {
+ @SuppressWarnings("unchecked")
+ EndpointResolver endpointResolver =
+ resolverFactory.createEndpointResolver(endpoint, null);
+ if (endpointResolver != null) {
+ ((RuntimeComponentReference)reference).setEndpointResolver(endpoint, endpointResolver);
+ }
+
+ return endpointResolver;
+ } else {
+ // TODO - for the time being allow the lack of an endpoint provider to be the
+ // switch to turn off endpoint processing
+ return null;
+ //throw new IllegalStateException("Endpoint provider factory not found for class: " + endpoint.getClass().getName());
+ }
+ }
+
+ public void addReferenceBindingProviderForEndpoint(Endpoint endpoint){
+ addReferenceBindingProvider((RuntimeComponent)endpoint.getSourceComponent(),
+ (RuntimeComponentReference)endpoint.getSourceComponentReference(),
+ endpoint.getSourceBinding());
+ }
+
+ /**
+ * @param component
+ * @param reference
+ * @param binding
+ */
+ private ReferenceBindingProvider addReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ BindingProviderFactory providerFactory =
+ (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
+ if (providerFactory != null) {
+ @SuppressWarnings("unchecked")
+ ReferenceBindingProvider bindingProvider =
+ providerFactory.createReferenceBindingProvider((RuntimeComponent)component,
+ (RuntimeComponentReference)reference,
+ binding);
+ if (bindingProvider != null) {
+ ((RuntimeComponentReference)reference).setBindingProvider(binding, bindingProvider);
+ }
+ for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
+ PolicyProvider policyProvider = f.createReferencePolicyProvider(component, reference, binding);
+ if (policyProvider != null) {
+ reference.addPolicyProvider(binding, policyProvider);
+ }
+ }
+
+ return bindingProvider;
+ } else {
+ throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
+ }
+ }
+
+ /**
+ * @param reference
+ */
+ private void resolveTargets(RuntimeComponentReference reference) {
+ // The code that used to be here to resolved unresolved targets is now
+ // at the bottom of BaseWireBuilder.connectComponentReferences()
+ }
+
+ /**
+ * Create the runtime wires for a reference endpoint. Currently this method
+ * only deals with the late binding case and creates a dummy wire that
+ * will use the Endpoint to resolve the target at the point when the
+ * wire chains are created.
+ *
+ * @param component
+ * @param reference
+ * @param binding
+ */
+ private void addReferenceEndpointWire(Component component, ComponentReference reference, Endpoint endpoint) {
+ // only deal with unresolved endpoints as, to prevent breaking changes, targets that are resolved
+ // at build time are still represented as bindings in the binding list
+ if (((RuntimeComponentReference)reference).getEndpointResolver(endpoint) == null){
+ // no endpoint provider has previously been created so don't create the
+ // wire
+ return;
+ }
+
+ // TODO: TUSCANY-2580: avoid NPE if the InterfaceCOntract is null
+ Reference ctref = endpoint.getSourceComponentReference().getReference();
+ if (ctref != null && ctref.getInterfaceContract() == null) {
+ ctref.setInterfaceContract(reference.getInterfaceContract());
+ }
+
+ RuntimeWire wire = new EndpointWireImpl(endpoint, this);
+
+ RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
+ runtimeRef.getRuntimeWires().add(wire);
+ }
+
+
+ /**
+ * Create the runtime wires for a reference binding
+ *
+ * @param component
+ * @param reference
+ * @param binding
+ */
+ private void addReferenceWire(Component component, ComponentReference reference, Binding binding) {
+ if (!(reference instanceof RuntimeComponentReference)) {
+ return;
+ }
+
+ // create wire if binding has an endpoint
+ Component targetComponent = null;
+ ComponentService targetComponentService = null;
+ Binding targetBinding = null;
+
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding endpoint = (OptimizableBinding)binding;
+ targetComponent = endpoint.getTargetComponent();
+ targetComponentService = endpoint.getTargetComponentService();
+ targetBinding = endpoint.getTargetBinding();
+ // FIXME: TUSCANY-2136, For unresolved binding, don't add wire. Is it the right solution?
+ if (!reference.isCallback() && binding.getURI() == null && targetComponentService == null) {
+ return;
+ }
+ }
+
+ // create a forward wire, either static or dynamic
+ addReferenceWire(component, reference, binding, targetComponent, targetComponentService, targetBinding);
+
+ /*
+ // if static forward wire (not from self-reference), try to create a static callback wire
+ if (targetComponentService != null && !reference.getName().startsWith("$self$.")) {
+ ComponentReference callbackReference = targetComponentService.getCallbackReference();
+ if (callbackReference != null) {
+ Binding callbackBinding = null;
+ Binding callbackServiceBinding = null;
+ // select a service callback binding that can be wired back to this component
+ for (Binding refBinding : callbackReference.getBindings()) {
+ // first look for a callback binding whose name matches the target binding name
+ if (refBinding.getName().equals(targetBinding.getName())) {
+ callbackBinding = refBinding;
+ break;
+ }
+ }
+ // see if there is a matching reference callback binding
+ if (callbackBinding != null) {
+ callbackServiceBinding = reference.getCallbackService().getBinding(callbackBinding.getClass());
+ }
+ // if there isn't an end-to-end match, try again based on target binding type
+ if (callbackBinding == null || callbackServiceBinding == null) {
+ callbackBinding = callbackReference.getBinding(targetBinding.getClass());
+ if (callbackBinding != null) {
+ callbackServiceBinding = reference.getCallbackService().getBinding(callbackBinding.getClass());
+ }
+ }
+ if (callbackBinding != null && callbackServiceBinding != null) {
+ // end-to-end match, so create a static callback wire as well as the static forward wire
+
+ addReferenceWire(targetComponent, callbackReference, callbackBinding, component, reference
+ .getCallbackService(), callbackServiceBinding);
+ } else {
+ // no end-to-end match, so do not create a static callback wire
+ }
+ }
+ }
+ */
+ }
+
+ public void addReferenceWireForEndpoint(Endpoint endpoint){
+ addReferenceWire(endpoint.getSourceComponent(),
+ endpoint.getSourceComponentReference(),
+ endpoint.getSourceBinding(),
+ endpoint.getTargetComponent(),
+ endpoint.getTargetComponentService(),
+ endpoint.getTargetBinding());
+ }
+ /**
+ * Create a reference wire for a forward call or a callback
+ * @param reference
+ * @param service
+ * @param serviceBinding
+ * @param component
+ * @param referenceBinding
+ */
+ private RuntimeWire addReferenceWire(Component refComponent,
+ ComponentReference reference,
+ Binding refBinding,
+ Component serviceComponent,
+ ComponentService service,
+ Binding serviceBinding) {
+ RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
+ InterfaceContract bindingContract = getInterfaceContract(reference, refBinding);
+
+ // Use the interface contract of the reference on the component type
+ Reference componentTypeRef = reference.getReference();
+
+ InterfaceContract sourceContract;
+ if (componentTypeRef == null || componentTypeRef.getInterfaceContract() == null) {
+ sourceContract = reference.getInterfaceContract();
+ } else {
+ sourceContract = componentTypeRef.getInterfaceContract();
+ }
+
+ sourceContract = sourceContract.makeUnidirectional(false);
+
+ EndpointReference wireSource =
+ new EndpointReferenceImpl((RuntimeComponent)refComponent, reference, refBinding, sourceContract);
+ ComponentService callbackService = reference.getCallbackService();
+ if (callbackService != null) {
+ // select a reference callback binding to pass with invocations on this wire
+ Binding callbackBinding = null;
+ for (Binding binding : callbackService.getBindings()) {
+ // first look for a callback binding whose name matches the reference binding name
+ if (refBinding.getName().startsWith(binding.getName())) {
+ callbackBinding = binding;
+ break;
+ }
+ }
+ // if no callback binding found, try again based on reference binding type
+ if (callbackBinding == null) {
+ callbackBinding = callbackService.getBinding(refBinding.getClass());
+ }
+ InterfaceContract callbackContract = callbackService.getInterfaceContract();
+ EndpointReference callbackEndpoint =
+ new EndpointReferenceImpl((RuntimeComponent)refComponent, callbackService, callbackBinding,
+ callbackContract);
+ wireSource.setCallbackEndpoint(callbackEndpoint);
+ }
+
+ EndpointReference wireTarget =
+ new EndpointReferenceImpl((RuntimeComponent)serviceComponent, service, serviceBinding, bindingContract);
+
+ // TUSCANY-2029 - We should use the URI of the serviceBinding because the target may be a Component in a
+ // nested composite.
+ if (serviceBinding != null) {
+ wireTarget.setURI(serviceBinding.getURI());
+ }
+
+ RuntimeWire wire =
+ new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
+ messageFactory, conversationManager);
+ runtimeRef.getRuntimeWires().add(wire);
+
+ return wire;
+ }
+
+ private void addImplementationProvider(RuntimeComponent component, Implementation implementation) {
+ ImplementationProviderFactory providerFactory =
+ (ImplementationProviderFactory)providerFactories.getProviderFactory(implementation.getClass());
+ if (providerFactory != null) {
+ @SuppressWarnings("unchecked")
+ ImplementationProvider implementationProvider =
+ providerFactory.createImplementationProvider(component, implementation);
+ if (implementationProvider != null) {
+ component.setImplementationProvider(implementationProvider);
+ }
+ } else {
+ throw new IllegalStateException("Provider factory not found for class: " + implementation.getClass()
+ .getName());
+ }
+ for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
+ PolicyProvider policyProvider = f.createImplementationPolicyProvider(component, implementation);
+ if (policyProvider != null) {
+ component.addPolicyProvider(policyProvider);
+ }
+ }
+
+ }
+
+ private void removeImplementationProvider(RuntimeComponent component) {
+ component.setImplementationProvider(null);
+ component.getPolicyProviders().clear();
+ }
+
+ /**
+ * @param component
+ * @param service
+ * @param binding
+ */
+ private ServiceBindingProvider addServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ BindingProviderFactory providerFactory =
+ (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
+ if (providerFactory != null) {
+ @SuppressWarnings("unchecked")
+ ServiceBindingProvider bindingProvider =
+ providerFactory.createServiceBindingProvider((RuntimeComponent)component,
+ (RuntimeComponentService)service,
+ binding);
+ if (bindingProvider != null) {
+ ((RuntimeComponentService)service).setBindingProvider(binding, bindingProvider);
+ }
+ for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
+ PolicyProvider policyProvider = f.createServicePolicyProvider(component, service, binding);
+ if (policyProvider != null) {
+ service.addPolicyProvider(binding, policyProvider);
+ }
+ }
+ return bindingProvider;
+ } else {
+ throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
+ }
+ }
+
+ private void removeServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ service.setBindingProvider(binding, null);
+ for (Binding b : service.getBindings()) {
+ List<PolicyProvider> pps = service.getPolicyProviders(b);
+ if (pps != null) {
+ pps.clear();
+ }
+ }
+ }
+
+ private void removeReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ reference.setBindingProvider(binding, null);
+ for (Binding b : reference.getBindings()) {
+ List<PolicyProvider> pps = reference.getPolicyProviders(b);
+ if (pps != null) {
+ pps.clear();
+ }
+ }
+ }
+
+ public void start(Composite composite) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting composite: " + composite.getName());
+ }
+ for (Component component : composite.getComponents()) {
+ start(component);
+ }
+ }
+
+ public void stop(Composite composite) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Stopping composite: " + composite.getName());
+ }
+ for (final Component component : composite.getComponents()) {
+ stop(component);
+ }
+ }
+
+ public void start(Component component) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting component: " + component.getURI());
+ }
+ RuntimeComponent runtimeComponent = ((RuntimeComponent)component);
+ if(runtimeComponent.isStarted()) {
+ return;
+ }
+
+ configureComponentContext(runtimeComponent);
+
+ for (ComponentReference reference : component.getReferences()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
+ }
+ RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
+ runtimeRef.setComponent(runtimeComponent);
+
+ for (Endpoint endpoint : reference.getEndpoints()) {
+ final EndpointResolver endpointResolver = runtimeRef.getEndpointResolver(endpoint);
+ if (endpointResolver != null) {
+ // Allow endpoint resolvers to do any startup reference manipulation
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ endpointResolver.start();
+ return null;
+ }
+ });
+ }
+ }
+
+ for (Binding binding : reference.getBindings()) {
+ final ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
+ if (bindingProvider != null) {
+ // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ bindingProvider.start();
+ return null;
+ }
+ });
+ }
+ }
+ }
+
+ for (ComponentService service : component.getServices()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting component service: " + component.getURI() + "#" + service.getName());
+ }
+ RuntimeComponentService runtimeService = (RuntimeComponentService)service;
+ for (Binding binding : service.getBindings()) {
+ final ServiceBindingProvider bindingProvider = runtimeService.getBindingProvider(binding);
+ if (bindingProvider != null) {
+ // bindingProvider.start();
+ // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ bindingProvider.start();
+ return null;
+ }
+ });
+ }
+ }
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ start((Composite)implementation);
+ } else {
+ ImplementationProvider implementationProvider = runtimeComponent.getImplementationProvider();
+ if (implementationProvider != null) {
+ implementationProvider.start();
+ }
+ }
+
+ if (component instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
+ if (scopedRuntimeComponent.getScopeContainer() != null) {
+ scopedRuntimeComponent.getScopeContainer().start();
+ }
+ }
+
+ runtimeComponent.setStarted(true);
+ }
+
+ /**
+ * @param runtimeComponent
+ */
+ public void configureComponentContext(RuntimeComponent runtimeComponent) {
+ RuntimeComponentContext componentContext =
+ new ComponentContextImpl(this, assemblyFactory, proxyFactory, interfaceContractMapper,
+ requestContextFactory, javaInterfaceFactory, runtimeComponent);
+ runtimeComponent.setComponentContext(componentContext);
+ }
+
+ /**
+ * Stop a component
+ */
+ public void stop(Component component) {
+ if (!((RuntimeComponent)component).isStarted()) {
+ return;
+ }
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Stopping component: " + component.getURI());
+ }
+ for (ComponentService service : component.getServices()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Stopping component service: " + component.getURI() + "#" + service.getName());
+ }
+ for (Binding binding : service.getBindings()) {
+ final ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service).getBindingProvider(binding);
+ if (bindingProvider != null) {
+ // Allow bindings to read properties. Requires PropertyPermission read in security policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ bindingProvider.stop();
+ return null;
+ }
+ });
+ }
+ }
+ }
+ for (ComponentReference reference : component.getReferences()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
+ }
+ RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
+
+ for (Binding binding : reference.getBindings()) {
+ final ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
+ if (bindingProvider != null) {
+ // Allow bindings to read properties. Requires PropertyPermission read in security policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ bindingProvider.stop();
+ return null;
+ }
+ });
+ }
+ }
+
+ for (Endpoint endpoint : reference.getEndpoints()) {
+ final EndpointResolver endpointResolver = runtimeRef.getEndpointResolver(endpoint);
+ if (endpointResolver != null) {
+ // Allow endpoint resolvers to do any shutdown reference manipulation
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ endpointResolver.stop();
+ return null;
+ }
+ });
+ }
+ }
+ }
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ stop((Composite)implementation);
+ } else {
+ final ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
+ if (implementationProvider != null) {
+ // Allow bindings to read properties. Requires PropertyPermission read in security policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ implementationProvider.stop();
+ return null;
+ }
+ });
+ }
+ }
+
+ if (component instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
+ if (runtimeComponent.getScopeContainer() != null &&
+ runtimeComponent.getScopeContainer().getLifecycleState() != ScopeContainer.STOPPED) {
+ runtimeComponent.getScopeContainer().stop();
+ }
+ }
+
+ ((RuntimeComponent)component).setStarted(false);
+ }
+
+ /**
+ * 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.makeUnidirectional(false);
+ }
+
+ /**
+ * Remove the runtime wires for a reference binding
+ * @param reference
+ */
+ private void removeReferenceWires(ComponentReference reference) {
+ if (!(reference instanceof RuntimeComponentReference)) {
+ return;
+ }
+ // [rfeng] Comment out the following statements to avoid the on-demand activation
+ // RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
+ // runtimeRef.getRuntimeWires().clear();
+ }
+
+ /**
+ * 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.makeUnidirectional(false);
+ }
+
+ /**
+ * Remove runtime wires for a service binding
+ *
+ * @param component
+ * @param service
+ */
+ private void removeServiceWires(ComponentService service) {
+ if (!(service instanceof RuntimeComponentService)) {
+ return;
+ }
+ RuntimeComponentService runtimeService = (RuntimeComponentService)service;
+ runtimeService.getRuntimeWires().clear();
+ }
+
+ /**
+ * Create a service wire for a forward call or a callback
+ * @param service
+ * @param serviceBinding
+ * @param reference
+ * @param component
+ * @param referenceBinding
+ */
+ private RuntimeWire addServiceWire(Component serviceComponent, ComponentService service, Binding serviceBinding) {
+ if (!(service instanceof RuntimeComponentService)) {
+ return null;
+ }
+ RuntimeComponentService runtimeService = (RuntimeComponentService)service;
+
+ // FIXME: [rfeng] We might need a better way to get the impl interface contract
+ Service targetService = service.getService();
+ if (targetService == null) {
+ targetService = service;
+ }
+ InterfaceContract targetContract = targetService.getInterfaceContract().makeUnidirectional(false);
+
+ InterfaceContract sourceContract = getInterfaceContract(service, serviceBinding);
+
+ EndpointReference wireSource = new EndpointReferenceImpl(null, null, serviceBinding, sourceContract);
+
+ EndpointReference wireTarget =
+ new EndpointReferenceImpl((RuntimeComponent)serviceComponent, (RuntimeComponentService)service,
+ serviceBinding, targetContract);
+
+ RuntimeWire wire =
+ new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
+ messageFactory, conversationManager);
+ runtimeService.getRuntimeWires().add(wire);
+
+ return wire;
+ }
+
+ public void activate(RuntimeComponent component, RuntimeComponentService service) {
+ if (service.getService() == null) {
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("Skipping component service not defined in the component type: " + component.getURI()
+ + "#"
+ + service.getName());
+ }
+ return;
+ }
+ if (service.getService() instanceof CompositeService) {
+ return;
+ }
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Activating component service: " + component.getURI() + "#" + service.getName());
+ }
+
+ for (Binding binding : service.getBindings()) {
+ addServiceBindingProvider(component, service, binding);
+ addServiceWire(component, service, binding);
+ }
+ }
+
+ public void deactivate(RuntimeComponent component, RuntimeComponentService service) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Deactivating component service: " + component.getURI() + "#" + service.getName());
+ }
+ removeServiceWires(service);
+ for (Binding binding : service.getBindings()) {
+ removeServiceBindingProvider(component, service, binding);
+ }
+ }
+
+ private void addScopeContainer(Component component) {
+ if (!(component instanceof ScopedRuntimeComponent)) {
+ return;
+ }
+ ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
+ ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(runtimeComponent);
+ if (scopeContainer != null && scopeContainer.getScope() == Scope.CONVERSATION) {
+ conversationManager.addListener((ConversationalScopeContainer)scopeContainer);
+ }
+ runtimeComponent.setScopeContainer(scopeContainer);
+ }
+
+ private void removeScopeContainer(Component component) {
+ if (!(component instanceof ScopedRuntimeComponent)) {
+ return;
+ }
+ ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
+ ScopeContainer scopeContainer = runtimeComponent.getScopeContainer();
+ if(scopeContainer != null && scopeContainer.getScope() == Scope.CONVERSATION) {
+ conversationManager.removeListener((ConversationalScopeContainer) scopeContainer);
+ }
+ runtimeComponent.setScopeContainer(null);
+ }
+
+ public void activateComponent(Component component)
+ throws ActivationException {
+ try {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Activating component: " + component.getURI());
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ activate((Composite) implementation);
+ } else if (implementation != null) {
+ addImplementationProvider((RuntimeComponent) component,
+ implementation);
+ addScopeContainer(component);
+ }
+
+ for (ComponentService service : component.getServices()) {
+ activate((RuntimeComponent) component,
+ (RuntimeComponentService) service);
+ }
+
+ for (ComponentReference reference : component.getReferences()) {
+ activate((RuntimeComponent) component,
+ (RuntimeComponentReference) reference);
+ }
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ }
+
+ public void deactivateComponent(Component component)
+ throws ActivationException {
+ try {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Deactivating component: " + component.getURI());
+ }
+ for (ComponentService service : component.getServices()) {
+ deactivate((RuntimeComponent) component,
+ (RuntimeComponentService) service);
+ }
+
+ for (ComponentReference reference : component.getReferences()) {
+ deactivate((RuntimeComponent) component,
+ (RuntimeComponentReference) reference);
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ deactivate((Composite) implementation);
+ } else if (implementation != null) {
+ removeImplementationProvider((RuntimeComponent) component);
+ removeScopeContainer(component);
+ }
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ }
+
+ public void activate(Composite composite) throws ActivationException {
+ try {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Activating composite: " + composite.getName());
+ }
+ for (Component component : composite.getComponents()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Activating component: " + component.getURI());
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ activate((Composite)implementation);
+ } else if (implementation != null) {
+ addImplementationProvider((RuntimeComponent)component, implementation);
+ addScopeContainer(component);
+ }
+
+ for (ComponentService service : component.getServices()) {
+ activate((RuntimeComponent)component, (RuntimeComponentService)service);
+ }
+
+ for (ComponentReference reference : component.getReferences()) {
+ activate((RuntimeComponent)component, (RuntimeComponentReference)reference);
+ }
+ }
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ }
+
+ public void deactivate(Composite composite) throws ActivationException {
+ try {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Deactivating composite: " + composite.getName());
+ }
+ for (Component component : composite.getComponents()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Deactivating component: " + component.getURI());
+ }
+ for (ComponentService service : component.getServices()) {
+ deactivate((RuntimeComponent)component, (RuntimeComponentService)service);
+ }
+
+ for (ComponentReference reference : component.getReferences()) {
+ deactivate((RuntimeComponent)component, (RuntimeComponentReference)reference);
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ deactivate((Composite)implementation);
+ } else if (implementation != null) {
+ removeImplementationProvider((RuntimeComponent)component);
+ removeScopeContainer(component);
+ }
+ }
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ }
+
+ /**
+ * @return the referenceHelper
+ */
+ public ComponentContextHelper getComponentContextHelper() {
+ return componentContextHelper;
+ }
+
+ /**
+ * @return the proxyFactory
+ */
+ public ProxyFactory getProxyFactory() {
+ return proxyFactory;
+ }
+
+ /**
+ * @return the domainComposite
+ */
+ public Composite getDomainComposite() {
+ return domainComposite;
+ }
+
+ /**
+ * @param domainComposite the domainComposite to set
+ */
+ public void setDomainComposite(Composite domainComposite) {
+ this.domainComposite = domainComposite;
+ }
+
+ public Component resolve(String componentURI) {
+ for (Composite composite : domainComposite.getIncludes()) {
+ Component component = resolve(composite, componentURI);
+ if (component != null) {
+ return component;
+ }
+ }
+ return null;
+ }
+
+ public Component resolve(Composite composite, String componentURI) {
+ for (Component component : composite.getComponents()) {
+ String uri = component.getURI();
+ if (uri.equals(componentURI)) {
+ return component;
+ }
+ if (componentURI.startsWith(uri)) {
+ Implementation implementation = component.getImplementation();
+ if (!(implementation instanceof Composite)) {
+ return null;
+ }
+ return resolve((Composite)implementation, componentURI);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return the javaInterfaceFactory
+ */
+ public JavaInterfaceFactory getJavaInterfaceFactory() {
+ return javaInterfaceFactory;
+ }
+
+ /**
+ * @return the conversationManager
+ */
+ public ConversationManager getConversationManager() {
+ return conversationManager;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java
new file mode 100644
index 0000000000..78096b20ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.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.core.assembly;
+
+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.ReferenceParameters;
+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;
+ private EndpointReference callbackEndpoint;
+ private ReferenceParameters parameters = new ReferenceParametersImpl();
+
+ /**
+ * @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 = (component != null ? component.getURI() : "") + '/' +
+ (contract != null ? contract.getName() : "");
+ }
+
+ /**
+ * @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;
+ }
+
+ public EndpointReference getCallbackEndpoint() {
+ return callbackEndpoint;
+ }
+
+ public void setCallbackEndpoint(EndpointReference callbackEndpoint) {
+ this.callbackEndpoint = callbackEndpoint;
+ }
+
+ @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;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ EndpointReferenceImpl copy = (EndpointReferenceImpl)super.clone();
+ /* [nash] no need to copy callback endpoint
+ if (callbackEndpoint != null) {
+ copy.callbackEndpoint = (EndpointReference)callbackEndpoint.clone();
+ }
+ */
+ if (parameters != null) {
+ copy.parameters = (ReferenceParameters)parameters.clone();
+ }
+ return copy;
+ }
+
+ /**
+ * @return the parameters
+ */
+ public ReferenceParameters getReferenceParameters() {
+ return parameters;
+ }
+
+ /**
+ * @param parameters the parameters to set
+ */
+ public void setReferenceParameters(ReferenceParameters parameters) {
+ this.parameters = parameters;
+ }
+
+ public void mergeEndpoint(EndpointReference epr) {
+ this.component = epr.getComponent();
+ this.contract = epr.getContract();
+ this.binding = epr.getBinding();
+ this.interfaceContract = epr.getInterfaceContract();
+ this.uri = epr.getURI();
+ this.callbackEndpoint = epr.getCallbackEndpoint();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.java
new file mode 100644
index 0000000000..c25c580fe6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.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.assembly;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
+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.Message;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+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.RuntimeWire;
+import org.osoa.sca.ServiceUnavailableException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointWireImpl implements RuntimeWire {
+
+ private Endpoint endpoint;
+ private CompositeActivatorImpl compositeActivator;
+
+ private EndpointResolver endpointResolver;
+ private EndpointReference source;
+ private RuntimeWire wire;
+
+ /**
+ * @param endpoint
+ */
+ public EndpointWireImpl(Endpoint endpoint, CompositeActivator compositeActivator) {
+ super();
+ this.endpoint = endpoint;
+ // TODO - improve the SPI to get rid of this cast
+ this.compositeActivator = (CompositeActivatorImpl)compositeActivator;
+
+ // store source configuration as we have most of this now. We don't though know what the
+ // target is yet.
+ Reference componentTypeRef = endpoint.getSourceComponentReference().getReference();
+ InterfaceContract sourceContract =
+ componentTypeRef == null ? endpoint.getSourceComponentReference().getInterfaceContract() : componentTypeRef.getInterfaceContract();
+ sourceContract = sourceContract.makeUnidirectional(false);
+
+ source = new EndpointReferenceImpl((RuntimeComponent)endpoint.getSourceComponent(),
+ endpoint.getSourceComponentReference(),
+ null,
+ sourceContract);
+
+ RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)endpoint.getSourceComponentReference());
+ endpointResolver = runtimeRef.getEndpointResolver(endpoint);
+
+ }
+
+ public synchronized List<InvocationChain> getInvocationChains() {
+ // where late binding happens. Find the endpoint provider and
+ // ask it to do the endpoint resolution.
+ if (endpoint.isUnresolved()){
+
+ // this method should locate a viable target service and complete the
+ // endpoint configuration
+ endpointResolver.resolve();
+
+ if (endpoint.isUnresolved()){
+ throw new ServiceUnavailableException("Unable to resolve service for component: " +
+ endpoint.getSourceComponent().getName() +
+ " reference: " +
+ endpoint.getSourceComponentReference().getName() +
+ " target: " +
+ endpoint.getTargetName());
+ }
+ }
+
+ if (wire == null){
+ RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)endpoint.getSourceComponentReference());
+
+ // add the resolved binding into the reference
+ runtimeRef.getBindings().add(endpoint.getSourceBinding());
+
+ // add a binding provider into the reference for the resolved binding
+ compositeActivator.addReferenceBindingProviderForEndpoint(endpoint);
+
+ // extract the binding provider that has been created
+ ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(endpoint.getSourceBinding());
+
+ // start the binding provider
+ bindingProvider.start();
+
+ // create the wire
+ compositeActivator.addReferenceWireForEndpoint(endpoint);
+
+ // extract the wire that has been created
+ wire = runtimeRef.getRuntimeWire(endpoint.getSourceBinding());
+ }
+
+ return wire.getInvocationChains();
+ }
+
+ public InvocationChain getInvocationChain(Operation operation) {
+ if (wire ==null){
+ return null;
+ } else {
+ return wire.getInvocationChain(operation);
+ }
+ }
+
+ public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
+ // not called as the endpoint wire only appears on the reference side
+ return null;
+ }
+
+ public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
+ // not called as the endpoint wire only appears on the reference side
+ return null;
+ }
+
+
+ public EndpointReference getSource() {
+ return source;
+ }
+
+ public EndpointReference getTarget() {
+ return null;
+ }
+
+ public void setTarget(EndpointReference target) {
+ }
+
+ public void rebuild() {
+ }
+
+ // TODO: TUSCANY-2580: give RuntimeComponentReferenceImpl a way to get at the endpoint
+ public Endpoint getEndpoint() {
+ return endpoint;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ EndpointWireImpl copy = (EndpointWireImpl)super.clone();
+ return copy;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java
new file mode 100644
index 0000000000..c82543c4ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.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.core.assembly;
+
+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.ModelFactoryExtensionPoint;
+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.monitor.Monitor;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+
+/**
+ * Artifact processor for reference parameters.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceParameterProcessor implements StAXArtifactProcessor<ReferenceParameters> {
+ private static final QName REFERENCE_PARAMETERS =
+ new QName("http://tuscany.apache.org/xmlns/sca/1.0", "referenceParameters", "tuscany");
+
+ /**
+ * Constructs a new processor.
+ *
+ * @param modelFactories
+ */
+ public ReferenceParameterProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#getArtifactType()
+ */
+ public QName getArtifactType() {
+ return REFERENCE_PARAMETERS;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#read(javax.xml.stream.XMLStreamReader)
+ */
+ public ReferenceParameters read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ReferenceParameters parameters = new ReferenceParametersImpl();
+ parameters.setConversationID(reader.getAttributeValue(null, "conversationID"));
+ parameters.setCallbackID(reader.getAttributeValue(null, "callbackID"));
+ return parameters;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#write(java.lang.Object, javax.xml.stream.XMLStreamWriter)
+ */
+ public void write(ReferenceParameters model, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ writer.writeStartElement(REFERENCE_PARAMETERS.getPrefix(),
+ REFERENCE_PARAMETERS.getLocalPart(),
+ REFERENCE_PARAMETERS.getNamespaceURI());
+ writer.writeNamespace(REFERENCE_PARAMETERS.getPrefix(), REFERENCE_PARAMETERS.getNamespaceURI());
+ if (model.getConversationID() != null) {
+ writer.writeAttribute("conversationID", model.getConversationID().toString());
+ }
+ if (model.getCallbackID() != null) {
+ writer.writeAttribute("callbackID", model.getCallbackID().toString());
+ }
+ writer.writeEndElement();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.ArtifactProcessor#getModelType()
+ */
+ public Class<ReferenceParameters> getModelType() {
+ return ReferenceParameters.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.ArtifactProcessor#resolve(java.lang.Object, org.apache.tuscany.sca.contribution.resolver.ModelResolver)
+ */
+ public void resolve(ReferenceParameters model, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java
new file mode 100644
index 0000000000..14a5f565fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.assembly;
+
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceParametersImpl implements ReferenceParameters {
+ private Object callbackID;
+ private Object conversationID;
+ private EndpointReference callbackReference;
+ private Object callbackObjectID;
+
+ /**
+ * @return the callbackID
+ */
+ public Object getCallbackID() {
+ return callbackID;
+ }
+ /**
+ * @param callbackID the callbackID to set
+ */
+ public void setCallbackID(Object callbackID) {
+ this.callbackID = callbackID;
+ }
+ /**
+ * @return the conversationID
+ */
+ public Object getConversationID() {
+ return conversationID;
+ }
+ /**
+ * @param conversationID the conversationID to set
+ */
+ public void setConversationID(Object conversationID) {
+ this.conversationID = conversationID;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.runtime.ReferenceParameters#getCallbackReference()
+ */
+ public EndpointReference getCallbackReference() {
+ return callbackReference;
+ }
+ /**
+ * @see org.apache.tuscany.sca.runtime.ReferenceParameters#setCallback(java.lang.Object)
+ */
+ public void setCallbackReference(EndpointReference callback) {
+ this.callbackReference = callback;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ /**
+ * @return the callbackObjectID
+ */
+ public Object getCallbackObjectID() {
+ return callbackObjectID;
+ }
+ /**
+ * @param callbackObjectID the callbackObjectID to set
+ */
+ public void setCallbackObjectID(Object callbackObjectID) {
+ this.callbackObjectID = callbackObjectID;
+ }
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((callbackID == null) ? 0 : callbackID.hashCode());
+ result = prime * result + ((callbackObjectID == null) ? 0 : callbackObjectID.hashCode());
+ result = prime * result + ((callbackReference == null) ? 0 : callbackReference.hashCode());
+ result = prime * result + ((conversationID == null) ? 0 : conversationID.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 (!(obj instanceof ReferenceParametersImpl))
+ return false;
+ final ReferenceParametersImpl other = (ReferenceParametersImpl)obj;
+ if (callbackID == null) {
+ if (other.callbackID != null)
+ return false;
+ } else if (!callbackID.equals(other.callbackID))
+ return false;
+ if (callbackObjectID == null) {
+ if (other.callbackObjectID != null)
+ return false;
+ } else if (!callbackObjectID.equals(other.callbackObjectID))
+ return false;
+ if (callbackReference == null) {
+ if (other.callbackReference != null)
+ return false;
+ } else if (!callbackReference.equals(other.callbackReference))
+ return false;
+ if (conversationID == null) {
+ if (other.conversationID != null)
+ return false;
+ } else if (!conversationID.equals(other.conversationID))
+ return false;
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
new file mode 100644
index 0000000000..b174dea6ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.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.assembly;
+
+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;
+
+/**
+ * The runtime version of assembly factory
+ * @version $Rev$ $Date$
+ */
+public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements AssemblyFactory {
+
+ public RuntimeAssemblyFactory() {
+ super();
+ }
+
+ @Override
+ public Component createComponent() {
+ return new RuntimeComponentImpl();
+ }
+
+ @Override
+ public ComponentReference createComponentReference() {
+ return new RuntimeComponentReferenceImpl();
+ }
+
+ @Override
+ public ComponentService createComponentService() {
+ return new RuntimeComponentServiceImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java
new file mode 100644
index 0000000000..32ac611e54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.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.core.assembly;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.impl.ComponentImpl;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeComponentImpl extends ComponentImpl implements RuntimeComponent,
+ ScopedRuntimeComponent, ResolverExtension {
+ protected RuntimeComponentContext componentContext;
+ protected ImplementationProvider implementationProvider;
+ protected List<PolicyProvider> policyProviders = new ArrayList<PolicyProvider>();
+ protected ScopeContainer scopeContainer;
+ protected boolean started;
+ protected ModelResolver modelResolver;
+
+ /**
+ */
+ public RuntimeComponentImpl() {
+ super();
+ }
+
+ 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;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public void setStarted(boolean started) {
+ this.started = started;
+ }
+
+ /**
+ * @return the componentContext
+ */
+ public RuntimeComponentContext getComponentContext() {
+ return componentContext;
+ }
+
+ /**
+ * @param componentContext the componentContext to set
+ */
+ public void setComponentContext(RuntimeComponentContext componentContext) {
+ this.componentContext = componentContext;
+ }
+
+ public void addPolicyProvider(PolicyProvider policyProvider) {
+ policyProviders.add(policyProvider);
+ }
+
+ public List<PolicyProvider> getPolicyProviders() {
+ return policyProviders;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java
new file mode 100644
index 0000000000..b386495a08
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.assembly;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
+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.PolicyProvider;
+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;
+
+/**
+ * Implementation of a Component Reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeComponentReferenceImpl extends ComponentReferenceImpl implements RuntimeComponentReference {
+ private ArrayList<RuntimeWire> wires;
+ private HashMap<Binding, ReferenceBindingProvider> bindingProviders =
+ new HashMap<Binding, ReferenceBindingProvider>();
+ private HashMap<Endpoint, EndpointResolver> endpointResolvers =
+ new HashMap<Endpoint, EndpointResolver>();
+ private HashMap<Binding, List<PolicyProvider>> policyProviders = new HashMap<Binding, List<PolicyProvider>>();
+
+ private RuntimeComponent component;
+
+ public RuntimeComponentReferenceImpl() {
+ super();
+ }
+
+ public synchronized List<RuntimeWire> getRuntimeWires() {
+ if (wires == null) {
+ wires = new ArrayList<RuntimeWire>();
+ component.getComponentContext().start(this);
+ }
+ return wires;
+ }
+
+ public RuntimeWire getRuntimeWire(Binding binding) {
+ for (RuntimeWire wire : getRuntimeWires()) {
+ if (wire.getSource().getBinding() == binding) {
+ return wire;
+ }
+ }
+
+ // TODO: TUSCANY-2580: before returning null see if a candidate binding matches
+ for (RuntimeWire wire : getRuntimeWires()) {
+ if (wire instanceof EndpointWireImpl) {
+ Endpoint endpoint = ((EndpointWireImpl)wire).getEndpoint();
+ for (Binding b : endpoint.getCandidateBindings()) {
+ if (b == 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 EndpointResolver getEndpointResolver(Endpoint endpoint){
+ return endpointResolvers.get(endpoint);
+ }
+
+ public void setEndpointResolver(Endpoint endpoint, EndpointResolver endpointResolver){
+ endpointResolvers.put(endpoint, endpointResolver);
+ }
+
+ public Invoker getInvoker(Binding binding, Operation operation) {
+ RuntimeWire wire = getRuntimeWire(binding);
+ if (wire == null) {
+ return null;
+ }
+ InvocationChain chain = wire.getInvocationChain(operation);
+ return chain == null ? null : chain.getHeadInvoker();
+ }
+
+ /**
+ * @return the component
+ */
+ public RuntimeComponent getComponent() {
+ return component;
+ }
+
+ /**
+ * @param component the component to set
+ */
+ public void setComponent(RuntimeComponent component) {
+ this.component = component;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ RuntimeComponentReferenceImpl ref = (RuntimeComponentReferenceImpl)super.clone();
+ ref.wires = null;
+ ref.bindingProviders = new HashMap<Binding, ReferenceBindingProvider>();
+ ref.policyProviders = new HashMap<Binding, List<PolicyProvider>>();
+ return ref;
+ }
+
+ public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
+ List<PolicyProvider> providers = policyProviders.get(binding);
+ if (providers == null) {
+ providers = new ArrayList<PolicyProvider>();
+ policyProviders.put(binding, providers);
+ }
+ providers.add(policyProvider);
+ }
+
+ public List<PolicyProvider> getPolicyProviders(Binding binding) {
+ return policyProviders.get(binding);
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java
new file mode 100644
index 0000000000..af5230a163
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.assembly;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl;
+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.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Implementation of a Component Service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeComponentServiceImpl extends ComponentServiceImpl implements RuntimeComponentService {
+ private ArrayList<RuntimeWire> wires = new ArrayList<RuntimeWire>();
+ private ArrayList<RuntimeWire> callbackWires = new ArrayList<RuntimeWire>();
+ private HashMap<Binding, ServiceBindingProvider> bindingProviders = new HashMap<Binding, ServiceBindingProvider>();
+ private HashMap<Binding, List<PolicyProvider>> policyProviders = new HashMap<Binding, List<PolicyProvider>>();
+
+ public RuntimeComponentServiceImpl() {
+ super();
+ }
+
+ 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 RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract) {
+ RuntimeWire wire = getRuntimeWire(binding);
+ if (wire == null) {
+ return null;
+ }
+ if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
+ try {
+ // FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
+ wire = (RuntimeWire)wire.clone();
+ wire.getSource().setInterfaceContract(interfaceContract);
+ wire.rebuild();
+ } catch (CloneNotSupportedException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ return wire;
+ }
+
+ public List<RuntimeWire> getCallbackWires() {
+ return callbackWires;
+ }
+
+ 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) {
+ return getInvoker(binding, null, operation);
+ }
+
+ public Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation) {
+ InvocationChain chain = getInvocationChain(binding, interfaceContract, operation);
+ if (chain != null) {
+ return chain.getHeadInvoker();
+ } else {
+ return null;
+ }
+ }
+
+ public InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation) {
+ RuntimeWire wire = getRuntimeWire(binding);
+ if (wire == null) {
+ return null;
+ }
+ if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
+ try {
+ // FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
+ wire = (RuntimeWire)wire.clone();
+ wire.getSource().setInterfaceContract(interfaceContract);
+ wire.rebuild();
+ } catch (CloneNotSupportedException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+ return wire.getInvocationChain(operation);
+ }
+
+ public InvocationChain getInvocationChain(Binding binding, Operation operation) {
+ return getInvocationChain(binding, null, operation);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl#clone()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ RuntimeComponentServiceImpl clone = (RuntimeComponentServiceImpl)super.clone();
+ clone.bindingProviders = (HashMap<Binding, ServiceBindingProvider>)bindingProviders.clone();
+ clone.wires = (ArrayList<RuntimeWire>)wires.clone();
+ clone.callbackWires = (ArrayList<RuntimeWire>)callbackWires.clone();
+ clone.policyProviders = (HashMap<Binding, List<PolicyProvider>>)policyProviders.clone();
+ return clone;
+ }
+
+ public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
+ List<PolicyProvider> providers = policyProviders.get(binding);
+ if (providers == null) {
+ providers = new ArrayList<PolicyProvider>();
+ policyProviders.put(binding, providers);
+ }
+ providers.add(policyProvider);
+ }
+
+ public List<PolicyProvider> getPolicyProviders(Binding binding) {
+ return policyProviders.get(binding);
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
new file mode 100644
index 0000000000..58109fd86b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
@@ -0,0 +1,378 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.assembly;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+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.Contract;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
+import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor;
+import org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker;
+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.Interceptor;
+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.invocation.Phase;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+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.work.WorkScheduler;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeWireImpl implements RuntimeWire {
+ private EndpointReference wireSource;
+ private EndpointReference wireTarget;
+
+ private transient RuntimeWireProcessor wireProcessor;
+ private transient InterfaceContractMapper interfaceContractMapper;
+ private transient WorkScheduler workScheduler;
+ private transient MessageFactory messageFactory;
+ private transient ConversationManager conversationManager;
+ private transient RuntimeWireInvoker invoker;
+
+ // the following is a very simple cache that avoids re-cloning a wire
+ // when consecutive callbacks to the same endpoint are made
+ private EndpointReference lastCallback;
+ private RuntimeWire cachedWire;
+ private boolean wireReserved;
+ private RuntimeWireImpl clonedFrom;
+
+ private List<InvocationChain> chains;
+
+ /**
+ * @param source
+ * @param target
+ * @param interfaceContractMapper
+ * @param workScheduler
+ * @param wireProcessor
+ * @param messageFactory
+ * @param conversationManager
+ */
+ public RuntimeWireImpl(EndpointReference source,
+ EndpointReference target,
+ InterfaceContractMapper interfaceContractMapper,
+ WorkScheduler workScheduler,
+ RuntimeWireProcessor wireProcessor,
+ MessageFactory messageFactory,
+ ConversationManager conversationManager) {
+ super();
+ this.wireSource = source;
+ this.wireTarget = target;
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.workScheduler = workScheduler;
+ this.wireProcessor = wireProcessor;
+ this.messageFactory = messageFactory;
+ this.conversationManager = conversationManager;
+ this.invoker = new RuntimeWireInvoker(this.messageFactory, this.conversationManager, this);
+ }
+
+ public synchronized List<InvocationChain> getInvocationChains() {
+ if (chains == null) {
+ initInvocationChains();
+ }
+ return chains;
+ }
+
+ public InvocationChain getInvocationChain(Operation operation) {
+ for (InvocationChain chain : getInvocationChains()) {
+ Operation op = null;
+ if (wireSource.getContract() != null) {
+ // Reference chain
+ op = chain.getSourceOperation();
+ } else {
+ // Service chain
+ op = chain.getTargetOperation();
+ }
+ if (interfaceContractMapper.isCompatible(operation, op, op.getInterface().isRemotable())) {
+ return chain;
+ }
+ }
+ return null;
+ }
+
+ public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
+ Message msg = messageFactory.createMessage();
+ msg.setBody(args);
+ return invoker.invoke(operation, msg);
+ }
+
+ public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
+ return invoker.invoke(operation, msg);
+ }
+
+ /**
+ * Initialize the invocation chains
+ */
+ private void initInvocationChains() {
+ chains = new ArrayList<InvocationChain>();
+ InterfaceContract sourceContract = wireSource.getInterfaceContract();
+ InterfaceContract targetContract = wireTarget.getInterfaceContract();
+
+ Contract source = wireSource.getContract();
+ if (source instanceof RuntimeComponentReference) {
+ // It's the reference wire
+ RuntimeComponentReference reference = (RuntimeComponentReference)wireSource.getContract();
+ Binding refBinding = wireSource.getBinding();
+ for (Operation operation : sourceContract.getInterface().getOperations()) {
+ Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
+ if (targetOperation == null) {
+ throw new ServiceRuntimeException("No matching operation for " + operation.getName()
+ + " is found in reference "
+ + wireSource.getComponent().getURI()
+ + "#"
+ + reference.getName());
+ }
+ InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true);
+ if (operation.isNonBlocking()) {
+ addNonBlockingInterceptor(reference, refBinding, chain);
+ }
+ addReferenceBindingInterceptor(reference, refBinding, chain, operation);
+ chains.add(chain);
+ }
+ } else {
+ // It's the service wire
+ RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
+ RuntimeComponent serviceComponent = wireTarget.getComponent();
+ Binding serviceBinding = wireTarget.getBinding();
+ for (Operation operation : sourceContract.getInterface().getOperations()) {
+ Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
+ if (targetOperation == null) {
+ throw new ServiceRuntimeException("No matching operation for " + operation.getName()
+ + " is found in service "
+ + serviceComponent.getURI()
+ + "#"
+ + service.getName());
+ }
+ InvocationChain chain = new InvocationChainImpl(operation, targetOperation, false);
+ if (operation.isNonBlocking()) {
+ addNonBlockingInterceptor(service, serviceBinding, chain);
+ }
+ addServiceBindingInterceptor(service, serviceBinding, chain, operation);
+ addImplementationInterceptor(serviceComponent, service, chain, targetOperation);
+ chains.add(chain);
+ }
+ }
+ wireProcessor.process(this);
+ }
+
+ public EndpointReference getSource() {
+ return wireSource;
+ }
+
+ public EndpointReference getTarget() {
+ return wireTarget;
+ }
+
+ public void setTarget(EndpointReference target) {
+ if (this.wireTarget != target) {
+ rebuild();
+ }
+ this.wireTarget = target;
+ }
+
+ public void rebuild() {
+ this.chains = null;
+ }
+
+ /**
+ * Add the interceptor for a reference binding
+ *
+ * @param reference
+ * @param binding
+ * @param chain
+ * @param operation
+ */
+ private void addReferenceBindingInterceptor(ComponentReference reference,
+ Binding binding,
+ InvocationChain chain,
+ Operation operation) {
+ ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
+ if (provider != null) {
+ Invoker invoker = provider.createInvoker(operation);
+ if (invoker != null) {
+ chain.addInvoker(invoker);
+ }
+ }
+ List<PolicyProvider> pps = ((RuntimeComponentReference)reference).getPolicyProviders(binding);
+ if (pps != null) {
+ for (PolicyProvider p : pps) {
+ Interceptor interceptor = p.createInterceptor(operation);
+ if (interceptor != null) {
+ chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
+ }
+ }
+ }
+ }
+
+ /**
+ * Add the interceptor for a binding
+ *
+ * @param reference
+ * @param binding
+ * @param chain
+ * @param operation
+ */
+ private void addServiceBindingInterceptor(ComponentService service,
+ Binding binding,
+ InvocationChain chain,
+ Operation operation) {
+ List<PolicyProvider> pps = ((RuntimeComponentService)service).getPolicyProviders(binding);
+ if (pps != null) {
+ for (PolicyProvider p : pps) {
+ Interceptor interceptor = p.createInterceptor(operation);
+ if (interceptor != null) {
+ chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
+ }
+ }
+ }
+ }
+
+ /**
+ * Add a non-blocking interceptor if the reference binding needs it
+ *
+ * @param reference
+ * @param binding
+ * @param chain
+ */
+ private void addNonBlockingInterceptor(ComponentReference reference, Binding binding, InvocationChain chain) {
+ ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
+ if (provider != null) {
+ boolean supportsOneWayInvocation = provider.supportsOneWayInvocation();
+ if (!supportsOneWayInvocation) {
+ chain.addInterceptor(Phase.REFERENCE, new NonBlockingInterceptor(workScheduler));
+ }
+ }
+ }
+
+ /**
+ * Add a non-blocking interceptor if the service binding needs it
+ *
+ * @param service
+ * @param binding
+ * @param chain
+ */
+ private void addNonBlockingInterceptor(ComponentService service, Binding binding, InvocationChain chain) {
+ ServiceBindingProvider provider = ((RuntimeComponentService)service).getBindingProvider(binding);
+ if (provider != null) {
+ if (!provider.supportsOneWayInvocation()) {
+ chain.addInterceptor(Phase.SERVICE, new NonBlockingInterceptor(workScheduler));
+ }
+ }
+ }
+
+ /**
+ * Add the interceptor for a component implementation
+ *
+ * @param component
+ * @param service
+ * @param chain
+ * @param operation
+ */
+ private void addImplementationInterceptor(Component component,
+ ComponentService service,
+ InvocationChain chain,
+ Operation operation) {
+ ImplementationProvider provider = ((RuntimeComponent)component).getImplementationProvider();
+ if (provider != null) {
+ Invoker invoker = null;
+ invoker = provider.createInvoker((RuntimeComponentService)service, operation);
+ chain.addInvoker(invoker);
+ }
+ List<PolicyProvider> pps = ((RuntimeComponent)component).getPolicyProviders();
+ if (pps != null) {
+ for (PolicyProvider p : pps) {
+ Interceptor interceptor = p.createInterceptor(operation);
+ if (interceptor != null) {
+ chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
+ }
+ }
+ }
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ RuntimeWireImpl copy = (RuntimeWireImpl)super.clone();
+ copy.wireSource = (EndpointReference)wireSource.clone();
+ copy.wireTarget = (EndpointReference)wireTarget.clone();
+ copy.invoker = new RuntimeWireInvoker(copy.messageFactory, copy.conversationManager, copy);
+ return copy;
+ }
+
+ /**
+ * @return the conversationManager
+ */
+ public ConversationManager getConversationManager() {
+ return conversationManager;
+ }
+
+ public synchronized RuntimeWire lookupCache(EndpointReference callback) {
+ if (lastCallback != null && callback.getURI().equals(lastCallback.getURI()) && !wireReserved) {
+ wireReserved = true;
+ return cachedWire;
+ } else {
+ return null;
+ }
+ }
+
+ public synchronized void addToCache(EndpointReference callback, RuntimeWire clonedWire) {
+ ((RuntimeWireImpl)clonedWire).setClonedFrom(this);
+ lastCallback = callback;
+ cachedWire = clonedWire;
+ wireReserved = true;
+ }
+
+ public synchronized void releaseClonedWire(RuntimeWire wire) {
+ if (cachedWire == wire) {
+ wireReserved = false;
+ }
+ }
+
+ public synchronized void releaseWire() {
+ clonedFrom.releaseClonedWire(this);
+ }
+
+ private void setClonedFrom(RuntimeWireImpl wire) {
+ clonedFrom = wire;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
new file mode 100644
index 0000000000..fc6d7abf6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
@@ -0,0 +1,605 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.context;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.UUID;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+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.builder.BindingBuilderExtension;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.core.assembly.EndpointWireImpl;
+import org.apache.tuscany.sca.core.assembly.ReferenceParametersImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+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.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.Conversation;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Base class for implementations of service and callback references.
+ *
+ * @version $Rev$ $Date$
+ * @param <B> the type of the business interface
+ */
+public class CallableReferenceImpl<B> implements CallableReference<B>, Externalizable {
+ static final long serialVersionUID = -521548304761848325L;
+ protected transient CompositeActivator compositeActivator;
+ protected transient ProxyFactory proxyFactory;
+ protected transient Class<B> businessInterface;
+ protected transient Object proxy;
+
+ // if the wire targets a conversational service this holds the conversation state
+ protected transient ConversationManager conversationManager;
+ protected transient ExtendedConversation conversation;
+ protected transient Object conversationID;
+ protected Object callbackID; // The callbackID should be serializable
+
+ protected transient RuntimeComponent component;
+ protected transient RuntimeComponentReference reference;
+ protected transient Binding binding;
+
+ protected String scdl;
+
+ private transient RuntimeComponentReference clonedRef;
+ private transient ReferenceParameters refParams;
+ private transient XMLStreamReader xmlReader;
+
+ private transient RuntimeWire endpointWire;
+
+ /*
+ * Public constructor for Externalizable serialization/deserialization
+ */
+ public CallableReferenceImpl() {
+ super();
+ }
+
+ /*
+ * Public constructor for use by XMLStreamReader2CallableReference
+ */
+ public CallableReferenceImpl(XMLStreamReader xmlReader) throws Exception {
+ this.xmlReader = xmlReader;
+ resolve();
+ }
+
+ protected CallableReferenceImpl(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding,
+ ProxyFactory proxyFactory,
+ CompositeActivator compositeActivator) {
+ this.proxyFactory = proxyFactory;
+ this.businessInterface = businessInterface;
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding;
+ // FIXME: The SCA Specification is not clear how we should handle multiplicity
+ // for CallableReference
+ if (this.binding == null) {
+ this.binding = this.reference.getBinding(SCABinding.class);
+ if (this.binding == null) {
+
+ // TODO: TUSCANY-2580: if the refernece doesn't have a binding yet then instead of NPE use a candidate one if its avaialable
+ if (reference.getBindings() != null && reference.getBindings().size() > 0) {
+ this.binding = this.reference.getBindings().get(0);
+ } else {
+ this.binding = this.reference.getEndpoints().get(0).getCandidateBindings().get(0);
+ if (this.reference.getEndpoints().get(0).getInterfaceContract() == null) {
+ this.reference.getEndpoints().get(0).setInterfaceContract(reference.getInterfaceContract());
+ }
+ }
+ }
+ }
+
+ // FIXME: Should we normalize the componentName/serviceName URI into an absolute SCA URI in the SCA binding?
+ // sca:component1/component11/component112/service1?
+ this.compositeActivator = compositeActivator;
+ this.conversationManager = this.compositeActivator.getConversationManager();
+ initCallbackID();
+ }
+
+ public CallableReferenceImpl(Class<B> businessInterface, RuntimeWire wire, ProxyFactory proxyFactory) {
+ this.proxyFactory = proxyFactory;
+ this.businessInterface = businessInterface;
+ bind(wire);
+ }
+
+ public RuntimeWire getRuntimeWire() {
+ try {
+ resolve();
+ if (endpointWire != null){
+ return endpointWire;
+ } else if (reference != null) {
+ return reference.getRuntimeWire(binding);
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ protected void bind(RuntimeWire wire) {
+ if (wire != null) {
+
+ if (wire instanceof EndpointWireImpl){
+ endpointWire = wire;
+ }
+ this.component = wire.getSource().getComponent();
+ this.reference = (RuntimeComponentReference)wire.getSource().getContract();
+ this.binding = wire.getSource().getBinding();
+ this.compositeActivator = ((ComponentContextImpl)component.getComponentContext()).getCompositeActivator();
+ this.conversationManager = this.compositeActivator.getConversationManager();
+ initCallbackID();
+ }
+ }
+
+ protected void initCallbackID() {
+ if (reference.getInterfaceContract() != null) {
+ if (reference.getInterfaceContract().getCallbackInterface() != null) {
+ this.callbackID = createCallbackID();
+ }
+ }
+ }
+
+ public B getProxy() throws ObjectCreationException {
+ try {
+ if (proxy == null) {
+ proxy = createProxy();
+ }
+ return businessInterface.cast(proxy);
+ } catch (Exception e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+ public void setProxy(Object proxy) {
+ this.proxy = proxy;
+ }
+
+ protected Object createProxy() throws Exception {
+ return proxyFactory.createProxy(this);
+ }
+
+ public B getService() {
+ try {
+ resolve();
+ return getProxy();
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Class<B> getBusinessInterface() {
+ try {
+ resolve();
+ return businessInterface;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public boolean isConversational() {
+ try {
+ resolve();
+ return reference == null ? false : reference.getInterfaceContract().getInterface().isConversational();
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Conversation getConversation() {
+ try {
+ // resolve from XML just in case this CallableReference is the result of
+ // passing a CallableReference as a parameter
+ resolve();
+
+ if (conversation == null || conversation.getState() == ConversationState.ENDED) {
+ conversation = null;
+ }
+ return conversation;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Object getCallbackID() {
+ try {
+ resolve();
+ return callbackID;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ final boolean hasSCDL = in.readBoolean();
+ if (hasSCDL) {
+ this.scdl = in.readUTF();
+ } else {
+ this.scdl = null;
+ }
+ }
+
+ /**
+ * @throws IOException
+ */
+ private synchronized void resolve() throws Exception {
+ if ((scdl != null || xmlReader != null) && component == null && reference == null) {
+ ComponentContextHelper componentContextHelper = ComponentContextHelper.getCurrentComponentContextHelper();
+ if (componentContextHelper != null) {
+ this.compositeActivator = ComponentContextHelper.getCurrentCompositeActivator();
+ this.conversationManager = this.compositeActivator.getConversationManager();
+ Component c;
+ if (xmlReader != null) {
+ c = componentContextHelper.fromXML(xmlReader);
+ xmlReader = null; // OK to GC this now
+ } else {
+ c = componentContextHelper.fromXML(scdl);
+ scdl = null; // OK to GC this now
+ }
+ this.component = (RuntimeComponent)c;
+ compositeActivator.configureComponentContext(this.component);
+ this.reference = (RuntimeComponentReference)c.getReferences().get(0);
+ this.reference.setComponent(this.component);
+ clonedRef = reference;
+ ReferenceParameters parameters = null;
+ for (Object ext : reference.getExtensions()) {
+ if (ext instanceof ReferenceParameters) {
+ parameters = (ReferenceParameters)ext;
+ break;
+ }
+ }
+ if (parameters != null) {
+ refParams = parameters;
+ this.callbackID = parameters.getCallbackID();
+ attachConversation(parameters.getConversationID());
+ }
+
+ for (Binding binding : reference.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ // Resolve the Component
+ final String bindingURI = binding.getURI();
+ final Component targetComponent = resolveComponentURI(bindingURI);
+
+ // Find the Service
+ ComponentService targetService = resolveServiceURI(bindingURI, targetComponent);
+
+ // if the target service is a promoted service then find the
+ // service it promotes
+ if ((targetService != null) && (targetService.getService() instanceof CompositeService)) {
+ CompositeService compositeService = (CompositeService) targetService.getService();
+ // Find the promoted component service
+ ComponentService promotedComponentService = getPromotedComponentService(compositeService);
+ if (promotedComponentService != null && !promotedComponentService.isUnresolved()) {
+ targetService = promotedComponentService;
+ }
+ }
+
+ OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
+ optimizableBinding.setTargetComponent(targetComponent);
+ optimizableBinding.setTargetComponentService(targetService);
+ if (targetService != null) {
+ for (Binding serviceBinding : targetService.getBindings()) {
+ if (serviceBinding.getClass() == binding.getClass()) {
+ optimizableBinding.setTargetBinding(serviceBinding);
+ break;
+ }
+ }
+ }
+ }
+ }
+ // FIXME: The SCA Specification is not clear how we should handle multiplicity
+ // for CallableReference
+ if (binding == null) {
+ binding = reference.getBinding(SCABinding.class);
+ if (binding == null) {
+ binding = reference.getBindings().get(0);
+ }
+ }
+ Interface i = reference.getInterfaceContract().getInterface();
+ if (i instanceof JavaInterface) {
+ JavaInterface javaInterface = (JavaInterface)i;
+ if (javaInterface.isUnresolved()) {
+ // Allow privileged access to get ClassLoader. Requires RuntimePermission in
+ // security policy.
+ ClassLoader classLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ javaInterface.setJavaClass(classLoader.loadClass(javaInterface.getName()));
+ compositeActivator.getJavaInterfaceFactory().createJavaInterface(javaInterface,
+ javaInterface.getJavaClass());
+ //FIXME: If the interface needs XSDs to be loaded (e.g., for static SDO),
+ // this needs to be done here. We usually search for XSDs in the current
+ // contribution at resolve time. Is it possible to locate the current
+ // contribution at runtime?
+ }
+ this.businessInterface = (Class<B>)javaInterface.getJavaClass();
+ }
+ if (binding instanceof BindingBuilderExtension) {
+ ((BindingBuilderExtension)binding).getBuilder().build(component, reference, binding, null);
+ }
+ this.proxyFactory = compositeActivator.getProxyFactory();
+ }
+ } else {
+ this.compositeActivator = ComponentContextHelper.getCurrentCompositeActivator();
+ if (this.compositeActivator != null) {
+ this.proxyFactory = this.compositeActivator.getProxyFactory();
+ }
+ }
+ }
+
+ /**
+ * 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;
+ }
+ }
+
+ /**
+ * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+ */
+ public void writeExternal(ObjectOutput out) throws IOException {
+ try {
+ final String xml = toXMLString();
+ if (xml == null) {
+ out.writeBoolean(false);
+ } else {
+ out.writeBoolean(true);
+ out.writeUTF(xml);
+ }
+ } catch (Exception e) {
+ // e.printStackTrace();
+ throw new IOException(e.toString());
+ }
+ }
+
+ public String toXMLString() throws IOException {
+ if (reference != null) {
+ if (clonedRef == null) {
+ try {
+ clonedRef = (RuntimeComponentReference)reference.clone();
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ }
+ if (refParams == null) {
+ refParams = new ReferenceParametersImpl();
+
+ // remove any existing reference parameters from the clone
+ Object toRemove = null;
+ for (Object extension : clonedRef.getExtensions()){
+ if (extension instanceof ReferenceParameters){
+ toRemove = extension;
+ }
+ }
+
+ if (toRemove != null){
+ clonedRef.getExtensions().remove(toRemove);
+ }
+
+ // add the new reference parameter object
+ clonedRef.getExtensions().add(refParams);
+ }
+ refParams.setCallbackID(callbackID);
+ if (conversation != null){
+ refParams.setConversationID(conversation.getConversationID());
+ }
+ return ((CompositeActivatorImpl)compositeActivator).getComponentContextHelper()
+ .toXML(component, clonedRef);
+ } else {
+ return scdl;
+ }
+ }
+
+ /**
+ * Create a callback id
+ *
+ * @return the callback id
+ */
+ private String createCallbackID() {
+ return UUID.randomUUID().toString();
+ }
+
+ public void attachCallbackID(Object callbackID) {
+ this.callbackID = callbackID;
+ }
+
+ public void attachConversationID(Object conversationID) {
+ this.conversationID = conversationID;
+ }
+
+ public void attachConversation(ExtendedConversation conversation) {
+ this.conversation = conversation;
+ }
+
+ public void attachConversation(Object conversationID) {
+ if (conversationID != null) {
+ ExtendedConversation conversation = conversationManager.getConversation(conversationID);
+ if (conversation == null){
+ conversation = conversationManager.startConversation(conversationID);
+ }
+ this.conversation = conversation;
+ } else {
+ this.conversation = null;
+ }
+ }
+
+ protected ReferenceParameters getReferenceParameters() {
+ ReferenceParameters parameters = new ReferenceParametersImpl();
+ parameters.setCallbackID(callbackID);
+ if (getConversation() != null) {
+ parameters.setConversationID(conversation.getConversationID());
+ }
+ return parameters;
+ }
+
+ public EndpointReference getEndpointReference() {
+ try {
+ resolve();
+
+ // Use the interface contract of the reference on the component type
+ Reference componentTypeRef = reference.getReference();
+ InterfaceContract sourceContract =
+ componentTypeRef == null ? reference.getInterfaceContract() : componentTypeRef.getInterfaceContract();
+ sourceContract = sourceContract.makeUnidirectional(false);
+ EndpointReference epr = new EndpointReferenceImpl(component, reference, binding, sourceContract);
+ ReferenceParameters parameters = getReferenceParameters();
+ epr.setReferenceParameters(parameters);
+ return epr;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public XMLStreamReader getXMLReader() {
+ return xmlReader;
+ }
+
+ /**
+ * Resolves the specified URI to a Component using the compositeActivator.
+ * There are two cases that we need to handle:
+ * <ul>
+ * <li>URI containing just Composite name(s) (i.e. no Service name specified)
+ * <li>URI containing Composite name(s) and a Service Name
+ * </ul>
+ *
+ * @param componentURI The URI of the Component to resolve
+ * @return The Component for the specified URI or null if not founds
+ */
+ protected Component resolveComponentURI(String componentURI) {
+ // If the URI has come from a binding, it may well start with a '/'. We will need
+ // to remove this so we can match it to the composite names.
+ if (componentURI.startsWith("/")) {
+ componentURI = componentURI.substring(1);
+ }
+
+ // First assume that we are dealing with a Component URI without a Service Name
+ Component component = compositeActivator.resolve(componentURI);
+ if (component != null) {
+ return component;
+ }
+
+ // Perhaps we have a ComponentURI that has a ServiceName on the end of it
+ final int index = componentURI.lastIndexOf('/');
+ if (index > -1) {
+ componentURI = componentURI.substring(0, index);
+ return compositeActivator.resolve(componentURI);
+ }
+
+ // We could not resolve the Component URI
+ return null;
+ }
+
+ /**
+ * Examines the Services on the specified Component and returns the Service that matches the
+ * specified Binding URI.
+ *
+ * @param bindingURI The Binding URI to resolve on the Component
+ * @param targetComponent The Component containing the Services
+ * @return The Service with the specified serviceName or null if no such Service found.
+ */
+ protected ComponentService resolveServiceURI(String bindingURI, Component targetComponent) {
+
+ ComponentService targetService = null;
+
+ if (targetComponent != null) {
+ if (bindingURI.startsWith("/")) {
+ bindingURI = bindingURI.substring(1);
+ }
+
+ final String componentURI = targetComponent.getURI();
+ final String serviceName;
+ if (componentURI.equals(bindingURI)) {
+ // No service specified
+ serviceName = "";
+ } else {
+ // Get the Service name from the Binding URI
+ serviceName = bindingURI.substring(componentURI.length() + 1);
+ }
+
+ if ("".equals(serviceName)) {
+ targetService = ComponentContextHelper.getSingleService(targetComponent);
+ } else {
+ for (ComponentService service : targetComponent.getServices()) {
+ if (service.getName().equals(serviceName)) {
+ targetService = service;
+ break;
+ }
+ }
+ }
+ }
+
+ return targetService;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java
new file mode 100644
index 0000000000..78b0887482
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java
@@ -0,0 +1,320 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.context;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+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.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.Multiplicity;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+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.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+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.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.Message;
+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.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentContextHelper {
+
+ private final AssemblyFactory assemblyFactory;
+ private final JavaInterfaceFactory javaInterfaceFactory;
+ private final StAXArtifactProcessorExtensionPoint staxProcessors;
+
+ /**
+ * @param assemblyFactory The factory to create assembly models
+ * @param processors The extension point for StAX artifact processors
+ */
+ public ComponentContextHelper(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaInterfaceFactory,
+ StAXArtifactProcessorExtensionPoint processors) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ this.staxProcessors = processors;
+ }
+
+ /**
+ * Create a self-reference for a component service
+ * @param component
+ * @param service
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ public ComponentReference createSelfReference(Component component,
+ ComponentService service,
+ Class<?> businessInterface) throws CloneNotSupportedException,
+ InvalidInterfaceException {
+ ComponentReference componentReference = assemblyFactory.createComponentReference();
+ componentReference.setName("$self$." + service.getName());
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ componentReference.getBindings().add(optimizableBinding);
+ } else {
+ componentReference.getBindings().add(binding);
+ }
+ }
+
+ componentReference.setCallback(service.getCallback());
+ componentReference.getTargets().add(service);
+ componentReference.getPolicySets().addAll(service.getPolicySets());
+ componentReference.getRequiredIntents().addAll(service.getRequiredIntents());
+
+ InterfaceContract interfaceContract = service.getInterfaceContract();
+ Service componentTypeService = service.getService();
+ if (componentTypeService != null && componentTypeService.getInterfaceContract() != null) {
+ interfaceContract = componentTypeService.getInterfaceContract();
+ }
+ interfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ componentReference.setInterfaceContract(interfaceContract);
+ componentReference.setMultiplicity(Multiplicity.ONE_ONE);
+ // component.getReferences().add(componentReference);
+ return componentReference;
+ }
+
+ /**
+ * @param interfaceContract
+ * @param businessInterface
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ private InterfaceContract getInterfaceContract(InterfaceContract interfaceContract, Class<?> businessInterface)
+ throws CloneNotSupportedException, InvalidInterfaceException {
+ Interface interfaze = interfaceContract.getInterface();
+ boolean compatible = false;
+ if (interfaze instanceof JavaInterface) {
+ Class<?> cls = ((JavaInterface)interfaze).getJavaClass();
+ if (businessInterface.isAssignableFrom(cls)) {
+ compatible = true;
+ }
+ }
+ if (!compatible) {
+ // The interface is not assignable from the interface contract
+ interfaceContract = (InterfaceContract)interfaceContract.clone();
+ interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+ }
+
+ return interfaceContract;
+ }
+
+ /**
+ * Bind a component reference to a component service
+ * @param <B>
+ * @param businessInterface
+ * @param reference
+ * @param service
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ public RuntimeComponentReference bindComponentReference(Class<?> businessInterface,
+ RuntimeComponentReference reference,
+ RuntimeComponent component,
+ RuntimeComponentService service)
+ throws CloneNotSupportedException, InvalidInterfaceException {
+ RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ Reference componentTypeReference = reference.getReference();
+ if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
+ interfaceContract = componentTypeReference.getInterfaceContract();
+ }
+ InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ if (refInterfaceContract != interfaceContract) {
+ ref = (RuntimeComponentReference)reference.clone();
+ ref.setInterfaceContract(interfaceContract);
+ }
+ ref.setComponent(component);
+ ref.getTargets().add(service);
+ ref.getBindings().clear();
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ ref.getBindings().add(optimizableBinding);
+ } else {
+ ref.getBindings().add(binding);
+ }
+ }
+ return ref;
+ }
+
+ public void write(Component component, ComponentReference reference, Writer writer) throws IOException {
+ write(component, reference, null, writer);
+ }
+
+ public void write(Component component, ComponentReference reference, ComponentService service, Writer writer) throws IOException {
+ try {
+ StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(new QName("http://tuscany.apache.org/xmlns/sca/1.0", "default"));
+ Component comp = assemblyFactory.createComponent();
+ comp.setName("default");
+ comp.setURI(component.getURI());
+ composite.getComponents().add(comp);
+ if (reference != null) {
+ comp.getReferences().add(reference);
+ }
+ if (service != null) {
+ comp.getServices().add(service);
+ }
+
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
+ processor.write(composite, streamWriter);
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ public String toXML(Component component, ComponentReference reference) throws IOException {
+ StringWriter writer = new StringWriter();
+ write(component, reference, writer);
+ return writer.toString();
+ }
+
+ public String toXML(Component component, ComponentService service) throws IOException {
+ StringWriter writer = new StringWriter();
+ write(component, null, service, writer);
+ return writer.toString();
+ }
+
+ public RuntimeComponent read(Reader reader) throws IOException {
+ try {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ XMLStreamReader streamReader = inputFactory.createXMLStreamReader(reader);
+ return read(streamReader);
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ public RuntimeComponent read(XMLStreamReader streamReader) throws IOException {
+ try {
+ StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
+ Composite composite = processor.read(streamReader);
+ RuntimeComponent component = (RuntimeComponent)composite.getComponents().get(0);
+ return component;
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ public Component fromXML(String xml) throws IOException {
+ return read(new StringReader(xml));
+ }
+
+ public Component fromXML(XMLStreamReader streamReader) throws IOException {
+ return read(streamReader);
+ }
+
+ public static RuntimeComponent getCurrentComponent() {
+ Message message = ThreadMessageContext.getMessageContext();
+ if (message != null) {
+ EndpointReference to = message.getTo();
+ if (to == null) {
+ return null;
+ }
+ RuntimeComponent component = message.getTo().getComponent();
+ return component;
+ }
+ return null;
+ }
+
+ public static CompositeActivator getCurrentCompositeActivator() {
+ RuntimeComponent component = getCurrentComponent();
+ if (component != null) {
+ ComponentContextImpl context = (ComponentContextImpl)component.getComponentContext();
+ return context.getCompositeActivator();
+ }
+ return null;
+ }
+
+ public static ComponentContextHelper getCurrentComponentContextHelper() {
+ CompositeActivator activator = getCurrentCompositeActivator();
+ if (activator != null) {
+ return activator.getComponentContextHelper();
+ }
+ return null;
+ }
+
+ /**
+ * @param component
+ */
+ public static ComponentService getSingleService(Component component) {
+ ComponentService targetService;
+ List<ComponentService> services = component.getServices();
+ List<ComponentService> regularServices = new ArrayList<ComponentService>();
+ for (ComponentService service : services) {
+ if (service.isCallback()) {
+ continue;
+ }
+ String name = service.getName();
+ if (!name.startsWith("$") || name.startsWith("$dynamic$")) {
+ regularServices.add(service);
+ }
+ }
+ if (regularServices.size() == 0) {
+ throw new ServiceRuntimeException("No service is declared on component " + component.getURI());
+ }
+ if (regularServices.size() != 1) {
+ throw new ServiceRuntimeException("More than one service is declared on component " + component.getURI()
+ + ". Service name is required to get the service.");
+ }
+ targetService = regularServices.get(0);
+ return targetService;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
new file mode 100644
index 0000000000..ed01a509d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.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.core.context;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+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.Multiplicity;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+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.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.osoa.sca.CallableReference;
+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 RuntimeComponentContext {
+ private final RuntimeComponent component;
+
+ private final CompositeActivator compositeActivator;
+ private final RequestContextFactory requestContextFactory;
+ private final ProxyFactory proxyFactory;
+ private final AssemblyFactory assemblyFactory;
+ private final JavaInterfaceFactory javaInterfaceFactory;
+
+ /**
+ * This is a reference to the PropertyValueFactory that is provided by the Implementation
+ * that can be used to get the value from a Property Object.
+ *
+ * @see #setPropertyValueFactory(PropertyValueFactory)
+ * @see #getProperty(Class, String)
+ */
+ private PropertyValueFactory propertyFactory;
+
+ public ComponentContextImpl(CompositeActivator compositeActivator,
+ AssemblyFactory assemblyFactory,
+ ProxyFactory proxyFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ RequestContextFactory requestContextFactory,
+ JavaInterfaceFactory javaInterfaceFactory,
+ RuntimeComponent component) {
+ super();
+ this.compositeActivator = compositeActivator;
+ this.assemblyFactory = assemblyFactory;
+ this.proxyFactory = proxyFactory;
+ this.requestContextFactory = requestContextFactory;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ this.component = component;
+ }
+
+ public String getURI() {
+ return component.getURI();
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)proxyFactory.cast(target);
+ }
+
+ public <B> B getService(Class<B> businessInterface, String referenceName) {
+ ServiceReference<B> serviceRef = getServiceReference(businessInterface, referenceName);
+ return serviceRef.getService();
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ try {
+ for (ComponentReference ref : component.getReferences()) {
+ if (referenceName.equals(ref.getName())) {
+ return getServiceReference(businessInterface, (RuntimeComponentReference)ref, null);
+ }
+ }
+ throw new ServiceRuntimeException("Reference not found: " + referenceName);
+ } catch (ServiceRuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * The Implementation is responsible for calling this method to set the
+ * PropertyValueFactory that is used to get the Property Value from
+ * a Tuscany Property object.
+ *
+ * @param factory The PropertyValueFactory to use
+ *
+ * @see #getProperty(Class, String)
+ */
+ public void setPropertyValueFactory(PropertyValueFactory factory) {
+ propertyFactory = factory;
+ }
+
+ /**
+ * Gets the value for the specified property with the specified type.
+ *
+ * @param type The type of the property value we are getting
+ * @param propertyName The name of the property we are getting
+ * @param B The class of the property value we are getting
+ *
+ * @throws ServiceRuntimeException If a Property for the specified propertyName
+ * is not found
+ *
+ * @see #setPropertyValueFactory(PropertyValueFactory)
+ */
+ public <B> B getProperty(Class<B> type, String propertyName) {
+ for (ComponentProperty p : component.getProperties()) {
+ if (propertyName.equals(p.getName())) {
+ return propertyFactory.createPropertyValue(p, type);
+ }
+ }
+ throw new ServiceRuntimeException("Property not found: " + propertyName);
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface) {
+ ComponentService service = ComponentContextHelper.getSingleService(component);
+ try {
+ return createSelfReference(businessInterface, service);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName) {
+ try {
+ for (ComponentService service : component.getServices()) {
+ if (serviceName.equals(service.getName())) {
+ return createSelfReference(businessInterface, service);
+ }
+ }
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ } catch (ServiceRuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @param <B>
+ * @param businessInterface
+ * @param service
+ * @return
+ */
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service) {
+ try {
+ RuntimeComponentReference ref =
+ (RuntimeComponentReference)createSelfReference(component, service, businessInterface);
+ ref.setComponent(component);
+ return getServiceReference(businessInterface, ref, null);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public RequestContext getRequestContext() {
+ if (requestContextFactory != null) {
+ return requestContextFactory.createRequestContext();
+ } else {
+ return new RequestContextImpl(proxyFactory);
+ }
+ }
+
+ /**
+ * @param businessInterface
+ * @param reference
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, RuntimeComponentReference reference, Binding binding) {
+ try {
+ RuntimeComponentReference ref = (RuntimeComponentReference)reference;
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ Reference componentTypeReference = reference.getReference();
+ if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
+ interfaceContract = componentTypeReference.getInterfaceContract();
+ }
+ InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ if (refInterfaceContract != interfaceContract) {
+ ref = (RuntimeComponentReference)reference.clone();
+ if (interfaceContract != null) {
+ ref.setInterfaceContract(interfaceContract);
+ } else {
+ ref.setInterfaceContract(refInterfaceContract);
+ }
+ }
+ ref.setComponent(component);
+ return new ServiceReferenceImpl<B>(businessInterface, component, ref, binding, proxyFactory, compositeActivator);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Bind a component reference to a component service
+ * @param <B>
+ * @param businessInterface
+ * @param reference
+ * @param service
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
+ RuntimeComponentReference reference,
+ RuntimeComponent component,
+ RuntimeComponentService service) {
+ try {
+ RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ Reference componentTypeReference = reference.getReference();
+ if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
+ interfaceContract = componentTypeReference.getInterfaceContract();
+ }
+ InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ if (refInterfaceContract != interfaceContract) {
+ ref = (RuntimeComponentReference)reference.clone();
+ ref.setInterfaceContract(interfaceContract);
+ }
+ ref.getTargets().add(service);
+ ref.getBindings().clear();
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ ref.getBindings().add(optimizableBinding);
+ } else {
+ ref.getBindings().add(binding);
+ }
+ }
+ return new ServiceReferenceImpl<B>(businessInterface, component, ref, proxyFactory, compositeActivator);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public <B> CallableReference<B> getCallableReference(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentService service) {
+ try {
+ if (businessInterface == null) {
+ InterfaceContract contract = service.getInterfaceContract();
+ businessInterface = (Class<B>)((JavaInterface)contract.getInterface()).getJavaClass();
+ }
+ RuntimeComponentReference ref =
+ (RuntimeComponentReference)createSelfReference(component, service, businessInterface);
+ ref.setComponent(component);
+ return new CallableReferenceImpl<B>(businessInterface, component, ref, null, proxyFactory,
+ compositeActivator);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Create a self-reference for a component service
+ * @param component
+ * @param service
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ private ComponentReference createSelfReference(Component component,
+ ComponentService service,
+ Class<?> businessInterface) throws CloneNotSupportedException,
+ InvalidInterfaceException {
+ ComponentReference componentReference = assemblyFactory.createComponentReference();
+ componentReference.setName("$self$." + service.getName());
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ componentReference.getBindings().add(optimizableBinding);
+ } else {
+ componentReference.getBindings().add(binding);
+ }
+ }
+
+ componentReference.setCallback(service.getCallback());
+ componentReference.getTargets().add(service);
+ componentReference.getPolicySets().addAll(service.getPolicySets());
+ componentReference.getRequiredIntents().addAll(service.getRequiredIntents());
+
+ InterfaceContract interfaceContract = service.getInterfaceContract();
+ Service componentTypeService = service.getService();
+ if (componentTypeService != null && componentTypeService.getInterfaceContract() != null) {
+ interfaceContract = componentTypeService.getInterfaceContract();
+ }
+ interfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ componentReference.setInterfaceContract(interfaceContract);
+ componentReference.setMultiplicity(Multiplicity.ONE_ONE);
+ // component.getReferences().add(componentReference);
+ return componentReference;
+ }
+
+ /**
+ * @param interfaceContract
+ * @param businessInterface
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ private InterfaceContract getInterfaceContract(InterfaceContract interfaceContract, Class<?> businessInterface)
+ throws CloneNotSupportedException, InvalidInterfaceException {
+ boolean compatible = false;
+ if (interfaceContract != null && interfaceContract.getInterface() != null) {
+ Interface interfaze = interfaceContract.getInterface();
+ if (interfaze instanceof JavaInterface) {
+ Class<?> cls = ((JavaInterface)interfaze).getJavaClass();
+ if (businessInterface.isAssignableFrom(cls)) {
+ compatible = true;
+ }
+ }
+ }
+
+ if (!compatible) {
+ // The interface is not assignable from the interface contract
+ interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(businessInterface);
+ interfaceContract.setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
+ .getCallbackClass()));
+ }
+ }
+
+ return interfaceContract;
+ }
+
+ /**
+ * @return the compositeActivator
+ */
+ public CompositeActivator getCompositeActivator() {
+ return compositeActivator;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#start(org.apache.tuscany.sca.runtime.RuntimeComponentReference)
+ */
+ public void start(RuntimeComponentReference reference) {
+ compositeActivator.start(component, reference);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#read(java.io.Reader)
+ */
+ public RuntimeComponent read(Reader reader) throws IOException {
+ RuntimeComponent component = compositeActivator.getComponentContextHelper().read(reader);
+ compositeActivator.configureComponentContext(component);
+ return component;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#write(org.apache.tuscany.sca.runtime.RuntimeComponentReference, java.io.Writer)
+ */
+ public void write(RuntimeComponentReference reference, Writer writer) throws IOException {
+ compositeActivator.getComponentContextHelper().write(component, reference, writer);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java
new file mode 100644
index 0000000000..c5b68389b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.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.context;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultComponentContextFactory implements ComponentContextFactory {
+ private final CompositeActivator compositeActivator;
+ private final RequestContextFactory requestContextFactory;
+ private final ProxyFactory proxyFactory;
+ private final AssemblyFactory assemblyFactory;
+ private final JavaInterfaceFactory javaInterfaceFactory;
+ private final InterfaceContractMapper interfaceContractMapper;
+
+ public DefaultComponentContextFactory(CompositeActivator compositeActivator,
+ AssemblyFactory assemblyFactory,
+ ProxyFactory proxyFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ RequestContextFactory requestContextFactory,
+ JavaInterfaceFactory javaInterfaceFactory) {
+ super();
+ this.compositeActivator = compositeActivator;
+ this.assemblyFactory = assemblyFactory;
+ this.proxyFactory = proxyFactory;
+ this.requestContextFactory = requestContextFactory;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.context.ComponentContextFactory#createComponentContext(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.context.RequestContextFactory)
+ */
+ public ComponentContext createComponentContext(RuntimeComponent component,
+ RequestContextFactory requestContextFactory) {
+ if (requestContextFactory == null) {
+ requestContextFactory = this.requestContextFactory;
+ }
+ return new ComponentContextImpl(compositeActivator, assemblyFactory, proxyFactory, interfaceContractMapper,
+ requestContextFactory, javaInterfaceFactory, component);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java
new file mode 100644
index 0000000000..b577180291
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.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.context;
+
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetInitializationException;
+
+
+/**
+ * Provides lifecycle management for an implementation instance associated with
+ * a component for use by the component's associated {@link org.apache.tuscany.sca.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java
new file mode 100644
index 0000000000..aa69bb3ae5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.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.core.context;
+
+import java.util.List;
+
+import javax.security.auth.Subject;
+
+import org.apache.tuscany.sca.core.invocation.CallbackReferenceImpl;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+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.osoa.sca.CallableReference;
+import org.osoa.sca.RequestContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequestContextImpl implements RequestContext {
+
+ private ProxyFactory proxyFactory;
+
+ public RequestContextImpl(ProxyFactory proxyFactory) {
+ this.proxyFactory = proxyFactory;
+ }
+
+ public Subject getSecuritySubject() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getServiceName() {
+ return ThreadMessageContext.getMessageContext().getTo().getContract().getName();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <B> CallableReference<B> getServiceReference() {
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ // FIXME: [rfeng] Is this the service reference matching the caller side?
+ EndpointReference to = msgContext.getTo();
+ RuntimeComponentService service = (RuntimeComponentService) to.getContract();
+ RuntimeComponent component = (RuntimeComponent) to.getComponent();
+
+ CallableReference<B> callableReference = component.getComponentContext().getCallableReference(null, component, service);
+ ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
+ ((CallableReferenceImpl<B>) callableReference).attachCallbackID(parameters.getCallbackID());
+ ((CallableReferenceImpl<B>) callableReference).attachConversation(parameters.getConversationID());
+ return callableReference;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <CB> CB getCallback() {
+ CallableReference<CB> cb = getCallbackReference();
+ if (cb == null) {
+ return null;
+ }
+ return cb.getService();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <CB> CallableReference<CB> getCallbackReference() {
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ EndpointReference to = msgContext.getTo();
+ RuntimeComponentService service = (RuntimeComponentService) to.getContract();
+ RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
+ if (callbackReference == null) {
+ return null;
+ }
+ JavaInterface javaInterface = (JavaInterface) callbackReference.getInterfaceContract().getInterface();
+ Class<CB> javaClass = (Class<CB>)javaInterface.getJavaClass();
+ List<RuntimeWire> wires = callbackReference.getRuntimeWires();
+ CallbackReferenceImpl ref = CallbackReferenceImpl.newInstance(javaClass, proxyFactory, wires);
+ if (ref != null) {
+ //ref.resolveTarget();
+ ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
+ ref.attachCallbackID(parameters.getCallbackID());
+ if (ref.getConversation() != null) {
+ ref.attachConversationID(parameters.getConversationID());
+ }
+ }
+ return ref;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java
new file mode 100644
index 0000000000..1d178421cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.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.core.context;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+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> {
+ private static final long serialVersionUID = 6763709434194361540L;
+
+ protected transient Object callback;
+
+ /*
+ * Public constructor for Externalizable serialization/deserialization
+ */
+ public ServiceReferenceImpl() {
+ super();
+ }
+
+ /*
+ * Public constructor for use by XMLStreamReader2CallableReference
+ */
+ public ServiceReferenceImpl(XMLStreamReader xmlReader) throws Exception {
+ super(xmlReader);
+ }
+
+ /**
+ * @param businessInterface
+ * @param wire
+ * @param proxyFactory
+ */
+ public ServiceReferenceImpl(Class<B> businessInterface, RuntimeWire wire, ProxyFactory proxyFactory) {
+ super(businessInterface, wire, proxyFactory);
+ }
+
+ public ServiceReferenceImpl(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ ProxyFactory proxyFactory,
+ CompositeActivator compositeActivator) {
+ super(businessInterface, component, reference, null, proxyFactory, compositeActivator);
+ }
+
+ public ServiceReferenceImpl(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding,
+ ProxyFactory proxyFactory,
+ CompositeActivator compositeActivator) {
+ super(businessInterface, component, reference, binding, proxyFactory, compositeActivator);
+ }
+
+ public Object getConversationID() {
+ return conversationID;
+ }
+
+ public void setConversationID(Object conversationID) throws IllegalStateException {
+ if (conversation == null || conversation.getState() != ConversationState.ENDED) {
+ this.conversationID = conversationID;
+ this.conversation = null;
+ } else {
+ throw new IllegalStateException("Trying to set the conversationId on a service reference but the state of the conversation "
+ + conversation.getConversationID()
+ + " is "
+ + conversation.getState());
+ }
+ }
+
+ public void setCallbackID(Object callbackID) {
+ this.callbackID = callbackID;
+ }
+
+ public Object getCallback() {
+ return callback;
+ }
+
+ public void setCallback(Object callback) {
+ if (callback != null && !(callback instanceof CallableReference)) {
+ //FIXME: need to check if callback object supports the callback interface
+ // returned by reference.getInterfaceContract().getCallbackInterface()
+ }
+ this.callback = callback;
+ }
+
+ @Override
+ protected ReferenceParameters getReferenceParameters() {
+ ReferenceParameters parameters = super.getReferenceParameters();
+ if (callback != null) {
+ if (callback instanceof ServiceReference) {
+ EndpointReference callbackRef = ((CallableReferenceImpl)callback).getEndpointReference();
+ parameters.setCallbackReference(callbackRef);
+ } else {
+ EndpointReference callbackRef = getRuntimeWire().getSource().getCallbackEndpoint();
+ parameters.setCallbackReference(callbackRef);
+ parameters.setCallbackObjectID(callback);
+ }
+ }
+ return parameters;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java
new file mode 100644
index 0000000000..efa362a929
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.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.conversation;
+
+/**
+ * Listener for the events of a conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConversationListener {
+ /**
+ * The conversation is started
+ */
+ void conversationStarted(ExtendedConversation conversation);
+ /**
+ * The conversation is ended
+ */
+ void conversationEnded(ExtendedConversation conversation);
+ /**
+ * The conversation is expired
+ */
+ void conversationExpired(ExtendedConversation conversation);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java
new file mode 100644
index 0000000000..28e22b4f2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.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.core.conversation;
+
+/**
+ * The manager of conversations
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConversationManager {
+ /**
+ * @param conversationID
+ * @return
+ */
+ ExtendedConversation startConversation(Object conversationID);
+
+ /**
+ * @param conversationID
+ */
+ void endConversation(Object conversationID);
+
+ /**
+ * @param conversationID
+ * @return
+ */
+ ExtendedConversation getConversation(Object conversationID);
+
+ /**
+ * @param conversationID
+ */
+ void expireConversation(Object conversationID);
+
+ /**
+ * Add a listener to this conversation
+ * @param listener
+ */
+ void addListener(ConversationListener listener);
+
+ /**
+ * Remove a listener from this conversation
+ * @param listener
+ */
+ void removeListener(ConversationListener listener);
+
+ /**
+ * @return the default max age for a conversation
+ */
+ long getMaxAge();
+
+ /**
+ * @return the default max idle time for a conversation
+ */
+ long getMaxIdleTime();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java
new file mode 100644
index 0000000000..8a883f8e15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.conversation;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationManagerImpl implements ConversationManager {
+
+ private List<ConversationListener> listeners = Collections.synchronizedList(new ArrayList<ConversationListener>());
+ private Map<Object, ExtendedConversation> conversations = new ConcurrentHashMap<Object, ExtendedConversation>();
+
+ /**
+ * the default max age. this is set to 1 hour
+ */
+ private static final long DEFAULT_MAX_AGE = 60 * 60 * 1000; ;
+
+ /**
+ * the default max idle time. this is set to 1 hour
+ */
+ private static final long DEFAULT_MAX_IDLE_TIME = 60 * 60 * 1000;
+
+ /**
+ * the globally used max age
+ */
+ private final long maxAge;
+
+ /**
+ * the globally used max idle time
+ */
+ private final long maxIdleTime;
+
+ /**
+ * the reaper thread
+ */
+ private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
+
+ /**
+ * constructor
+ */
+ public ConversationManagerImpl() {
+ long mit = DEFAULT_MAX_IDLE_TIME;
+ long ma = DEFAULT_MAX_AGE;
+
+ // Allow privileged access to read system property. Requires PropertyPermission in security
+ // policy.
+ String aProperty = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.MaxIdleTime");
+ }
+ });
+ if (aProperty != null) {
+ try {
+ mit = (new Long(aProperty) * 1000);
+ } catch (NumberFormatException nfe) {
+ // Ignore
+ }
+ }
+
+ // Allow privileged access to read system property. Requires PropertyPermission in security
+ // policy.
+ aProperty = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.MaxAge");
+ }
+ });
+ if (aProperty != null) {
+ try {
+ ma = (new Long(aProperty) * 1000);
+ } catch (NumberFormatException nfe) {
+ // Ignore
+ }
+ }
+
+ maxAge = ma;
+ maxIdleTime = mit;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#addListener(org.apache.tuscany.sca.core.conversation.ConversationListener)
+ */
+ public void addListener(ConversationListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#endConversation(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ */
+ public void endConversation(Object conversationID) {
+ ExtendedConversation conv = getConversation(conversationID);
+ if (conv != null) {
+ conv.setState(ConversationState.ENDED);
+ for (ConversationListener listener : listeners) {
+ listener.conversationEnded(conv);
+ }
+ conv.setConversationID(null);
+ conversations.remove(conversationID);
+ } else {
+ throw new IllegalStateException("Conversation " + conversationID + " doesn't exist.");
+ }
+ }
+
+ public void expireConversation(Object conversationID) {
+ ExtendedConversation conv = getConversation(conversationID);
+ if (conv != null) {
+ for (ConversationListener listener : listeners) {
+ listener.conversationExpired(conv);
+ }
+ conversations.remove(conversationID);
+ } else {
+ throw new IllegalStateException("Conversation " + conversationID + " doesn't exist.");
+ }
+
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#getConversation(java.lang.Object)
+ */
+ public ExtendedConversation getConversation(Object conversationID) {
+ // ConcurrentHashMap cannot take null key
+ return conversationID == null ? null : conversations.get(conversationID);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#removeListener(org.apache.tuscany.sca.core.conversation.ConversationListener)
+ */
+ public void removeListener(ConversationListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * starts the reaper thread
+ */
+ public void scheduleConversation(ExtendedConversationImpl aConversation, long time)
+ {
+ this.scheduler.schedule(aConversation, time, TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * stops the reaper thread
+ */
+ public synchronized void stopReaper() {
+
+ // Prevent the scheduler from submitting any additional reapers,
+ // initiate an orderly shutdown if a reaper task is in progress.
+ this.scheduler.shutdown();
+ }
+
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#startConversation(java.lang.Object)
+ */
+ public ExtendedConversation startConversation(Object conversationID) {
+
+ if (conversationID == null) {
+ conversationID = UUID.randomUUID().toString();
+ }
+ ExtendedConversation conversation = getConversation(conversationID);
+ if (conversation != null && conversation.getState() != ConversationState.ENDED) {
+ throw new IllegalStateException(conversation + " already exists.");
+ }
+
+ conversation = new ExtendedConversationImpl(
+ this, conversationID, ConversationState.STARTED);
+ conversations.put(conversationID, conversation);
+ for (ConversationListener listener : listeners) {
+ listener.conversationStarted(conversation);
+ }
+ return conversation;
+ }
+
+ /**
+ * return the default max idle time
+ * @param impProvider the implementation Provider to extract any ConversationAttribute details
+ */
+ public long getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ /**
+ * returns the default max age
+ * @param impProvider the implementation Provider to extract any ConversationAttribute details
+ */
+ public long getMaxAge(){
+ return maxAge;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.java
new file mode 100644
index 0000000000..692d6861ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.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.conversation;
+
+/**
+ * The states of a conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public enum ConversationState {
+ STARTED, ENDED, EXPIRED
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java
new file mode 100644
index 0000000000..03c18c26b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.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.conversation;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.Conversation;
+
+/**
+ * An extended interface over org.osoa.Conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExtendedConversation extends Conversation {
+ /**
+ * Get the state of a conversation
+ * @return The state
+ */
+ ConversationState getState();
+
+ /**
+ * @param state the state to set
+ */
+ void setState(ConversationState state);
+
+ /**
+ * @param conversationID the conversationID to set
+ */
+ void setConversationID(Object conversationID);
+
+
+ /**
+ * will check whether this conversation has expired and update state if it has
+ * @return true if it has expired
+ */
+ boolean isExpired();
+
+ /**
+ * updates the last time this conversation was referenced
+ */
+ void updateLastReferencedTime();
+
+ void initializeConversationAttributes(RuntimeComponent targetComponent);
+
+
+ /**
+ * @return true if the conversational attributes have been initialized
+ */
+ boolean conversationalAttributesInitialized();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
new file mode 100644
index 0000000000..0bf66b2817
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
@@ -0,0 +1,265 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.core.conversation;
+
+import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtendedConversationImpl implements ExtendedConversation, Runnable {
+
+ private final ConversationManagerImpl manager;
+ private volatile Object conversationID;
+ private ConversationState state;
+
+ /**
+ * syncs access to the state
+ */
+ private final Object stateSync = new Object();
+
+ /**
+ * the maximum time a conversation can exist
+ */
+ private long expirationTime = 0;
+
+ /**
+ * the maximum time this conversation can be idle
+ */
+ private long maxIdleTime = 0;
+
+ /**
+ * the maximum age of this conversation
+ */
+ private long maxAge = 0;
+
+ /**
+ * the time that this object was created
+ */
+ private long creationTime;
+
+ /**
+ * the time that this object was last referenced
+ */
+ private long lastReferencedTime;
+
+ /**
+ * boolean to ensure expiry only occurs once
+ */
+ private boolean expired = false;
+
+ /**
+ * boolean to indicate if the conversation attributes have
+ * been set. In the case where a remote binding is used
+ * within a composite the JDKInvocationHandler can create the
+ * conversation but the conversationAttributes are not available
+ * until the conversation is retrieved by the RuntimeWireInvoker
+ */
+ private boolean conversationAttributesInitialized = false;
+
+ /**
+ * Constructor
+ * @param manager the conversation manager
+ * @param conversationID the conversation id associated with this conversation
+ * @param state the initial state of this conversation
+ * @param aMaxAge the maximum age of the conversation
+ * @param aMaxIdleTime the maximum idle time
+ */
+ public ExtendedConversationImpl(ConversationManagerImpl manager,
+ Object conversationID, ConversationState state) {
+ super();
+
+ this.creationTime = System.currentTimeMillis();
+ this.lastReferencedTime = creationTime;
+ this.manager = manager;
+ this.conversationID = conversationID;
+ this.state = state;
+ }
+
+ /**
+ * will check whether this conversation has expired and update state if it has
+ * @return true if it has expired
+ */
+ public boolean isExpired() {
+ long currentTime;
+ synchronized (stateSync) {
+
+ // if the attributes haven't been initialized then
+ // this conversation object can't expire
+ if (conversationAttributesInitialized == false) {
+ return false;
+ }
+
+ // check state first
+ if (state == ConversationState.EXPIRED) {
+ return true;
+ }
+
+ // check whether the time is finished
+ currentTime = System.currentTimeMillis();
+ if (((this.lastReferencedTime + this.maxIdleTime) <= currentTime)
+ || (this.expirationTime <= currentTime)) {
+ setState(ConversationState.EXPIRED);
+ return true;
+ }
+ }
+ scheduleNextExpiryTime(currentTime);
+ return false;
+ }
+
+ /**
+ * schedule next expiry time
+ */
+ public void scheduleNextExpiryTime(long currentTime) {
+ if ((lastReferencedTime + maxIdleTime) < expirationTime){
+ manager.scheduleConversation(this, (lastReferencedTime + maxIdleTime) - currentTime);
+ } else {
+ manager.scheduleConversation(this, expirationTime - currentTime);
+ }
+ }
+ /**
+ * updates the last time this conversation was referenced
+ */
+ public void updateLastReferencedTime() {
+ this.lastReferencedTime = System.currentTimeMillis();
+ if (conversationAttributesInitialized == true){
+ scheduleNextExpiryTime(lastReferencedTime);
+ }
+ }
+
+ public ConversationState getState() {
+ synchronized (stateSync){
+ return state;
+ }
+ }
+
+ public void end() {
+ manager.endConversation(conversationID);
+ }
+
+ public Object getConversationID() {
+ return conversationID;
+ }
+
+ /**
+ * @param state the state to set
+ */
+ public void setState(ConversationState state) {
+ synchronized (stateSync){
+ this.state = state;
+ }
+ }
+
+ /**
+ * @param conversationID the conversationID to set
+ */
+ public void setConversationID(Object conversationID) {
+ synchronized (stateSync){
+ if (state != ConversationState.ENDED) {
+ throw new IllegalStateException("The state of conversation " + conversationID + " " + state);
+ }
+ }
+ this.conversationID = conversationID;
+ }
+
+ /**
+ * @param maxAge the maximum age of this conversation
+ */
+ public void initializeConversationAttributes(RuntimeComponent targetComponent){
+ if (targetComponent != null){
+ this.maxAge = getMaxIdleTime(targetComponent.getImplementationProvider());
+ this.maxIdleTime = getMaxAge(targetComponent.getImplementationProvider());
+ this.expirationTime = creationTime + maxAge;
+ this.conversationAttributesInitialized = true;
+ }
+ }
+
+ /**
+ * @return true if the conversational attributes have been initialized
+ */
+ public boolean conversationalAttributesInitialized(){
+ return this.conversationAttributesInitialized;
+ }
+
+ /**
+ * return the max idle time
+ * @param impProvider the implementation Provider to extract any ConversationAttribute details
+ */
+ private long getMaxIdleTime(ImplementationProvider impProvider) {
+ // Check to see if the maxIdleTime has been specified using @ConversationAttributes.
+ // Implementation annotated attributes are honoured first.
+ if ((impProvider != null) &&
+ (impProvider instanceof ScopedImplementationProvider)) {
+ ScopedImplementationProvider aScopedImpl =
+ (ScopedImplementationProvider) impProvider;
+
+ long maxIdleTime = aScopedImpl.getMaxIdleTime();
+ if (maxIdleTime > 0) {
+ return maxIdleTime;
+ }
+ }
+ return manager.getMaxIdleTime();
+ }
+
+ /**
+ * returns the max age
+ * @param impProvider the implementation Provider to extract any ConversationAttribute details
+ */
+ private long getMaxAge(ImplementationProvider impProvider){
+
+ // Check to see if the maxAge has been specified using @ConversationAttributes.
+ // Implementation annotated attributes are honoured first.
+ if ((impProvider != null) &&
+ (impProvider instanceof ScopedImplementationProvider)) {
+ ScopedImplementationProvider aScopedImpl =
+ (ScopedImplementationProvider) impProvider;
+
+ long maxAge = aScopedImpl.getMaxAge();
+ if (maxAge > 0) {
+ return maxAge;
+ }
+ }
+ return manager.getMaxAge();
+ }
+
+ /**
+ * called when expiring
+ */
+ public void run() {
+ synchronized (stateSync){
+ if (!expired){
+ if (isExpired()) {
+ expired = true;
+ try {
+ manager.expireConversation(getConversationID());
+ } catch (IllegalStateException ise) {
+ // ignore this.. this can occur if another thread has subsequently ended
+ // the conversation
+ }
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java
new file mode 100644
index 0000000000..45eab7da1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java
new file mode 100644
index 0000000000..4dc79c3844
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java
new file mode 100644
index 0000000000..d3106c7052
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java
new file mode 100644
index 0000000000..123400fbdd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java
new file mode 100644
index 0000000000..68cb5c2966
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java
new file mode 100644
index 0000000000..38a4fb10d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java
new file mode 100644
index 0000000000..d7e797bbb9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java
new file mode 100644
index 0000000000..7530156b11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java
new file mode 100644
index 0000000000..d35b27fd24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.java
new file mode 100644
index 0000000000..3f64d2405b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java
new file mode 100644
index 0000000000..588c43b8b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.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.invocation;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.CallableReference;
+
+/**
+ * Uses a wire to return a CallableReference
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallableReferenceObjectFactory implements ObjectFactory<CallableReference<?>> {
+ private Class<?> businessInterface;
+ private RuntimeComponent component;
+ private RuntimeComponentReference reference;
+ private Binding binding;
+
+ /**
+ * Constructor.
+ *
+ * To support the @Reference protected CallableReference<MyService> ref;
+ *
+ * @param businessInterface the interface to inject
+ * @param component the component defining the reference to be injected
+ * @param reference the reference to be injected
+ * @param binding the binding for the reference
+ */
+ public CallableReferenceObjectFactory(Class<?> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ this.businessInterface = businessInterface;
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding;
+ }
+
+ public CallableReference<?> getInstance() throws ObjectCreationException {
+ return component.getComponentContext().getServiceReference(businessInterface, reference, binding);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java
new file mode 100644
index 0000000000..d19aa237cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.apache.tuscany.sca.runtime.ReferenceParameters;
+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 Invoker next;
+
+ public CallbackInterfaceInterceptor() {
+ }
+
+ public Message invoke(Message msg) {
+ ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
+ if (parameters.getCallbackObjectID() != null || parameters.getCallbackReference() != msg.getFrom()
+ .getCallbackEndpoint()) {
+ return next.invoke(msg);
+ } else {
+ throw new NoRegisteredCallbackException("Callback target does not implement the callback interface");
+ }
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java
new file mode 100644
index 0000000000..97c69c33cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.core.invocation;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentReferenceImpl;
+import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.ComponentContextHelper;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Message;
+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;
+
+/**
+ * Returns proxy instance for a wire callback
+ *
+ * @version $Rev: 576055 $ $Date: 2007-09-16 08:11:45 +0100 (Sun, 16 Sep 2007) $
+ */
+public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
+ private RuntimeWire wire;
+ private List<RuntimeWire> wires;
+ private EndpointReference resolvedEndpoint;
+ private Object convID;
+
+ public static CallbackReferenceImpl newInstance(Class interfaze,
+ ProxyFactory proxyFactory,
+ List<RuntimeWire> wires) {
+ if (getCallbackEndpoint(ThreadMessageContext.getMessageContext()) != null) {
+ return new CallbackReferenceImpl(interfaze, proxyFactory, wires);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Public constructor for Externalizable serialization/deserialization.
+ */
+ public CallbackReferenceImpl() {
+ super();
+ }
+
+ private CallbackReferenceImpl(Class<B> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
+ super(interfaze, null, proxyFactory);
+ this.wires = wires;
+ init();
+ }
+
+ public void init() {
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ wire = selectCallbackWire(msgContext);
+ if (wire == null) {
+ //FIXME: need better exception
+ throw new RuntimeException("No callback binding found for " + msgContext.getTo().getURI());
+ }
+ resolvedEndpoint = getCallbackEndpoint(msgContext);
+ convID = msgContext.getFrom().getReferenceParameters().getConversationID();
+ callbackID = msgContext.getFrom().getReferenceParameters().getCallbackID();
+ }
+
+ @Override
+ protected Object createProxy() throws Exception {
+ return proxyFactory.createCallbackProxy(this);
+ }
+
+ protected RuntimeWire getCallbackWire() {
+ if (resolvedEndpoint == null) {
+ return null;
+ } else {
+ return cloneAndBind(wire);
+ }
+ }
+
+ protected Object getConvID() {
+ return convID;
+ }
+
+ protected EndpointReference getResolvedEndpoint() {
+ return resolvedEndpoint;
+ }
+
+ private RuntimeWire selectCallbackWire(Message msgContext) {
+ // look for callback binding with same name as service binding
+ EndpointReference to = msgContext.getTo();
+ if (to == null) {
+ //FIXME: need better exception
+ throw new RuntimeException("Destination for forward call is not available");
+ }
+ for (RuntimeWire wire : wires) {
+ if (wire.getSource().getBinding().getName().equals(to.getBinding().getName())) {
+ return wire;
+ }
+ }
+
+ // if no match, look for callback binding with same type as service binding
+ for (RuntimeWire wire : wires) {
+ if (wire.getSource().getBinding().getClass() == to.getBinding().getClass()) {
+ return wire;
+ }
+ }
+
+ // no suitable callback wire was found
+ return null;
+ }
+
+ /**
+ * @param msgContext
+ */
+ private static EndpointReference getCallbackEndpoint(Message msgContext) {
+ EndpointReference from = msgContext.getFrom();
+ if (from == null) {
+ return null;
+ }
+ return from.getReferenceParameters().getCallbackReference();
+ }
+
+ private RuntimeWire cloneAndBind(RuntimeWire wire) {
+ RuntimeWire boundWire = null;
+ if (resolvedEndpoint != null) {
+ boundWire = ((RuntimeWireImpl)wire).lookupCache(resolvedEndpoint);
+ if (boundWire != null) {
+ return boundWire;
+ }
+ try {
+ Contract contract = resolvedEndpoint.getContract();
+ RuntimeComponentReference ref = null;
+ if (contract == null) {
+ boundWire = (RuntimeWire)wire.clone();
+
+ } else if (contract instanceof RuntimeComponentReference) {
+ ref = (RuntimeComponentReference)contract;
+ boundWire = ref.getRuntimeWire(resolvedEndpoint.getBinding());
+
+ } else { // contract instanceof RuntimeComponentService
+ ref = bind((RuntimeComponentReference)wire.getSource().getContract(),
+ resolvedEndpoint.getComponent(),
+ (RuntimeComponentService)contract);
+ boundWire = ref.getRuntimeWires().get(0);
+ }
+ configureWire(boundWire);
+ ((RuntimeWireImpl)wire).addToCache(resolvedEndpoint, boundWire);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ }
+ return boundWire;
+ }
+
+ private static RuntimeComponentReference bind(RuntimeComponentReference reference,
+ RuntimeComponent component,
+ RuntimeComponentService service) throws CloneNotSupportedException {
+ RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
+ ref.getTargets().add(service);
+ ref.getBindings().clear();
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ ref.getBindings().add(optimizableBinding);
+ } else {
+ ref.getBindings().add(binding);
+ }
+ }
+ return ref;
+ }
+
+ private void configureWire(RuntimeWire wire) {
+ // need to set the endpoint on the binding also so that when the chains are created next
+ // the sca binding can decide whether to provide local or remote invokers.
+ // TODO - there is a problem here though in that I'm setting a target on a
+ // binding that may possibly be trying to point at two things in the multi threaded
+ // case. Need to confirm the general model here and how the clone and bind part
+ // is intended to work
+ Binding binding = wire.getSource().getBinding();
+ binding.setURI(resolvedEndpoint.getURI());
+
+ // also need to set the target contract as it varies for the sca binding depending on
+ // whether it is local or remote
+ RuntimeComponentReference ref = (RuntimeComponentReference)wire.getSource().getContract();
+ wire.getTarget().setInterfaceContract(ref.getBindingProvider(binding).getBindingInterfaceContract());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ this.callbackID = in.readObject();
+ this.convID = in.readObject();
+
+ this.compositeActivator = ComponentContextHelper.getCurrentCompositeActivator();
+
+ // Get the target Component and Service from the URI
+ final String uri = in.readUTF();
+ final Component targetComponent = super.resolveComponentURI(uri);
+ final ComponentService targetService = super.resolveServiceURI(uri, targetComponent);
+ final InterfaceContract targetServiceIfaceContract = targetService.getInterfaceContract();
+
+ // Re-create the resolved Endpoint
+ this.resolvedEndpoint = new EndpointReferenceImpl(
+ (RuntimeComponent) targetComponent, targetService, null,
+ targetServiceIfaceContract);
+
+ // Copy the Java Interface from the Service
+ final JavaInterface ji = (JavaInterface) targetServiceIfaceContract.getInterface();
+ this.businessInterface = (Class<B>) ji.getJavaClass();
+
+ // We need to re-create the callback wire. We need to do this on a clone of the Service
+ // wire since we need to change some details on it.
+ // FIXME: Is this the best way to do this?
+ final RuntimeWire cbWire = ((RuntimeComponentService) targetService).getRuntimeWires().get(0);
+ try {
+ this.wire = (RuntimeWireImpl) cbWire.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new IOException(e.toString());
+ }
+
+ // Setup the reference on the cloned wire
+ final RuntimeComponentReference ref = new RuntimeComponentReferenceImpl();
+ ref.setComponent((RuntimeComponent) targetComponent);
+ ref.setInterfaceContract(targetServiceIfaceContract);
+ ((EndpointReferenceImpl) this.wire.getSource()).setContract(ref);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(this.callbackID);
+ out.writeObject(this.convID);
+ out.writeUTF(this.resolvedEndpoint.getURI());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java
new file mode 100644
index 0000000000..b5b40811ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.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 java.util.List;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+
+/**
+ * Uses a wire to return a CallableReference
+ *
+ * @version $Rev: 574648 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
+ */
+public class CallbackReferenceObjectFactory implements ObjectFactory<CallableReference<?>> {
+ private Class<?> businessInterface;
+ private ProxyFactory proxyFactory;
+ private List<RuntimeWire> wires;
+
+ public CallbackReferenceObjectFactory(Class<?> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
+ this.businessInterface = interfaze;
+ this.proxyFactory = proxyFactory;
+ this.wires = wires;
+ }
+
+ public CallableReference<?> getInstance() throws ObjectCreationException {
+ return CallbackReferenceImpl.newInstance(businessInterface, proxyFactory, wires);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java
new file mode 100644
index 0000000000..2b37c30451
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Returns proxy instance for a wire callback
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackWireObjectFactory<B> implements ObjectFactory<B> {
+ private Class<B> businessInterface;
+ private ProxyFactory proxyFactory;
+ private List<RuntimeWire> wires;
+
+ public CallbackWireObjectFactory(Class<B> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
+ this.businessInterface = interfaze;
+ this.proxyFactory = proxyFactory;
+ this.wires = wires;
+ }
+
+ public B getInstance() throws ObjectCreationException {
+ return proxyFactory.createCallbackProxy(businessInterface, wires);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java
new file mode 100644
index 0000000000..0fa1d27d2a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.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.core.invocation;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import net.sf.cglib.proxy.Callback;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.Factory;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+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;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * The implementation of a wire service that uses cglib dynamic proxies
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("unused")
+public class CglibProxyFactory implements ProxyFactory {
+ private MessageFactory messageFactory;
+
+ public CglibProxyFactory(MessageFactory messageFactory, InterfaceContractMapper mapper) {
+ this.messageFactory = messageFactory;
+
+ }
+
+ public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
+ ServiceReference<T> serviceReference = new ServiceReferenceImpl(interfaze, wire, this);
+ return createProxy(serviceReference);
+ }
+
+ /**
+ * create the proxy with cglib. use the same JDKInvocationHandler as
+ * JDKProxyService.
+ */
+ public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
+ Enhancer enhancer = new Enhancer();
+ Class<T> interfaze = callableReference.getBusinessInterface();
+ enhancer.setSuperclass(interfaze);
+ enhancer.setCallback(new CglibMethodInterceptor<T>(callableReference));
+ Object proxy = enhancer.create();
+ ((CallableReferenceImpl)callableReference).setProxy(proxy);
+ return interfaze.cast(proxy);
+ }
+
+ /**
+ * create the callback proxy with cglib. use the same
+ * JDKCallbackInvocationHandler as JDKProxyService.
+ */
+ public <T> T createCallbackProxy(Class<T> interfaze, final List<RuntimeWire> wires) throws ProxyCreationException {
+ CallbackReferenceImpl<T> callbackReference = CallbackReferenceImpl.newInstance(interfaze, this, wires);
+ return callbackReference != null ? createCallbackProxy(callbackReference) : null;
+ }
+
+ /**
+ * create the callback proxy with cglib. use the same
+ * JDKCallbackInvocationHandler as JDKProxyService.
+ */
+ public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
+ Enhancer enhancer = new Enhancer();
+ Class<T> interfaze = callbackReference.getBusinessInterface();
+ enhancer.setSuperclass(interfaze);
+ enhancer.setCallback(new CglibMethodInterceptor<T>(callbackReference));
+ Object proxy = enhancer.create();
+ callbackReference.setProxy(proxy);
+ return interfaze.cast(proxy);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ if (isProxyClass(target.getClass())) {
+ Factory factory = (Factory)target;
+ Callback[] callbacks = factory.getCallbacks();
+ if (callbacks.length != 1 || !(callbacks[0] instanceof CglibMethodInterceptor)) {
+ throw new IllegalArgumentException("The object is not a known proxy.");
+ }
+ CglibMethodInterceptor interceptor = (CglibMethodInterceptor)callbacks[0];
+ return (R)interceptor.invocationHandler.getCallableReference();
+ } else {
+ throw new IllegalArgumentException("The object is not a known proxy.");
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class)
+ */
+ public boolean isProxyClass(Class<?> clazz) {
+ return Factory.class.isAssignableFrom(clazz);
+ }
+
+ private class CglibMethodInterceptor<T> implements MethodInterceptor {
+ private JDKInvocationHandler invocationHandler;
+
+ public CglibMethodInterceptor(CallableReference<T> callableReference) {
+ invocationHandler = new JDKInvocationHandler(messageFactory, callableReference);
+ }
+
+ public CglibMethodInterceptor(CallbackReferenceImpl<T> callbackReference) {
+ invocationHandler = new JDKCallbackInvocationHandler(messageFactory, callbackReference);
+ }
+
+ /*
+ public CglibMethodInterceptor(Class<T> interfaze, RuntimeWire wire) {
+ ServiceReference<T> serviceRef = new ServiceReferenceImpl<T>(interfaze, wire, CglibProxyFactory.this);
+ invocationHandler = new JDKInvocationHandler(messageFactory, serviceRef);
+ }
+
+ public CglibMethodInterceptor(Class<T> interfaze, List<RuntimeWire> wires) {
+ CallbackReferenceImpl ref = new CallbackReferenceImpl(interfaze, CglibProxyFactory.this, wires);
+ invocationHandler = new JDKCallbackInvocationHandler(messageFactory, ref);
+ }
+ */
+
+ /**
+ * @see net.sf.cglib.proxy.MethodInterceptor#intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], net.sf.cglib.proxy.MethodProxy)
+ */
+ public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
+ Object result = invocationHandler.invoke(proxy, method, args);
+ return result;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java
new file mode 100644
index 0000000000..9acb4be6f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.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.invocation;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+/**
+ * Default implementation of a ProxyFactoryExtensionPoint.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultProxyFactoryExtensionPoint implements ProxyFactoryExtensionPoint {
+ private InterfaceContractMapper interfaceContractMapper;
+ private MessageFactory messageFactory;
+
+ private ProxyFactory interfaceFactory;
+ private ProxyFactory classFactory;
+
+ public DefaultProxyFactoryExtensionPoint(ExtensionPointRegistry extensionPoints) {
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
+
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = modelFactories.getFactory(MessageFactory.class);
+
+ interfaceFactory = new JDKProxyFactory(messageFactory, interfaceContractMapper);
+ }
+
+ public DefaultProxyFactoryExtensionPoint(MessageFactory messageFactory, InterfaceContractMapper mapper) {
+ this.interfaceContractMapper = mapper;
+ this.messageFactory = messageFactory;
+ interfaceFactory = new JDKProxyFactory(messageFactory, mapper);
+ }
+
+ public ProxyFactory getClassProxyFactory() {
+ return classFactory;
+ }
+
+ public ProxyFactory getInterfaceProxyFactory() {
+ return interfaceFactory;
+ }
+
+ public void setClassProxyFactory(ProxyFactory factory) {
+ this.classFactory = factory;
+
+ }
+
+ public void setInterfaceProxyFactory(ProxyFactory factory) {
+ this.interfaceFactory = factory;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java
new file mode 100644
index 0000000000..fcb48259b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.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.core.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+
+/**
+ * An extensible proxy factory.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class ExtensibleProxyFactory implements ProxyFactory {
+
+ private ProxyFactoryExtensionPoint proxyFactories;
+
+ public ExtensibleProxyFactory(ProxyFactoryExtensionPoint proxyFactories) {
+ this.proxyFactories = proxyFactories;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#cast(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
+ ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
+ if (interfaceFactory.isProxyClass(target.getClass())) {
+ return (R)interfaceFactory.cast(target);
+ } else if (classFactory != null && classFactory.isProxyClass(target.getClass())) {
+ return (R)classFactory.cast(target);
+ } else {
+ throw new IllegalArgumentException("The target is not a callable proxy");
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#createCallbackProxy(java.lang.Class,
+ * java.util.List)
+ */
+ public <T> T createCallbackProxy(Class<T> interfaze, List<RuntimeWire> wires) throws ProxyCreationException {
+ ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
+ ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
+ if (interfaze.isInterface()) {
+ return interfaceFactory.createCallbackProxy(interfaze, wires);
+ } else {
+ return classFactory.createCallbackProxy(interfaze, wires);
+ }
+ }
+
+ public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
+ ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
+ ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
+ if (callableReference.getBusinessInterface().isInterface()) {
+ return interfaceFactory.createProxy(callableReference);
+ } else {
+ return classFactory.createProxy(callableReference);
+ }
+ }
+
+ public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
+ ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
+ ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
+ if (callbackReference.getBusinessInterface().isInterface()) {
+ return interfaceFactory.createCallbackProxy(callbackReference);
+ } else {
+ return classFactory.createCallbackProxy(callbackReference);
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#createProxy(java.lang.Class,
+ * org.apache.tuscany.sca.runtime.RuntimeWire)
+ */
+ public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
+ ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
+ ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
+ if (interfaze.isInterface()) {
+ return interfaceFactory.createProxy(interfaze, wire);
+ } else {
+ return classFactory.createProxy(interfaze, wire);
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class)
+ */
+ public boolean isProxyClass(Class<?> clazz) {
+ ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
+ ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
+ return interfaceFactory.isProxyClass(clazz) || (classFactory != null && classFactory.isProxyClass(clazz));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java
new file mode 100644
index 0000000000..c26501e7d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.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.core.invocation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+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.Phase;
+
+/**
+ * Default implementation of an invocation chain
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvocationChainImpl implements InvocationChain {
+ private Operation sourceOperation;
+ private Operation targetOperation;
+ private List<Node> nodes = new ArrayList<Node>();
+
+ // FIXME: Not a good practice to use static reference
+ private static final PhaseManager phaseManager = new PhaseManager();
+ private boolean forReference;
+ private boolean allowsPassByReference;
+
+ public InvocationChainImpl(Operation sourceOperation, Operation targetOperation, boolean forReference) {
+ assert sourceOperation != null;
+ assert targetOperation != null;
+ this.targetOperation = targetOperation;
+ this.sourceOperation = sourceOperation;
+ this.forReference = forReference;
+ }
+
+ public Operation getTargetOperation() {
+ return targetOperation;
+ }
+
+ public void setTargetOperation(Operation operation) {
+ this.targetOperation = operation;
+ }
+
+ public void addInterceptor(Interceptor interceptor) {
+ String phase = forReference ? Phase.REFERENCE : Phase.SERVICE;
+ addInterceptor(phase, interceptor);
+ }
+
+ public void addInvoker(Invoker invoker) {
+ String phase = forReference ? Phase.REFERENCE_BINDING : Phase.IMPLEMENTATION;
+ addInvoker(phase, invoker);
+ }
+
+ public Invoker getHeadInvoker() {
+ return nodes.isEmpty() ? null : nodes.get(0).getInvoker();
+ }
+
+ public Invoker getTailInvoker() {
+ return nodes.isEmpty() ? null : nodes.get(nodes.size() - 1).getInvoker();
+ }
+
+ /**
+ * @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) {
+ addInterceptor(interceptor);
+ }
+
+ public void addInterceptor(String phase, Interceptor interceptor) {
+ addInvoker(phase, interceptor);
+ }
+
+ private void addInvoker(String phase, Invoker invoker) {
+ int index = phaseManager.getAllPhases().indexOf(phase);
+ if (index == -1) {
+ throw new IllegalArgumentException("Invalid phase name: " + phase);
+ }
+ Node node = new Node(index, invoker);
+ ListIterator<Node> li = nodes.listIterator();
+ Node before = null, after = null;
+ boolean found = false;
+ while (li.hasNext()) {
+ before = after;
+ after = li.next();
+ if (after.getPhaseIndex() > index) {
+ // Move back
+ li.previous();
+ li.add(node);
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ // Add to the end
+ nodes.add(node);
+ before = after;
+ after = null;
+ }
+
+ // Relink the interceptors
+ if (before != null) {
+ if (before.getInvoker() instanceof Interceptor) {
+ ((Interceptor)before.getInvoker()).setNext(invoker);
+ }
+ }
+ if (after != null) {
+ if (invoker instanceof Interceptor) {
+ ((Interceptor)invoker).setNext(after.getInvoker());
+ }
+ }
+
+ }
+
+ public boolean allowsPassByReference() {
+ if (allowsPassByReference) {
+ // No need to check the invokers
+ return true;
+ }
+ // Check if any of the invokers allows pass-by-reference
+ boolean allowsPBR = false;
+ for (Node i : nodes) {
+ if (i.getInvoker() instanceof DataExchangeSemantics) {
+ if (((DataExchangeSemantics)i.getInvoker()).allowsPassByReference()) {
+ allowsPBR = true;
+ break;
+ }
+ }
+ }
+ return allowsPBR;
+ }
+
+ public void setAllowsPassByReference(boolean allowsPBR) {
+ this.allowsPassByReference = allowsPBR;
+ }
+
+ private static class Node {
+ private int phaseIndex;
+ private Invoker invoker;
+
+ public Node(int phaseIndex, Invoker invoker) {
+ super();
+ this.phaseIndex = phaseIndex;
+ this.invoker = invoker;
+ }
+
+ public int getPhaseIndex() {
+ return phaseIndex;
+ }
+
+ public Invoker getInvoker() {
+ return invoker;
+ }
+
+ @Override
+ public String toString() {
+ return "(" + phaseIndex + ")" + invoker;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java
new file mode 100644
index 0000000000..cade0499d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.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.core.invocation;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.NoRegisteredCallbackException;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Responsible for dispatching to a callback through a wire. <p/> TODO cache
+ * target invoker
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDKCallbackInvocationHandler extends JDKInvocationHandler {
+ private static final long serialVersionUID = -3350283555825935609L;
+
+ public JDKCallbackInvocationHandler(MessageFactory messageFactory, CallbackReferenceImpl ref) {
+ super(messageFactory, ref);
+ this.fixedWire = false;
+ }
+
+ @Override
+ @SuppressWarnings( {"unchecked"})
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (Object.class == method.getDeclaringClass()) {
+ return invokeObjectMethod(method, args);
+ }
+
+ // obtain a dedicated wire to be used for this callback invocation
+ RuntimeWire wire = ((CallbackReferenceImpl)callableReference).getCallbackWire();
+ if (wire == null) {
+ //FIXME: need better exception
+ throw new ServiceRuntimeException("No callback wire found");
+ }
+
+ // set the conversational state based on the interface that
+ // is specified for the reference that this wire belongs to
+ initConversational(wire);
+
+ // set the conversation id into the conversation object. This is
+ // a special case for callbacks as, unless otherwise set manually,
+ // the callback should use the same conversation id as was received
+ // on the incoming call to this component
+ if (conversational) {
+
+ if (conversation == null || conversation.getState() == ConversationState.ENDED) {
+ conversation = null;
+ }
+ Object convID = conversation == null ? null : conversation.getConversationID();
+
+ // create a conversation id if one doesn't exist
+ // already, i.e. the conversation is just starting
+ if (convID == null) {
+ convID = ((CallbackReferenceImpl)callableReference).getConvID();
+ if (convID != null) {
+ conversation = ((RuntimeWireImpl)wire).getConversationManager().getConversation(convID);
+ if (callableReference != null) {
+ ((CallableReferenceImpl)callableReference).attachConversation(conversation);
+ }
+ }
+ }
+ }
+
+ setEndpoint(((CallbackReferenceImpl)callableReference).getResolvedEndpoint());
+
+ InvocationChain chain = getInvocationChain(method, wire);
+ if (chain == null) {
+ throw new IllegalArgumentException("No matching operation is found: " + method);
+ }
+
+ try {
+ return invoke(chain, args, wire, wire.getSource());
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t instanceof NoRegisteredCallbackException) {
+ throw t;
+ }
+ throw e;
+ } finally {
+ // allow the cloned wire to be reused by subsequent callbacks
+ ((RuntimeWireImpl)wire).releaseWire();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
new file mode 100644
index 0000000000..a23b9af9ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
@@ -0,0 +1,516 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetResolutionException;
+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.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+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.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ConversationEndedException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKInvocationHandler implements InvocationHandler, Serializable {
+ private static final long serialVersionUID = -3366410500152201371L;
+
+ protected boolean conversational;
+ protected ExtendedConversation conversation;
+ protected MessageFactory messageFactory;
+ protected EndpointReference source;
+ protected EndpointReference target;
+ protected RuntimeWire wire;
+ protected CallableReference<?> callableReference;
+ protected Class<?> businessInterface;
+
+ protected boolean fixedWire = true;
+
+ protected transient Map<Method, InvocationChain> chains = new HashMap<Method, InvocationChain>();
+
+ public JDKInvocationHandler(MessageFactory messageFactory, Class<?> businessInterface, RuntimeWire wire) {
+ this.messageFactory = messageFactory;
+ this.wire = wire;
+ this.businessInterface = businessInterface;
+ init(this.wire);
+ }
+
+ public JDKInvocationHandler(MessageFactory messageFactory, CallableReference<?> callableReference) {
+ this.messageFactory = messageFactory;
+ this.callableReference = callableReference;
+ if (callableReference != null) {
+ this.businessInterface = callableReference.getBusinessInterface();
+ this.conversation = (ExtendedConversation)callableReference.getConversation();
+ this.wire = ((CallableReferenceImpl<?>)callableReference).getRuntimeWire();
+ if (wire != null) {
+ init(wire);
+ }
+ }
+ }
+
+ protected void init(RuntimeWire wire) {
+ if (wire != null) {
+ try {
+ // Clone the endpoint reference so that reference parameters can be changed
+ source = (EndpointReference)wire.getSource().clone();
+ } catch (CloneNotSupportedException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ initConversational(wire);
+ }
+ }
+
+ protected void initConversational(RuntimeWire wire) {
+ InterfaceContract contract = wire.getSource().getInterfaceContract();
+ this.conversational = contract.getInterface().isConversational();
+ }
+
+ protected Object getCallbackID() {
+ if (callableReference != null) {
+ return callableReference.getCallbackID();
+ } else {
+ return null;
+ }
+ }
+
+ protected Object getConversationID() {
+ if (callableReference != null && callableReference instanceof ServiceReference) {
+ return ((ServiceReference)callableReference).getConversationID();
+ } else {
+ return null;
+ }
+ }
+
+ protected Object getCallbackObject() {
+ if (callableReference != null && callableReference instanceof ServiceReference) {
+ return ((ServiceReference)callableReference).getCallback();
+ } else {
+ return null;
+ }
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (Object.class == method.getDeclaringClass()) {
+ return invokeObjectMethod(method, args);
+ }
+ if (wire == null) {
+ throw new ServiceRuntimeException("No runtime wire is available");
+ }
+ InvocationChain chain = getInvocationChain(method, wire);
+ if (chain == null) {
+ throw new IllegalArgumentException("No matching operation is found: " + method);
+ }
+
+ // send the invocation down the wire
+ Object result = invoke(chain, args, wire, source);
+
+ return result;
+ }
+
+ /**
+ * Handle the methods on the Object.class
+ * @param method
+ * @param args
+ */
+ protected Object invokeObjectMethod(Method method, Object[] args) throws Throwable {
+ String name = method.getName();
+ if ("toString".equals(name)) {
+ return "[Proxy - " + toString() + "]";
+ } else if ("equals".equals(name)) {
+ Object obj = args[0];
+ if (obj == null) {
+ return false;
+ }
+ if (!Proxy.isProxyClass(obj.getClass())) {
+ return false;
+ }
+ return equals(Proxy.getInvocationHandler(obj));
+ } else if ("hashCode".equals(name)) {
+ return hashCode();
+ } else {
+ return method.invoke(this);
+ }
+ }
+
+ /**
+ * Determines if the given operation matches the given method
+ *
+ * @return true if the operation matches, false if does not
+ */
+ // FIXME: Should it be in the InterfaceContractMapper?
+ @SuppressWarnings("unchecked")
+ private static boolean match(Operation operation, Method method) {
+ if (operation instanceof JavaOperation) {
+ JavaOperation javaOp = (JavaOperation)operation;
+ Method m = javaOp.getJavaMethod();
+ if (!method.getName().equals(m.getName())) {
+ return false;
+ }
+ if (method.equals(m)) {
+ return true;
+ }
+ } else {
+ if (!method.getName().equals(operation.getName())) {
+ return false;
+ }
+ }
+
+ // For remotable interface, operation is not overloaded.
+ if (operation.getInterface().isRemotable()) {
+ return true;
+ }
+
+ Class<?>[] params = method.getParameterTypes();
+
+ DataType<List<DataType>> inputType = null;
+ if (operation.isWrapperStyle()) {
+ inputType = operation.getWrapper().getUnwrappedInputType();
+ } else {
+ 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];
+ Class<?> type = types.get(i).getPhysical();
+ // Object.class.isAssignableFrom(int.class) returns false
+ if (type != Object.class && (!type.isAssignableFrom(clazz))) {
+ matched = false;
+ }
+ }
+ } else {
+ matched = false;
+ }
+ return matched;
+
+ }
+
+ protected synchronized InvocationChain getInvocationChain(Method method, RuntimeWire wire) {
+ if (fixedWire && chains.containsKey(method)) {
+ return chains.get(method);
+ }
+ InvocationChain found = null;
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ Operation operation = chain.getSourceOperation();
+ if (operation.isDynamic()) {
+ operation.setName(method.getName());
+ found = chain;
+ break;
+ } else if (match(operation, method)) {
+ found = chain;
+ break;
+ }
+ }
+ if (fixedWire) {
+ chains.put(method, found);
+ }
+ return found;
+ }
+
+ protected void setEndpoint(EndpointReference endpoint) {
+ this.target = endpoint;
+ }
+
+ protected Object invoke(InvocationChain chain, Object[] args, RuntimeWire wire, EndpointReference source)
+ throws Throwable {
+ Message msg = messageFactory.createMessage();
+ msg.setFrom(source);
+ if (target != null) {
+ msg.setTo(target);
+ } else {
+ msg.setTo(wire.getTarget());
+ }
+ Invoker headInvoker = chain.getHeadInvoker();
+ Operation operation = chain.getTargetOperation();
+ msg.setOperation(operation);
+ msg.setBody(args);
+
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
+
+ conversationPreinvoke(msg, wire);
+ handleCallback(msg, wire, currentConversationID);
+ ThreadMessageContext.setMessageContext(msg);
+ boolean abnormalEndConversation = false;
+ try {
+ // dispatch the wire down the chain and get the response
+ Message resp = headInvoker.invoke(msg);
+ Object body = resp.getBody();
+ if (resp.isFault()) {
+ // mark the conversation as ended if the exception is not a business exception
+ if (currentConversationID != null ){
+ try {
+ boolean businessException = false;
+
+ for (DataType dataType : operation.getFaultTypes()){
+ if (dataType.getPhysical() == ((Throwable)body).getClass()){
+ businessException = true;
+ break;
+ }
+ }
+
+ if (businessException == false){
+ abnormalEndConversation = true;
+ }
+ } catch (Exception ex){
+ // TODO - sure what the best course of action is here. We have
+ // a system exception in the middle of a business exception
+ }
+ }
+ throw (Throwable)body;
+ }
+ return body;
+ } finally {
+ conversationPostInvoke(msg, wire, abnormalEndConversation);
+ ThreadMessageContext.setMessageContext(msgContext);
+ }
+ }
+
+ /**
+ * @param msg
+ * @param wire
+ * @param interfaze
+ * @throws TargetResolutionException
+ */
+ private void handleCallback(Message msg, RuntimeWire wire, Object currentConversationID)
+ throws TargetResolutionException {
+ ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
+ parameters.setCallbackID(getCallbackID());
+ if (msg.getFrom() == null || msg.getFrom().getCallbackEndpoint() == null) {
+ return;
+ }
+
+ parameters.setCallbackReference(msg.getFrom().getCallbackEndpoint());
+
+ // If we are passing out a callback target
+ // register the calling component instance against this
+ // new conversation id so that stateful callbacks will be
+ // able to find it
+ Object callbackObject = getCallbackObject();
+ if (conversational && callbackObject == null) {
+ // the component instance is already registered
+ // so add another registration
+ ScopeContainer<Object> scopeContainer = getConversationalScopeContainer(wire);
+
+ if (scopeContainer != null && currentConversationID != null) {
+ scopeContainer.addWrapperReference(currentConversationID, conversation.getConversationID());
+ }
+ }
+
+ Interface interfaze = msg.getFrom().getCallbackEndpoint().getInterfaceContract().getInterface();
+ if (callbackObject != null) {
+ if (callbackObject instanceof ServiceReference) {
+ EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
+ parameters.setCallbackReference(callbackRef);
+ } else {
+ if (interfaze != null) {
+ if (!interfaze.isConversational()) {
+ throw new IllegalArgumentException(
+ "Callback object for stateless callback is not a ServiceReference");
+ } else {
+ if (!(callbackObject instanceof Serializable)) {
+ throw new IllegalArgumentException(
+ "Callback object for stateful callback is not Serializable");
+ }
+ ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
+ if (scopeContainer != null) {
+ InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
+ scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
+ }
+ parameters.setCallbackObjectID(callbackObject);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Pre-invoke for the conversation handling
+ * @param msg
+ * @throws TargetResolutionException
+ */
+ private void conversationPreinvoke(Message msg, RuntimeWire wire) {
+ if (!conversational) {
+ // Not conversational or the conversation has been started
+ return;
+ }
+
+ ConversationManager conversationManager = ((RuntimeWireImpl)wire).getConversationManager();
+
+ if (conversation == null || conversation.getState() == ConversationState.ENDED) {
+
+ conversation = conversationManager.startConversation(getConversationID());
+
+ // if this is a local wire then set up the conversation timeouts here based on the
+ // parameters from the component
+ if (wire.getTarget().getComponent() != null){
+ conversation.initializeConversationAttributes(wire.getTarget().getComponent());
+ }
+
+ // connect the conversation to the CallableReference so it can be retrieve in the future
+ if (callableReference != null) {
+ ((CallableReferenceImpl)callableReference).attachConversation(conversation);
+ }
+ } else if (conversation.isExpired()) {
+ throw new ConversationEndedException("Conversation " + conversation.getConversationID() + " has expired.");
+ }
+
+ // if this is a local wire then schedule conversation timeouts based on the timeout
+ // parameters from the service implementation. If this isn't a local wire then
+ // the RuntimeWireInvoker will take care of this
+ if (wire.getTarget().getComponent() != null){
+ conversation.updateLastReferencedTime();
+ }
+
+ msg.getFrom().getReferenceParameters().setConversationID(conversation.getConversationID());
+
+ }
+
+ /**
+ * Post-invoke for the conversation handling
+ * @param wire
+ * @param operation
+ * @throws TargetDestructionException
+ */
+ @SuppressWarnings("unchecked")
+ private void conversationPostInvoke(Message msg, RuntimeWire wire, boolean abnormalEndConversation)
+ throws TargetDestructionException {
+ Operation operation = msg.getOperation();
+ ConversationSequence sequence = operation.getConversationSequence();
+ // We check that conversation has not already ended as there is only one
+ // conversation manager in the runtime and so, in the case of remote bindings,
+ // the conversation will already have been stopped when we get back to the client
+ if ((sequence == ConversationSequence.CONVERSATION_END || abnormalEndConversation) &&
+ (conversation.getState() != ConversationState.ENDED)) {
+
+ // remove conversation id from scope container
+ ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
+
+ if (scopeContainer != null) {
+ scopeContainer.remove(conversation.getConversationID());
+ }
+
+ conversation.end();
+ }
+ }
+
+ private ScopeContainer<Object> getConversationalScopeContainer(RuntimeWire wire) {
+ ScopeContainer<Object> scopeContainer = null;
+
+ RuntimeComponent runtimeComponent = wire.getSource().getComponent();
+
+ if (runtimeComponent instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)runtimeComponent;
+ ScopeContainer<Object> tmpScopeContainer = scopedRuntimeComponent.getScopeContainer();
+
+ if ((tmpScopeContainer != null) && (tmpScopeContainer.getScope() == Scope.CONVERSATION)) {
+ scopeContainer = tmpScopeContainer;
+ }
+ }
+
+ return scopeContainer;
+ }
+
+ /**
+ * Creates a new conversation id
+ *
+ * @return the conversation id
+ */
+ private Object createConversationID() {
+ if (getConversationID() != null) {
+ return getConversationID();
+ } else {
+ return UUID.randomUUID().toString();
+ }
+ }
+
+ /**
+ * @return the callableReference
+ */
+ public CallableReference<?> getCallableReference() {
+ return callableReference;
+ }
+
+ /**
+ * @param callableReference the callableReference to set
+ */
+ public void setCallableReference(CallableReference<?> callableReference) {
+ this.callableReference = callableReference;
+ }
+
+ /**
+ * Minimal wrapper for a callback object contained in a ServiceReference
+ */
+ private static class CallbackObjectWrapper<T> implements InstanceWrapper<T> {
+
+ private T instance;
+
+ private CallbackObjectWrapper(T instance) {
+ this.instance = instance;
+ }
+
+ public T getInstance() {
+ return instance;
+ }
+
+ public void start() {
+ // do nothing
+ }
+
+ public void stop() {
+ // do nothing
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java
new file mode 100644
index 0000000000..0992638318
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.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.core.invocation;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.List;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * the default implementation of a wire service that uses JDK dynamic proxies
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDKProxyFactory implements ProxyFactory {
+ protected InterfaceContractMapper contractMapper;
+ private MessageFactory messageFactory;
+
+ public JDKProxyFactory(MessageFactory messageFactory, InterfaceContractMapper mapper) {
+ this.contractMapper = mapper;
+ this.messageFactory = messageFactory;
+ }
+
+ /**
+ * The original createProxy method assumes that the proxy doesn't want to
+ * share conversation state so sets the conversation object to null
+ */
+ public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
+ ServiceReference<T> serviceReference = new ServiceReferenceImpl(interfaze, wire, this);
+ return createProxy(serviceReference);
+ }
+
+ public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
+ assert callableReference != null;
+ final Class<T> interfaze = callableReference.getBusinessInterface();
+ InvocationHandler handler = new JDKInvocationHandler(messageFactory, callableReference);
+ // Allow privileged access to class loader. Requires RuntimePermission in security policy.
+ ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return interfaze.getClassLoader();
+ }
+ });
+ Object proxy = Proxy.newProxyInstance(cl, new Class[] {interfaze}, handler);
+ ((CallableReferenceImpl)callableReference).setProxy(proxy);
+ return interfaze.cast(proxy);
+ }
+
+ public <T> T createCallbackProxy(Class<T> interfaze, List<RuntimeWire> wires) throws ProxyCreationException {
+ CallbackReferenceImpl<T> callbackReference = CallbackReferenceImpl.newInstance(interfaze, this, wires);
+ return callbackReference != null ? createCallbackProxy(callbackReference) : null;
+ }
+
+ public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
+ assert callbackReference != null;
+ Class<T> interfaze = callbackReference.getBusinessInterface();
+ InvocationHandler handler = new JDKCallbackInvocationHandler(messageFactory, callbackReference);
+ ClassLoader cl = interfaze.getClassLoader();
+ Object proxy = Proxy.newProxyInstance(cl, new Class[] {interfaze}, handler);
+ callbackReference.setProxy(proxy);
+ return interfaze.cast(proxy);
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ InvocationHandler handler = Proxy.getInvocationHandler(target);
+ if (handler instanceof JDKInvocationHandler) {
+ return (R)((JDKInvocationHandler)handler).getCallableReference();
+ } else {
+ throw new IllegalArgumentException("The object is not a known proxy.");
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class)
+ */
+ public boolean isProxyClass(Class<?> clazz) {
+ return Proxy.isProxyClass(clazz);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
new file mode 100644
index 0000000000..7d7fc583c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.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.invocation;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.interfacedef.Operation;
+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 Map<String, Object> header = new Hashtable<String, Object>();
+ private Object body;
+ private Object messageID;
+ private boolean isFault;
+ private Operation operation;
+ private Map<String, Object> qosContext = new Hashtable<String, Object>();
+
+ private EndpointReference from;
+ private EndpointReference to;
+
+ public MessageImpl() {
+ this.from = new EndpointReferenceImpl("/");
+ this.to = new EndpointReferenceImpl("/");
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getBody() {
+ return (T)body;
+ }
+
+ public <T> void setBody(T body) {
+ this.isFault = false;
+ this.body = body;
+ }
+
+ public Object getMessageID() {
+ return messageID;
+ }
+
+ public void setMessageID(Object messageId) {
+ this.messageID = messageId;
+ }
+
+ 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;
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+
+ public void setOperation(Operation op) {
+ this.operation = op;
+ }
+
+ public Map<String, Object> getQoSContext() {
+ return qosContext;
+ }
+
+ public Map<String, Object> getHeader() {
+ return qosContext;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java
new file mode 100644
index 0000000000..733544d387
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
new file mode 100644
index 0000000000..60f90fb6b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.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.core.invocation;
+
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+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();
+
+ /**
+ * The JDK logger that will be used to log messages.
+ */
+ private static final Logger LOGGER = Logger.getLogger(NonBlockingInterceptor.class.getName());
+
+ 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;
+ }
+
+ /**
+ * Sets desired workScheduler to NonBlockingInterceptor. This is a useful function for the extension framework
+ * to set desired workmanager on the InvocationChain, other than default workmanager which is set per Tuscany runtime.
+ * Using this function, extension framework can set desired workmanager on InvocationChain during post wire processing.
+ * @param workScheduler workScheduler which contains workmanager
+ */
+ public void setWorkScheduler(WorkScheduler workScheduler){
+ this.workScheduler = workScheduler;
+ }
+
+ public Message invoke(final Message msg) {
+ // Schedule the invocation of the next interceptor in a new Work instance
+ try {
+ workScheduler.scheduleWork(new Runnable() {
+ public void run() {
+ Message context = ThreadMessageContext.setMessageContext(msg);
+ try {
+ Message response = null;
+
+ Throwable ex = null;
+ try {
+ response = next.invoke(msg);
+ } catch (Throwable t) {
+ ex = t;
+ }
+
+ // Tuscany-2225 - Did the @OneWay method complete successfully?
+ // (i.e. no exceptions)
+ if (response != null && response.isFault()) {
+ // The @OneWay method threw an Exception. Lets log it and
+ // then pass it on to the WorkScheduler so it can notify any
+ // listeners
+ ex = (Throwable)response.getBody();
+ }
+ if (ex != null) {
+ LOGGER.log(Level.SEVERE, "Exception from @OneWay invocation", ex);
+ throw new ServiceRuntimeException("Exception from @OneWay invocation", ex);
+ }
+ } 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 {
+
+ @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 boolean isFault() {
+ return false;
+ }
+
+ public void setFaultBody(Object fault) {
+ throw new UnsupportedOperationException();
+ }
+
+ 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();
+ }
+
+ public Operation getOperation() {
+ return null;
+ }
+
+ public void setOperation(Operation op) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Message#getReplyTo()
+ */
+ public EndpointReference getReplyTo() {
+ return null;
+ }
+
+ public Map<String, Object> getQoSContext() {
+ return null;
+ }
+
+ public Map<String, Object> getHeader() {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java
new file mode 100644
index 0000000000..94d67bffcc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PhaseManager {
+ private static final Logger log = Logger.getLogger(PhaseManager.class.getName());
+
+ public static final String STAGE_REFERENCE = "reference";
+ public static final String STAGE_SERVICE = "service";
+ public static final String STAGE_IMPLEMENTATION = "implementation";
+ private static final String[] SYSTEM_REFERENCE_PHASES =
+ {Phase.REFERENCE, Phase.REFERENCE_INTERFACE, Phase.REFERENCE_POLICY, Phase.REFERENCE_BINDING};
+
+ private static final String[] SYSTEM_SERVICE_PHASES =
+ {Phase.SERVICE_BINDING, Phase.SERVICE_POLICY, Phase.SERVICE_INTERFACE, Phase.SERVICE};
+
+ private static final String[] SYSTEM_IMPLEMENTATION_PHASES = {Phase.IMPLEMENTATION_POLICY, Phase.IMPLEMENTATION};
+
+ private String pattern = Phase.class.getName();
+ private Map<String, Stage> stages;
+ private List<String> phases;
+
+ public class Stage {
+ private String name;
+ private PhaseSorter<String> sorter = new PhaseSorter<String>();
+ private Set<String> firstSet = new HashSet<String>();
+ private Set<String> lastSet = new HashSet<String>();
+ private List<String> phases = new ArrayList<String>();
+
+ public Stage(String name) {
+ super();
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public PhaseSorter<String> getSorter() {
+ return sorter;
+ }
+
+ public Set<String> getFirstSet() {
+ return firstSet;
+ }
+
+ public Set<String> getLastSet() {
+ return lastSet;
+ }
+
+ public List<String> getPhases() {
+ return phases;
+ }
+
+ @Override
+ public String toString() {
+ return name + phases;
+ }
+ }
+
+ // For unit test purpose
+ PhaseManager(String pattern) {
+ super();
+ this.pattern = pattern;
+ }
+
+ public PhaseManager() {
+ }
+
+ private List<String> getPhases(String stage) {
+ Stage s = getStages().get(stage);
+ return s == null ? null : s.getPhases();
+ }
+
+ public List<String> getReferencePhases() {
+ return getPhases(STAGE_REFERENCE);
+ }
+
+ public List<String> getServicePhases() {
+ return getPhases(STAGE_SERVICE);
+ }
+
+ public List<String> getImplementationPhases() {
+ return getPhases(STAGE_IMPLEMENTATION);
+ }
+
+ public synchronized List<String> getAllPhases() {
+ if (phases == null) {
+ phases = new ArrayList<String>();
+ phases.addAll(getReferencePhases());
+ phases.addAll(getServicePhases());
+ phases.addAll(getImplementationPhases());
+ }
+ return phases;
+ }
+
+ public synchronized Map<String, Stage> getStages() {
+ if (stages != null) {
+ return stages;
+ }
+ init();
+
+ Set<ServiceDeclaration> services;
+ try {
+ services = ServiceDiscovery.getInstance().getServiceDeclarations(pattern);
+ } catch (IOException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ for (ServiceDeclaration d : services) {
+ if (log.isLoggable(Level.FINE)) {
+ log.fine(d.getLocation() + ": " + d.getAttributes());
+ }
+ String name = d.getAttributes().get("name");
+ if (name == null) {
+ throw new ServiceRuntimeException("Required attribute 'name' is missing.");
+ }
+ String stageName = d.getAttributes().get("stage");
+ if (stageName == null) {
+ throw new ServiceRuntimeException("Required attribute 'stage' is missing.");
+ }
+ Stage stage = stages.get(stageName);
+ if (stage == null) {
+ throw new ServiceRuntimeException("Invalid stage: " + stage);
+ }
+ PhaseSorter<String> graph = stage.getSorter();
+ Set<String> firstSet = stage.getFirstSet(), lastSet = stage.getLastSet();
+
+ String before = d.getAttributes().get("before");
+ String after = d.getAttributes().get("after");
+ if (before != null) {
+ StringTokenizer tokenizer = new StringTokenizer(before);
+ while (tokenizer.hasMoreTokens()) {
+ String p = tokenizer.nextToken();
+ if (!"*".equals(p)) {
+ graph.addEdge(name, p);
+ } else {
+ firstSet.add(name);
+ }
+ }
+ }
+ if (after != null) {
+ StringTokenizer tokenizer = new StringTokenizer(after);
+ while (tokenizer.hasMoreTokens()) {
+ String p = tokenizer.nextToken();
+ if (!"*".equals(p)) {
+ graph.addEdge(p, name);
+ } else {
+ lastSet.add(name);
+ }
+ }
+ }
+ graph.addVertext(name);
+ if(firstSet.size()>1) {
+ log.warning("More than one phases are declared to be first: "+firstSet);
+ }
+ for (String s : firstSet) {
+ for (String v : new HashSet<String>(graph.getVertices().keySet())) {
+ if (!firstSet.contains(v)) {
+ graph.addEdge(s, v);
+ }
+ }
+ }
+ if(lastSet.size()>1) {
+ log.warning("More than one phases are declared to be the last: "+lastSet);
+ }
+ for (String s : lastSet) {
+ for (String v : new HashSet<String>(graph.getVertices().keySet())) {
+ if (!lastSet.contains(v)) {
+ graph.addEdge(v, s);
+ }
+ }
+ }
+
+ }
+
+ for (Stage s : stages.values()) {
+ List<String> phases = s.getSorter().topologicalSort(false);
+ s.getPhases().clear();
+ s.getPhases().addAll(phases);
+ }
+ if (log.isLoggable(Level.FINE)) {
+ log.fine("Stages: " + stages);
+ }
+ return stages;
+ }
+
+ private void init() {
+ stages = new HashMap<String, Stage>();
+
+ Stage referenceStage = new Stage(STAGE_REFERENCE);
+ for (int i = 1; i < SYSTEM_REFERENCE_PHASES.length; i++) {
+ referenceStage.getSorter().addEdge(SYSTEM_REFERENCE_PHASES[i - 1], SYSTEM_REFERENCE_PHASES[i]);
+ }
+ referenceStage.getLastSet().add(Phase.REFERENCE_BINDING);
+ stages.put(referenceStage.getName(), referenceStage);
+
+ Stage serviceStage = new Stage(STAGE_SERVICE);
+ for (int i = 1; i < SYSTEM_SERVICE_PHASES.length; i++) {
+ serviceStage.getSorter().addEdge(SYSTEM_SERVICE_PHASES[i - 1], SYSTEM_SERVICE_PHASES[i]);
+ }
+ stages.put(serviceStage.getName(), serviceStage);
+
+ Stage implementationStage = new Stage(STAGE_IMPLEMENTATION);
+ for (int i = 1; i < SYSTEM_IMPLEMENTATION_PHASES.length; i++) {
+ implementationStage.getSorter().addEdge(SYSTEM_IMPLEMENTATION_PHASES[i - 1],
+ SYSTEM_IMPLEMENTATION_PHASES[i]);
+ }
+ implementationStage.getLastSet().add(Phase.IMPLEMENTATION);
+ stages.put(implementationStage.getName(), implementationStage);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java
new file mode 100644
index 0000000000..fc4bea3d9f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Directed, weighted graph
+ *
+ * @param <V> The type of vertex object
+ * @param <E> The type of edge object
+ *
+ * @version $Rev$ $Date$
+ */
+public class PhaseSorter<V> implements Cloneable {
+ private final Map<V, Vertex> vertices = new HashMap<V, Vertex>();
+
+ /**
+ * 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 Map<Vertex, Edge> inEdges = new HashMap<Vertex, Edge>();
+
+ private Vertex(V value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "(" + value + ")";
+ }
+
+ public V getValue() {
+ return value;
+ }
+
+ public Map<Vertex, Edge> getOutEdges() {
+ return outEdges;
+ }
+
+ public Map<Vertex, Edge> getInEdges() {
+ return inEdges;
+ }
+
+ }
+
+ /**
+ * An Edge connects two vertices in one direction
+ */
+ public final class Edge {
+ private Vertex sourceVertex;
+
+ private Vertex targetVertex;
+
+ public Edge(Vertex source, Vertex target) {
+ this.sourceVertex = source;
+ this.targetVertex = target;
+ }
+
+ @Override
+ public String toString() {
+ return sourceVertex + "->" + targetVertex;
+ }
+
+ public Vertex getTargetVertex() {
+ return targetVertex;
+ }
+
+ public void setTargetVertex(Vertex vertex) {
+ this.targetVertex = vertex;
+ }
+
+ public Vertex getSourceVertex() {
+ return sourceVertex;
+ }
+
+ public void setSourceVertex(Vertex sourceVertex) {
+ this.sourceVertex = sourceVertex;
+ }
+ }
+
+ public void addEdge(V source, V target) {
+ 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);
+ s.outEdges.put(t, edge);
+ t.inEdges.put(s, edge);
+ }
+
+ public void addVertext(V source) {
+ Vertex s = getVertex(source);
+ if (s == null) {
+ s = new Vertex(source);
+ vertices.put(source, s);
+ }
+ }
+
+ 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 && t.inEdges.remove(s) != null;
+
+ }
+
+ public void removeEdge(Edge edge) {
+ edge.sourceVertex.outEdges.remove(edge.targetVertex);
+ edge.targetVertex.inEdges.remove(edge.sourceVertex);
+ }
+
+ public void removeVertex(Vertex vertex) {
+ vertices.remove(vertex.getValue());
+ for (Edge e : new ArrayList<Edge>(vertex.outEdges.values())) {
+ removeEdge(e);
+ }
+ for (Edge e : new ArrayList<Edge>(vertex.inEdges.values())) {
+ removeEdge(e);
+ }
+ }
+
+ public Edge getEdge(Vertex source, Vertex target) {
+ return source.outEdges.get(target);
+ }
+
+ public Edge getEdge(V source, V target) {
+ Vertex sv = getVertex(source);
+ if (sv == null) {
+ return null;
+ }
+ Vertex tv = getVertex(target);
+ if (tv == null) {
+ return null;
+ }
+ return getEdge(getVertex(source), getVertex(target));
+ }
+
+ @Override
+ 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(PhaseSorter<V> otherGraph) {
+ for (Vertex v : otherGraph.vertices.values()) {
+ for (Edge e : v.outEdges.values()) {
+ addEdge(e.sourceVertex.value, e.targetVertex.value);
+ }
+ }
+ }
+
+ private Vertex getFirst() {
+ for (Vertex v : vertices.values()) {
+ if (v.inEdges.isEmpty()) {
+ return v;
+ }
+ }
+ if (!vertices.isEmpty()) {
+ throw new IllegalArgumentException("Circular ordering has been detected: " + toString());
+ } else {
+ return null;
+ }
+ }
+
+ public List<V> topologicalSort(boolean readOnly) {
+ PhaseSorter<V> graph = (!readOnly) ? this : (PhaseSorter<V>)clone();
+ List<V> list = new ArrayList<V>();
+ while (true) {
+ Vertex v = graph.getFirst();
+ if (v == null) {
+ break;
+ }
+ list.add(v.getValue());
+ graph.removeVertex(v);
+ }
+
+ return list;
+ }
+
+ @Override
+ public Object clone() {
+ PhaseSorter<V> copy = new PhaseSorter<V>();
+ copy.addGraph(this);
+ return copy;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java
new file mode 100644
index 0000000000..0b36b178f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java
new file mode 100644
index 0000000000..cb836e42c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.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.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 given CallableReference
+ *
+ * @param callableReference The CallableReference
+ * @return the proxy
+ * @throws ProxyCreationException
+ */
+ <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException;
+
+ /**
+ * Creates a Java proxy for the service contract callback
+ *
+ * @param interfaze the interface the proxy should implement
+ * @return the proxy
+ * @throws ProxyCreationException
+ */
+ <T> T createCallbackProxy(Class<T> interfaze, List<RuntimeWire> wires) throws ProxyCreationException;
+
+ /**
+ * Creates a Java proxy for the given callback reference
+ *
+ * @param callableReference The CallableReference
+ * @return the proxy
+ * @throws ProxyCreationException
+ */
+ <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException;
+
+ /**
+ * Cast a proxy to a CallableReference.
+ *
+ * @param target a proxy generated by this implementation
+ * @return a CallableReference (or subclass) equivalent to this proxy
+ * @throws IllegalArgumentException if the object supplied is not a proxy
+ */
+ <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Test if a given class is a generated proxy class by this factory
+ * @param clazz A java class or interface
+ * @return true if the class is a generated proxy class by this factory
+ */
+ boolean isProxyClass(Class<?> clazz);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java
new file mode 100644
index 0000000000..875a252798
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.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.invocation;
+
+
+/**
+ * The extension point to plug in proxy factories
+ * @version $Rev$ $Date$
+ */
+public interface ProxyFactoryExtensionPoint {
+
+ /**
+ * Get the proxy factory for java interfaces
+ * @return
+ */
+ ProxyFactory getInterfaceProxyFactory();
+
+ /**
+ * Get the proxy factory for java classes
+ * @return
+ */
+ ProxyFactory getClassProxyFactory();
+
+ /**
+ * Set the proxy factory for java interfaces
+ * @param factory
+ */
+ void setInterfaceProxyFactory(ProxyFactory factory);
+
+ /**
+ * Set the proxy factory for java classes
+ * @param factory
+ */
+ void setClassProxyFactory(ProxyFactory factory);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
new file mode 100644
index 0000000000..c007669bdf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.invocation;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetResolutionException;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+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.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.ConversationEndedException;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeWireInvoker {
+ protected ConversationManager conversationManager;
+ protected boolean conversational;
+ protected ExtendedConversation conversation;
+ protected MessageFactory messageFactory;
+ protected Object conversationID;
+ protected Object callbackID;
+ protected Object callbackObject;
+ protected RuntimeWire wire;
+
+ public RuntimeWireInvoker(MessageFactory messageFactory, ConversationManager conversationManager, RuntimeWire wire) {
+ this.messageFactory = messageFactory;
+ this.wire = wire;
+ this.conversationManager = conversationManager;
+ init(wire);
+ }
+
+ protected void init(RuntimeWire wire) {
+ if (wire != null) {
+ ReferenceParameters parameters = wire.getSource().getReferenceParameters();
+ this.callbackID = parameters.getCallbackID();
+ this.callbackObject = parameters.getCallbackReference();
+ this.conversationID = parameters.getConversationID();
+ InterfaceContract contract = wire.getSource().getInterfaceContract();
+ this.conversational = contract.getInterface().isConversational();
+ }
+ }
+
+ public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
+ return invoke(wire, operation, msg);
+ }
+
+ public Object invoke(RuntimeWire wire, Operation operation, Message msg) throws InvocationTargetException {
+ RuntimeWire runtimeWire = wire == null ? this.wire : wire;
+ InvocationChain chain = runtimeWire.getInvocationChain(operation);
+ return invoke(chain, msg, runtimeWire);
+ }
+
+ protected Object invoke(InvocationChain chain, Message msg, RuntimeWire wire) throws InvocationTargetException {
+ EndpointReference from = msg.getFrom();
+ EndpointReference epFrom = wire.getSource();
+ if (from != null) {
+ from.mergeEndpoint(epFrom);
+ } else {
+ msg.setFrom(epFrom);
+ }
+ msg.setTo(wire.getTarget());
+
+ Invoker headInvoker = chain.getHeadInvoker();
+ Operation operation = chain.getTargetOperation();
+ msg.setOperation(operation);
+
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
+
+ ThreadMessageContext.setMessageContext(msg);
+ try {
+ conversationPreinvoke(msg);
+ // handleCallback(msg, currentConversationID);
+ // dispatch the wire down the chain and get the response
+ Message resp = headInvoker.invoke(msg);
+ Object body = resp.getBody();
+ if (resp.isFault()) {
+ throw new InvocationTargetException((Throwable)body);
+ }
+ return body;
+ } catch (InvocationTargetException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new ServiceRuntimeException(e);
+ } finally {
+ try {
+ conversationPostInvoke(msg);
+ } catch (TargetDestructionException e) {
+ throw new ServiceRuntimeException(e);
+ } finally {
+ ThreadMessageContext.setMessageContext(msgContext);
+ }
+ }
+ }
+
+ /**
+ * @param msgContext
+ */
+ protected EndpointReference getCallbackEndpoint(Message msgContext) {
+ EndpointReference from = msgContext.getFrom();
+ return from == null ? null : from.getReferenceParameters().getCallbackReference();
+ }
+
+ /**
+ * Pre-invoke for the conversation handling
+ * @param msg
+ * @throws TargetResolutionException
+ */
+ private void conversationPreinvoke(Message msg) {
+ if (conversational) {
+ ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
+ // in some cases the ConversationID that should be used comes in with the
+ // message, e.g. when ws binding is in use.
+ Object convID = parameters.getConversationID();
+ if (convID != null) {
+ conversationID = convID;
+ }
+ conversation = conversationManager.getConversation(conversationID);
+
+ if (conversation == null || conversation.getState() == ConversationState.ENDED) {
+ conversation = conversationManager.startConversation(conversationID);
+ conversation.initializeConversationAttributes(wire.getTarget().getComponent());
+ } else if (conversation.conversationalAttributesInitialized() == false) {
+ conversation.initializeConversationAttributes(wire.getTarget().getComponent());
+ } else if (conversation.isExpired()){
+ throw new ConversationEndedException("Conversation has expired.");
+ }
+
+ conversation.updateLastReferencedTime();
+
+ parameters.setConversationID(conversation.getConversationID());
+ }
+ }
+
+ /**
+ * Post-invoke for the conversation handling
+ * @param wire
+ * @param operation
+ * @throws TargetDestructionException
+ */
+ @SuppressWarnings("unchecked")
+ private void conversationPostInvoke(Message msg) throws TargetDestructionException {
+ if (conversational) {
+ Operation operation = msg.getOperation();
+ ConversationSequence sequence = operation.getConversationSequence();
+ if (sequence == ConversationSequence.CONVERSATION_END) {
+ // in some cases the ConversationID that should be used comes in with the
+ // message, e.g. when ws binding is in use.
+ Object convID = msg.getFrom().getReferenceParameters().getConversationID();
+ if (convID != null) {
+ conversationID = convID;
+ }
+ conversation = conversationManager.getConversation(conversationID);
+
+ // remove conversation id from scope container
+ ScopeContainer scopeContainer = getConversationalScopeContainer(msg);
+
+ if (scopeContainer != null) {
+ scopeContainer.remove(conversation.getConversationID());
+ }
+
+ conversation.end();
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private ScopeContainer getConversationalScopeContainer(Message msg) {
+ ScopeContainer scopeContainer = null;
+
+ RuntimeComponent component = msg.getTo().getComponent();
+
+ if (component instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
+ ScopeContainer container = scopedRuntimeComponent.getScopeContainer();
+
+ if ((container != null) && (container.getScope() == Scope.CONVERSATION)) {
+ scopeContainer = container;
+ }
+ }
+
+ return scopeContainer;
+ }
+
+
+ /**
+ * Minimal wrapper for a callback object contained in a ServiceReference
+ */
+ private static class CallbackObjectWrapper<T> implements InstanceWrapper<T> {
+
+ private T instance;
+
+ private CallbackObjectWrapper(T instance) {
+ this.instance = instance;
+ }
+
+ public T getInstance() {
+ return instance;
+ }
+
+ public void start() {
+ // do nothing
+ }
+
+ public void stop() {
+ // do nothing
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java
new file mode 100644
index 0000000000..2c4d657882
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/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.core.invocation;
+
+/**
+ * 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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
new file mode 100644
index 0000000000..504bd9b036
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.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.invocation;
+
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Class for tunnelling 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>() {
+ @Override
+ protected synchronized Message initialValue() {
+ Message msg = new MessageImpl();
+ msg.setFrom(new EndpointReferenceImpl("/"));
+ return msg;
+ }
+ };
+
+ 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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java
new file mode 100644
index 0000000000..246f9c45d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.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.invocation;
+
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.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;
+
+ /**
+ * 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) {
+ this.interfaze = interfaze;
+ this.wire = wire;
+ this.proxyService = proxyService;
+ }
+
+ public T getInstance() throws ObjectCreationException {
+ return new ServiceReferenceImpl<T>(interfaze, wire, proxyService).getProxy();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
new file mode 100644
index 0000000000..1168d1d0dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.core.scope;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Implements functionality common to scope contexts.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractScopeContainer<KEY> implements ScopeContainer<KEY> {
+ protected Map<KEY, InstanceWrapper<?>> wrappers = new ConcurrentHashMap<KEY, InstanceWrapper<?>>();
+ protected final Scope scope;
+
+ protected RuntimeComponent component;
+ protected volatile int lifecycleState = UNINITIALIZED;
+
+
+ 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 getWrapper(contextId); // TODO: what is this method supposed to do diff than getWrapper?
+ }
+
+ public Scope getScope() {
+ return scope;
+ }
+
+ public InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
+ return wrappers.get(contextId);
+ }
+
+ public void addWrapperReference(KEY existingContextId, KEY newContextId)
+ throws TargetResolutionException {
+ // do nothing here. the conversational scope container implements this
+ }
+
+ public void registerWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetResolutionException {
+ // do nothing here. the conversational scope container implements this
+ }
+
+ 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 returnWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetDestructionException {
+ }
+
+ /**
+ * Default implementation of remove which does nothing
+ *
+ * @param contextId the identifier of the context to remove.
+ */
+ public void remove(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);
+ }
+
+ @Override
+ public String toString() {
+ String s;
+ switch (lifecycleState) {
+ case ScopeContainer.CONFIG_ERROR:
+ s = "CONFIG_ERROR";
+ break;
+ case ScopeContainer.ERROR:
+ s = "ERROR";
+ break;
+ case ScopeContainer.INITIALIZING:
+ s = "INITIALIZING";
+ break;
+ case ScopeContainer.INITIALIZED:
+ s = "INITIALIZED";
+ break;
+ case ScopeContainer.RUNNING:
+ s = "RUNNING";
+ break;
+ case ScopeContainer.STOPPING:
+ s = "STOPPING";
+ break;
+ case ScopeContainer.STOPPED:
+ s = "STOPPED";
+ break;
+ case ScopeContainer.UNINITIALIZED:
+ s = "UNINITIALIZED";
+ break;
+ default:
+ s = "UNKNOWN";
+ break;
+ }
+ return "In state [" + s + ']';
+ }
+
+ public RuntimeComponent getComponent() {
+ return component;
+ }
+
+ public void setComponent(RuntimeComponent component) {
+ this.component = component;
+ }
+
+ 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;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java
new file mode 100644
index 0000000000..7e7ab7a9e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.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.core.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * 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);
+ }
+
+ @Override
+ public synchronized void stop() {
+ super.stop();
+ if (wrapper != null) {
+ try {
+ wrapper.stop();
+ } catch (TargetDestructionException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ wrapper = null;
+ }
+
+ @Override
+ public synchronized InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
+ if (wrapper == null) {
+ wrapper = createInstanceWrapper();
+ wrapper.start();
+ }
+ return wrapper;
+ }
+
+ @Override
+ 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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java
new file mode 100644
index 0000000000..786988613b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.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.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
new file mode 100644
index 0000000000..3ae1ca51c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
@@ -0,0 +1,290 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.conversation.ConversationListener;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.store.Store;
+
+/**
+ * A scope context which manages atomic component instances keyed on ConversationID
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationalScopeContainer extends AbstractScopeContainer<Object> implements ConversationListener {
+ private ConversationManager conversationManager;
+ private Map<Object, InstanceLifeCycleWrapper> instanceLifecycleCollection =
+ new ConcurrentHashMap<Object, InstanceLifeCycleWrapper>();
+
+ public ConversationalScopeContainer(Store aStore, RuntimeComponent component) {
+ super(Scope.CONVERSATION, component);
+
+ // Note: aStore is here to preserve the original factory interface. It is not currently used in this
+ // implementation since we do not support instance persistence.
+
+ // Check System properties to see if timeout values have been specified. All timeout values
+ // will be specified in seconds.
+ //
+
+ }
+
+
+ protected InstanceWrapper getInstanceWrapper(boolean create, Object contextId) throws TargetResolutionException {
+
+ // we might get a null context if the target service has
+ // conversational scope but only its callback interface
+ // is conversational. In this case we need to invent a
+ // conversation Id here to store the service against
+ // and populate the thread context
+ if (contextId == null) {
+ contextId = UUID.randomUUID().toString();
+ Message msgContext = ThreadMessageContext.getMessageContext();
+
+ if (msgContext != null) {
+ msgContext.getFrom().getReferenceParameters().setConversationID(contextId);
+ }
+ }
+
+ InstanceLifeCycleWrapper anInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
+
+ if (anInstanceWrapper == null && !create)
+ return null;
+
+ if (anInstanceWrapper == null) {
+ anInstanceWrapper = new InstanceLifeCycleWrapper(contextId);
+ this.instanceLifecycleCollection.put(contextId, anInstanceWrapper);
+ }
+
+ return anInstanceWrapper.getInstanceWrapper(contextId);
+
+ }
+
+ @Override
+ public InstanceWrapper getWrapper(Object contextId) throws TargetResolutionException {
+ return getInstanceWrapper(true, contextId);
+ }
+
+ /**
+ * This method allows a new context id to be registered alongside an existing one. This happens in
+ * one case, when a conversation includes a stateful callback. The client component instance
+ * must be registered against all outgoing conversation ids so that the component instance
+ * can be found when the callback arrives
+ *
+ * @param existingContextId the context id against which the component is already registered
+ * @param context this should be a conversation object so that the conversation can b stored
+ * and reset when the component instance is removed
+ */
+ @Override
+ public void addWrapperReference(Object existingContextId, Object contextId) throws TargetResolutionException {
+
+
+ // get the instance wrapper via the existing id
+ InstanceLifeCycleWrapper existingInstanceWrapper = this.instanceLifecycleCollection.get(existingContextId);
+ InstanceLifeCycleWrapper newInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
+
+ // only add the extra reference once
+ if (newInstanceWrapper == null) {
+ // add the id to the list of ids that the wrapper holds. Used for reference
+ // counting and conversation resetting on destruction.
+ existingInstanceWrapper.addCallbackConversation(contextId);
+
+ // add the reference to the collection
+ this.instanceLifecycleCollection.put(contextId, existingInstanceWrapper);
+ }
+ }
+
+ @Override
+ public void registerWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException {
+ // if a wrapper for a different instance is already registered for this contextId, remove it
+ InstanceLifeCycleWrapper anInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
+ if (anInstanceWrapper != null) {
+ if (anInstanceWrapper.getInstanceWrapper(contextId).getInstance() != wrapper.getInstance()) {
+ remove(contextId);
+ } else {
+ return;
+ }
+ }
+
+ anInstanceWrapper = new InstanceLifeCycleWrapper(wrapper, contextId);
+ this.instanceLifecycleCollection.put(contextId, anInstanceWrapper);
+ }
+
+ // The remove is invoked when a conversation is explicitly ended. This can occur by using the @EndsConversation or API.
+ // In this case the instance is immediately removed. A new conversation will be started on the next operation
+ // associated with this conversationId's service reference.
+ //
+ @Override
+ public void remove(Object contextId) throws TargetDestructionException {
+ if (contextId != null) {
+ if (this.instanceLifecycleCollection.containsKey(contextId)) {
+ InstanceLifeCycleWrapper anInstanceLifeCycleWrapper = this.instanceLifecycleCollection.get(contextId);
+ this.instanceLifecycleCollection.remove(contextId);
+ anInstanceLifeCycleWrapper.removeInstanceWrapper(contextId);
+ }
+ }
+ }
+
+ /*
+ * This is an inner class that keeps track of the lifecycle of a conversation scoped
+ * implementation instance.
+ *
+ */
+
+ private class InstanceLifeCycleWrapper {
+ private Object clientConversationId;
+ private List<Object> callbackConversations = new ArrayList<Object>();
+
+ private InstanceLifeCycleWrapper(Object contextId) throws TargetResolutionException {
+ this.clientConversationId = contextId;
+ this.createInstance(contextId);
+ }
+
+ private InstanceLifeCycleWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException {
+ this.clientConversationId = contextId;
+ wrappers.put(contextId, wrapper);
+ }
+
+
+ // Associates a callback conversation with this instance. Each time the scope container
+ // is asked to remove an object given a ontextId an associated conversation object will
+ // have its conversationId reset to null. When the list of ids is empty the component instance
+ // will be removed from the scope container
+ private void addCallbackConversation(Object conversationID) {
+ InstanceWrapper ctx = getInstanceWrapper(clientConversationId);
+ callbackConversations.add(conversationID);
+ wrappers.put(conversationID, ctx);
+ }
+
+ //
+ // Return the backing implementation instance
+ //
+ private InstanceWrapper getInstanceWrapper(Object contextId) {
+ InstanceWrapper ctx = wrappers.get(contextId);
+ return ctx;
+ }
+
+ private void removeInstanceWrapper(Object contextId) throws TargetDestructionException {
+ InstanceWrapper ctx = getInstanceWrapper(contextId);
+ wrappers.remove(contextId);
+
+ // find out if we are dealing with the original client conversation id
+ // and reset accordingly
+ if ( ( clientConversationId != null ) && ( clientConversationId.equals(contextId)) ) {
+ clientConversationId = null;
+ } else {
+ // reset the conversationId in the conversation object if present
+ // so that and ending callback causes the conversation in the originating
+ // service reference in the client to be reset
+ callbackConversations.remove(contextId);
+ }
+
+ // stop the component if this removes the last reference
+ if (clientConversationId == null && callbackConversations.isEmpty()) {
+ ctx.stop();
+ }
+ }
+
+ private void createInstance(Object contextId) throws TargetResolutionException {
+ InstanceWrapper instanceWrapper = createInstanceWrapper();
+ instanceWrapper.start();
+ wrappers.put(contextId, instanceWrapper);
+ }
+
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationEnded(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ */
+ public void conversationEnded(ExtendedConversation conversation) {
+ try {
+ remove(conversation.getConversationID());
+ } catch (Exception ex) {
+
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationExpired(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ */
+ public void conversationExpired(ExtendedConversation conversation) {
+
+ Object conversationId = conversation.getConversationID();
+ InstanceLifeCycleWrapper ilcw = instanceLifecycleCollection.get(conversationId);
+ if (ilcw != null) {
+ // cycle through all the references to this instance and
+ // remove them from the underlying wrappers collection and
+ // from the lifecycle wrappers collection
+
+ for (Object conversationID : ilcw.callbackConversations) {
+ try{
+ ilcw.removeInstanceWrapper(conversationID);
+ remove(conversationID);
+ } catch(TargetDestructionException tde) {
+ System.out.println("Could not remove conversation id " + conversationID);
+ }
+ }
+
+
+ if (ilcw.clientConversationId != null) {
+ try{
+ ilcw.removeInstanceWrapper(ilcw.clientConversationId);
+ remove(ilcw.clientConversationId);
+ } catch(TargetDestructionException tde) {
+ System.out.println("Could not remove conversation id " + ilcw.clientConversationId);
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationStarted(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ */
+ public void conversationStarted(ExtendedConversation conversation) {
+ startContext(conversation.getConversationID());
+ }
+
+ /**
+ * @return the conversationManager
+ */
+ public ConversationManager getConversationManager() {
+ return conversationManager;
+ }
+
+ /**
+ * @param conversationManager the conversationManager to set
+ */
+ public void setConversationManager(ConversationManager conversationManager) {
+ this.conversationManager = conversationManager;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java
new file mode 100644
index 0000000000..a6663aba09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.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.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java
new file mode 100644
index 0000000000..5ae8b94647
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.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.core.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.event.HttpSessionEnd;
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * 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);
+ }
+
+ @Override
+ public void onEvent(Event event) {
+ checkInit();
+ if (event instanceof HttpSessionEnd) {
+ //FIXME key is not used
+ //Object key = ((HttpSessionEnd)event).getSessionID();
+ // FIXME: Remove the session id
+ }
+ }
+
+ @Override
+ public synchronized void start() {
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
+ }
+ lifecycleState = RUNNING;
+ }
+
+ @Override
+ 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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java
new file mode 100644
index 0000000000..49f89661b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.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.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java
new file mode 100644
index 0000000000..f11a61e662
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.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.scope;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.event.RequestEnd;
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * 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>();
+ }
+
+ @Override
+ public void onEvent(Event event) {
+ checkInit();
+ if (event instanceof RequestEnd) {
+ // shutdownInstances(Thread.currentThread());
+ }
+ }
+
+ @Override
+ public synchronized void start() {
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
+ }
+ lifecycleState = RUNNING;
+ }
+
+ @Override
+ 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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java
new file mode 100644
index 0000000000..1cfb6b06a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.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.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java
new file mode 100644
index 0000000000..0a20d793f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.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.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;
+ }
+
+ @Override
+ 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);
+ }
+
+ @Override
+ public int hashCode() {
+ return scope != null ? scope.hashCode() : 0;
+ }
+
+ @Override
+ public String toString() {
+ return scope;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
new file mode 100644
index 0000000000..6b2980b989
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.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.core.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+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 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;
+
+ /**
+ * Allows a component to be registered against more than one context id. This is required in the
+ * case of stateful callbacks where we want to identify the originating client component instance
+ * as the callback target but we don't want to reuse the clients original conversation id
+ *
+ * @param existingContextId an id that identifies an existing component instance
+ * @param newContextId a new id against which this component will also be registered
+ * @throws TargetResolutionException
+ */
+ void addWrapperReference(KEY existingContextId, KEY newContextId)
+ throws TargetResolutionException;
+
+ /**
+ * Register an existing instance against a context id. This is needed
+ * for a stateful callback where the service reference for the forward call
+ * contains a callback object that is not a service reference.
+ *
+ * @param wrapper the instance wrapper for the instance to be registered
+ * @param contextId the id for the scope context
+ * @throws TargetResolutionException
+ */
+ void registerWrapper(InstanceWrapper wrapper, 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 an identified component implementation instance associated with the current
+ * context from persistent storage
+ *
+ * @param contextId the identifier of the context to remove.
+ */
+ void remove(KEY contextId)
+ throws TargetDestructionException;
+
+ /* 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.
+ */
+ void start();
+
+ /**
+ * Stops the Lifecycle.
+ */
+ void stop();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java
new file mode 100644
index 0000000000..b19c14b3e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java
new file mode 100644
index 0000000000..842ed4c547
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java
new file mode 100644
index 0000000000..75261e11a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.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.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;
+
+/**
+ * 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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java
new file mode 100644
index 0000000000..85a6626cdd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.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.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java
new file mode 100644
index 0000000000..c27b112f8a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java
new file mode 100644
index 0000000000..a2c0edb9b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.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.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * 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);
+ }
+
+ @Override
+ public InstanceWrapper getWrapper(KEY contextId)
+ throws TargetResolutionException {
+ InstanceWrapper ctx = createInstanceWrapper();
+ ctx.start();
+ return ctx;
+ }
+
+ @Override
+ public InstanceWrapper getAssociatedWrapper(KEY contextId)
+ throws TargetResolutionException {
+ return getWrapper(contextId);
+ }
+
+ @Override
+ public void returnWrapper(InstanceWrapper wrapper, KEY contextId)
+ throws TargetDestructionException {
+ wrapper.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java
new file mode 100644
index 0000000000..0471b2c52e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.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.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java
new file mode 100644
index 0000000000..0f83dad97d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java
new file mode 100644
index 0000000000..15959c0608
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java
new file mode 100644
index 0000000000..bb46a2499b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java
new file mode 100644
index 0000000000..ea8d0e876c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/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.core.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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.java
new file mode 100644
index 0000000000..adeb667277
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.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.work;
+
+/**
+ * JCA work wrapper.
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
new file mode 100644
index 0000000000..90c13e6da8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.security.AccessController;
+import java.security.PrivilegedAction;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+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.WorkListener;
+import commonj.work.WorkManager;
+
+/**
+ * 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 implementation 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>
+ *
+ * @version $Rev$ $Date$
+ */
+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() {
+ }
+
+ private synchronized WorkManager getWorkManager() {
+ if (jsr237WorkManager != null) {
+ return jsr237WorkManager;
+ }
+ try {
+ InitialContext ctx = new InitialContext();
+ jsr237WorkManager = (WorkManager)ctx.lookup("java:comp/env/wm/TuscanyWorkManager");
+ } catch (NamingException e) {
+ // ignore
+ }
+ if (jsr237WorkManager == null) {
+ jsr237WorkManager = new ThreadPoolWorkManager(10);
+ }
+ return 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) {
+ getWorkManager().schedule(jsr237Work);
+ } else {
+ Jsr237WorkListener<T> jsr237WorkListener = new Jsr237WorkListener<T>(listener, work);
+ getWorkManager().schedule(jsr237Work, jsr237WorkListener);
+ }
+ } catch (IllegalArgumentException ex) {
+ if (listener != null) {
+ listener.workRejected(work);
+ } else {
+ throw new WorkSchedulerException(ex);
+ }
+ } catch (Exception ex) {
+ throw new WorkSchedulerException(ex);
+ }
+
+ }
+
+ public void destroy() {
+ if (jsr237WorkManager instanceof ThreadPoolWorkManager) {
+ // Allow privileged access to modify threads. Requires RuntimePermission in security
+ // policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ ((ThreadPoolWorkManager)jsr237WorkManager).destroy();
+ return null;
+ }
+ });
+ }
+ }
+
+ /*
+ * 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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java
new file mode 100644
index 0000000000..fb47a65edf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.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.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 java.util.concurrent.ThreadFactory;
+
+import org.osoa.sca.annotations.Destroy;
+
+import commonj.work.Work;
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+import commonj.work.WorkListener;
+import commonj.work.WorkManager;
+
+/**
+ * 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>
+ *
+ * @version $Rev$ $Date$
+ */
+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.
+ * @throws IllegalArgumentException if threadPoolSize < 1
+ */
+ public ThreadPoolWorkManager(int threadPoolSize) {
+ if (threadPoolSize < 1) {
+ throw new IllegalArgumentException("Invalid threadPoolSize of "
+ + threadPoolSize + ". It must be >= 1");
+ }
+
+ // Creates a new Executor, use a custom ThreadFactory that
+ // creates daemon threads.
+ executor = Executors.newFixedThreadPool(threadPoolSize, new ThreadFactory() {
+ public Thread newThread(Runnable r) {
+ Thread thread = new Thread(r);
+ thread.setDaemon(true);
+ return thread;
+ }
+ });
+ }
+
+ /**
+ * 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 IllegalArgumentException {
+ 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 IllegalArgumentException {
+
+ 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 IllegalArgumentException("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 acceptance.
+ *
+ * @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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.java
new file mode 100644
index 0000000000..67d2b66f84
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.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.core.work;
+
+
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+
+/**
+ * Default immutable implementation of the <code>WorkEvent</code> class.
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.java b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.java
new file mode 100644
index 0000000000..170319b6e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.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.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.
+ *
+ * @version $Rev$ $Date$
+ */
+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() {
+ 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()
+ */
+ @Override
+ 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..
+ */
+ @Override
+ 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-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..5f54178483
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+org.apache.tuscany.sca.core.assembly.ReferenceParameterProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#referenceParameters,model=org.apache.tuscany.sca.runtime.ReferenceParameters
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager
new file mode 100644
index 0000000000..898054509b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager
@@ -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.
+
+org.apache.tuscany.sca.core.conversation.ConversationManagerImpl
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint
new file mode 100644
index 0000000000..af281d8f4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.core.invocation.DefaultProxyFactoryExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory
new file mode 100644
index 0000000000..bcbd5b0abf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory
@@ -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.
+
+org.apache.tuscany.sca.core.invocation.MessageFactoryImpl
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
new file mode 100644
index 0000000000..56e99be0f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
@@ -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.
+
+org.apache.tuscany.sca.core.work.Jsr237WorkScheduler
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java
new file mode 100644
index 0000000000..7b44736d4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.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;
+
+import junit.framework.TestCase;
+
+public class DefaultExtensionPointRegistryTestCase extends TestCase {
+ private ExtensionPointRegistry registry;
+
+ @Override
+ 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));
+ }
+
+ public static interface MyRegistry {
+ void doSomething();
+ }
+
+ private static class MyREgistryImpl implements MyRegistry {
+
+ public void doSomething() {
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java
new file mode 100644
index 0000000000..2bc78c3d35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ 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-android/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java
new file mode 100644
index 0000000000..48dcf8df07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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());
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java
new file mode 100644
index 0000000000..99d5ec7bc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.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.invocation;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PhaseManagerTestCase {
+
+ @Test
+ public void testDiscovery() {
+ PhaseManager pm = new PhaseManager("org.apache.tuscany.sca.invocation.PhaseTest");
+ List<String> phases = pm.getAllPhases();
+ System.out.println(phases.size());
+ System.out.println(phases);
+ // Assert.assertEquals(15, phases.size());
+ Assert.assertEquals("reference.first", phases.get(0));
+
+ int rt = phases.indexOf("reference.transaction");
+ Assert.assertTrue(rt > phases.indexOf("reference.interface"));
+
+ int st = phases.indexOf("service.transaction");
+ Assert.assertTrue(st > phases.indexOf("service.binding"));
+
+ int it = phases.indexOf("implementation.transaction");
+ Assert.assertTrue(it < phases.indexOf("implementation.policy"));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java
new file mode 100644
index 0000000000..61164fa2de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.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.invocation;
+
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+public class PhaseSorterTestCase extends TestCase {
+ private PhaseSorter<String> graph;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ graph = new PhaseSorter<String>();
+ }
+
+ public void testSort() {
+ graph.addEdge("a", "b");
+ graph.addEdge("a", "c");
+ graph.addEdge("c", "d");
+ graph.addEdge("b", "c");
+ List<String> order = graph.topologicalSort(true);
+ assertEquals(Arrays.asList("a", "b", "c", "d"), order);
+ assertTrue(!graph.getVertices().isEmpty());
+
+ graph.addEdge("d", "a");
+ try {
+ order = graph.topologicalSort(true);
+ assertTrue("Should have failed", false);
+ } catch (IllegalArgumentException e) {
+ assertTrue(true);
+ }
+
+ graph.removeEdge("d", "a");
+ order = graph.topologicalSort(false);
+ assertEquals(Arrays.asList("a", "b", "c", "d"), order);
+ assertTrue(graph.getVertices().isEmpty());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java
new file mode 100644
index 0000000000..64114f7fb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.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.scope;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+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")
+ @Override
+ 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-android/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java
new file mode 100644
index 0000000000..d46d77b4b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ monitor = EasyMock.createNiceMock(StoreMonitor.class);
+ EasyMock.replay(monitor);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java
new file mode 100644
index 0000000000..1aba9656d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.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.core.wire;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+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 testHasCallbackObject() {
+ CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
+ Interceptor next = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null);
+ EasyMock.replay(next);
+ interceptor.setNext(next);
+ Message msg = new MessageFactoryImpl().createMessage();
+ msg.setFrom(new EndpointReferenceImpl("uri"));
+ msg.getFrom().getReferenceParameters().setCallbackObjectID("ABC");
+ interceptor.invoke(msg);
+ EasyMock.verify(next);
+ }
+
+ public void testNoCallbackObject() {
+ CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
+ Message msg = new MessageFactoryImpl().createMessage();
+ msg.setFrom(new EndpointReferenceImpl("uri"));
+ msg.getFrom().getReferenceParameters().setCallbackObjectID(null);
+ try {
+ interceptor.invoke(msg);
+ fail();
+ } catch (NoRegisteredCallbackException e) {
+ // expected
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java
new file mode 100644
index 0000000000..1ad0927d16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.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.wire;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
+import org.apache.tuscany.sca.interfacedef.Operation;
+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;
+import org.apache.tuscany.sca.invocation.Phase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvocationChainImplTestCase extends TestCase {
+
+ public void testInsertAtEnd() throws Exception {
+ Operation op = newOperation("foo");
+ InvocationChain chain = new InvocationChainImpl(op, op, true);
+ 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());
+
+ }
+
+ public void testAddByPhase() throws Exception {
+ Operation op = newOperation("foo");
+ InvocationChain chain = new InvocationChainImpl(op, op, false);
+ Interceptor inter1 = new MockInterceptor();
+ Interceptor inter2 = new MockInterceptor();
+ Interceptor inter3 = new MockInterceptor();
+ Interceptor inter4 = new MockInterceptor();
+ chain.addInterceptor(inter3); // SERVICE
+ chain.addInterceptor(Phase.IMPLEMENTATION_POLICY, inter4);
+ chain.addInterceptor(Phase.SERVICE_POLICY, inter2);
+ chain.addInterceptor(Phase.SERVICE_BINDING, inter1);
+ Interceptor head = (Interceptor)chain.getHeadInvoker();
+ assertEquals(inter1, head);
+ assertEquals(inter2, inter1.getNext());
+ assertEquals(inter3, inter2.getNext());
+ assertEquals(inter4, inter3.getNext());
+ assertEquals(inter4, 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;
+ }
+
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java
new file mode 100644
index 0000000000..b8150d4edc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.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.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";
+ //TODO port to the new way of dealing with conversation IDs later
+ //EasyMock.expect(context.getConversationID()).andReturn(convID);
+ EasyMock.replay(context);
+ ThreadMessageContext.setMessageContext(context);
+ Message msg = createMock(Message.class);
+ //TODO port to the new way of dealing with conversation IDs later
+ //msg.setConversationID(convID);
+ Interceptor next = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
+ EasyMock.expect(msg.isFault()).andReturn(false);
+ 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-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/FailingWork.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/FailingWork.java
new file mode 100644
index 0000000000..3184c3de92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/FailingWork.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.work;
+
+import commonj.work.Work;
+
+/**
+ * Simple Work item that will throw an exception
+ *
+ * @version $Rev$ $Date$
+ */
+public class FailingWork implements Work {
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isDaemon() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void release() {
+ }
+
+ /**
+ * Throws an IllegalArgumentException
+ */
+ public void run() {
+ System.out.println("Starting " + this + " and throwing an Exception");
+ throw new IllegalArgumentException("Sample exception from " + this);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyFailingRunnable.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyFailingRunnable.java
new file mode 100644
index 0000000000..91b45dfbcb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyFailingRunnable.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.work;
+
+/**
+ * Simple Runnable that throws an IllegalArgumentException
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSR237MyFailingRunnable extends JSR237MyRunnable {
+
+ /**
+ * Constructor
+ */
+ public JSR237MyFailingRunnable() {
+ super(-1);
+ }
+
+ /**
+ * Sleeps for a period of time defined by sleepTime
+ */
+ @Override
+ public void run() {
+ System.out.println("Starting " + this + " and throwing an Exception");
+ throw new IllegalArgumentException("Sample exception from " + this);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnable.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnable.java
new file mode 100644
index 0000000000..a7617f7a70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnable.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.core.work;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Simple Runnable that is used for testing Jsr237WorkScheduler
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSR237MyRunnable implements Runnable {
+
+ /**
+ * Count of workAccepted() method calls
+ */
+ private AtomicInteger runCompletedCount = new AtomicInteger();
+
+ /**
+ * The amount of time to sleep in the Run loop
+ */
+ private final long sleepTime;
+
+ /**
+ * Constructor
+ *
+ * @param sleepTime The amount of time to sleep (in milliseconds) in the run() method
+ */
+ public JSR237MyRunnable(long sleepTime) {
+ this.sleepTime = sleepTime;
+ }
+
+ /**
+ * Sleeps for a period of time defined by sleepTime
+ */
+ public void run() {
+ System.out.println("Starting " + this);
+ try {
+ Thread.sleep(sleepTime);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ System.out.println("Done " + this);
+ runCompletedCount.incrementAndGet();
+ }
+
+ /**
+ * Returns the number of completed calls to run()
+ *
+ * @return The number of completed calls to run()
+ */
+ public int getRunCompletedCount() {
+ return runCompletedCount.get();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnerListener.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnerListener.java
new file mode 100644
index 0000000000..75840efef4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnerListener.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.core.work;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.tuscany.sca.work.NotificationListener;
+
+/**
+ * Simple NotificationListener that is used for testing Jsr237WorkScheduler
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSR237MyRunnerListener implements NotificationListener<JSR237MyRunnable> {
+
+ /**
+ * Count of workAccepted() method calls
+ */
+ private AtomicInteger workAcceptedCallCount = new AtomicInteger();
+
+ /**
+ * Count of workStarted() method calls
+ */
+ private AtomicInteger workStartedCallCount = new AtomicInteger();
+
+ /**
+ * Count of workCompleted() method calls
+ */
+ private AtomicInteger workCompletedCallCount = new AtomicInteger();
+
+ /**
+ * Count of workFailed() method calls
+ */
+ private AtomicInteger workFailedCallCount = new AtomicInteger();
+
+ /**
+ * Count of workRejected() method calls
+ */
+ private AtomicInteger workRejectedCallCount = new AtomicInteger();
+
+ /**
+ * List of all exceptions thrown by Work items
+ */
+ private List<Throwable> workExceptions = Collections.synchronizedList(new ArrayList<Throwable>());
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workAccepted(JSR237MyRunnable work) {
+ workAcceptedCallCount.incrementAndGet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workCompleted(JSR237MyRunnable work) {
+ workCompletedCallCount.incrementAndGet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workFailed(JSR237MyRunnable work, Throwable error) {
+ workExceptions.add(error);
+ workFailedCallCount.incrementAndGet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workRejected(JSR237MyRunnable work) {
+ workRejectedCallCount.incrementAndGet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workStarted(JSR237MyRunnable work) {
+ workStartedCallCount.incrementAndGet();
+ }
+
+ /**
+ * Returns the number of calls to workAccepted()
+ *
+ * @return The number of calls to workAccepted()
+ */
+ public int getWorkAcceptedCallCount() {
+ return workAcceptedCallCount.get();
+ }
+
+ /**
+ * Returns the number of calls to workStarted()
+ *
+ * @return The number of calls to workStarted()
+ */
+ public int getWorkStartedCallCount() {
+ return workStartedCallCount.get();
+ }
+
+ /**
+ * Returns the number of calls to workCompleted()
+ *
+ * @return The number of calls to workCompleted()
+ */
+ public int getWorkCompletedCallCount() {
+ return workCompletedCallCount.get();
+ }
+
+ /**
+ * Returns the number of calls to workFailed()
+ *
+ * @return The number of calls to workFailed()
+ */
+ public int getWorkFailedCallCount() {
+ return workFailedCallCount.get();
+ }
+
+ /**
+ * Returns the number of calls to workRejected()
+ *
+ * @return The number of calls to workRejected()
+ */
+ public int getWorkRejectedCallCount() {
+ return workRejectedCallCount.get();
+ }
+
+ /**
+ * Returns a List of all exceptions that are thrown by the Work items
+ *
+ * @return A List of all exceptions that are thrown by the Work items
+ */
+ public List<Throwable> getWorkExceptions() {
+ return Collections.unmodifiableList(workExceptions);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/Jsr237WorkSchedulerTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/Jsr237WorkSchedulerTestCase.java
new file mode 100644
index 0000000000..225f23cb93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/Jsr237WorkSchedulerTestCase.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test case for Jsr237WorkScheduler
+ *
+ * @version $Rev$ $Date$
+ */
+public class Jsr237WorkSchedulerTestCase {
+
+ /**
+ * Wait up to 20 seconds for the Work units to complete
+ */
+ private static final long WAIT_TIMEOUT = 20000;
+
+ /**
+ * This is the shared instance of the ThreadPoolWorkManager used by the tests
+ */
+ private static Jsr237WorkScheduler workSchedular = null;
+
+ /**
+ * Setup the Jsr237WorkScheduler
+ */
+ @BeforeClass
+ public static void setup() {
+ workSchedular = new Jsr237WorkScheduler();
+ }
+
+ /**
+ * Make sure that the Jsr237WorkScheduler is stopped after running the tests
+ */
+ @AfterClass
+ public static void destroy() {
+ if (workSchedular != null) {
+ workSchedular.destroy();
+ }
+ }
+
+ /**
+ * Tests running a single fast job on the Jsr237WorkScheduler
+ */
+ @Test
+ public void testSingleFastJob() {
+ // Create the work and register it
+ JSR237MyRunnable fast = new JSR237MyRunnable(10);
+ JSR237MyRunnerListener listener = new JSR237MyRunnerListener();
+ workSchedular.scheduleWork(fast, listener);
+
+ // Wait for the 1 job to complete
+ waitForWorkToComplete(listener, 1);
+
+ // Test that the job completed successfully.
+ Assert.assertEquals(1, listener.getWorkAcceptedCallCount());
+ Assert.assertEquals(0, listener.getWorkRejectedCallCount());
+ Assert.assertEquals(1, listener.getWorkStartedCallCount());
+ Assert.assertEquals(1, listener.getWorkCompletedCallCount());
+ Assert.assertEquals(0, listener.getWorkExceptions().size());
+ }
+
+ /**
+ * Tests running a single job that fails on the Jsr237WorkScheduler
+ */
+ @Test
+ public void testSingleFailingJob() {
+ // Create the work and register it
+ JSR237MyFailingRunnable fail = new JSR237MyFailingRunnable();
+ JSR237MyRunnerListener listener = new JSR237MyRunnerListener();
+ workSchedular.scheduleWork(fail, listener);
+
+ // Wait for the 1 job to complete
+ waitForWorkToComplete(listener, 1);
+
+ // Test that the job completed successfully.
+ Assert.assertEquals(1, listener.getWorkAcceptedCallCount());
+ Assert.assertEquals(0, listener.getWorkRejectedCallCount());
+ Assert.assertEquals(1, listener.getWorkStartedCallCount());
+ Assert.assertEquals(0, listener.getWorkCompletedCallCount());
+ Assert.assertEquals(1, listener.getWorkFailedCallCount());
+ Assert.assertEquals(1, listener.getWorkExceptions().size());
+ }
+
+ /**
+ * Tests running a mixture of fast and slow jobs on the Jsr237WorkScheduler
+ */
+ @Test
+ public void testMultipleJobs() {
+ // Create the work and register it
+ JSR237MyRunnable fast1 = new JSR237MyRunnable(50);
+ JSR237MyRunnable fast2 = new JSR237MyRunnable(100);
+ JSR237MyRunnable fast3 = new JSR237MyRunnable(200);
+ JSR237MyRunnable slow1= new JSR237MyRunnable(2000);
+ JSR237MyRunnable slow2 = new JSR237MyRunnable(2000);
+ JSR237MyRunnerListener listener = new JSR237MyRunnerListener();
+ workSchedular.scheduleWork(fast1, listener);
+ workSchedular.scheduleWork(fast2, listener);
+ workSchedular.scheduleWork(fast3, listener);
+ workSchedular.scheduleWork(slow1, listener);
+ workSchedular.scheduleWork(slow2, listener);
+
+ // Wait for the 5 jobs to complete
+ waitForWorkToComplete(listener, 5);
+
+ // Test that the job completed successfully.
+ Assert.assertEquals(5, listener.getWorkAcceptedCallCount());
+ Assert.assertEquals(0, listener.getWorkRejectedCallCount());
+ Assert.assertEquals(5, listener.getWorkStartedCallCount());
+ Assert.assertEquals(5, listener.getWorkCompletedCallCount());
+ Assert.assertEquals(0, listener.getWorkExceptions().size());
+ }
+
+ /**
+ * Tests running a mixture of fast and slow jobs some of which fail on the
+ * Jsr237WorkScheduler
+ */
+ @Test
+ public void testMultipleJobsSomeFail() {
+ // Create the work and register it
+ JSR237MyRunnable fast1 = new JSR237MyRunnable(50);
+ JSR237MyRunnable fast2 = new JSR237MyRunnable(100);
+ JSR237MyRunnable fast3 = new JSR237MyRunnable(200);
+ JSR237MyRunnable slow1= new JSR237MyRunnable(2000);
+ JSR237MyRunnable slow2 = new JSR237MyRunnable(2000);
+ JSR237MyFailingRunnable fail1 = new JSR237MyFailingRunnable();
+ JSR237MyFailingRunnable fail2 = new JSR237MyFailingRunnable();
+ JSR237MyRunnerListener listener = new JSR237MyRunnerListener();
+ workSchedular.scheduleWork(fast1, listener);
+ workSchedular.scheduleWork(fast2, listener);
+ workSchedular.scheduleWork(fail1, listener);
+ workSchedular.scheduleWork(fast3, listener);
+ workSchedular.scheduleWork(slow1, listener);
+ workSchedular.scheduleWork(fail2, listener);
+ workSchedular.scheduleWork(slow2, listener);
+
+ // Wait for the 7 jobs to complete
+ waitForWorkToComplete(listener, 7);
+
+ // Test that the job completed successfully.
+ Assert.assertEquals(7, listener.getWorkAcceptedCallCount());
+ Assert.assertEquals(0, listener.getWorkRejectedCallCount());
+ Assert.assertEquals(7, listener.getWorkStartedCallCount());
+ Assert.assertEquals(5, listener.getWorkCompletedCallCount());
+ Assert.assertEquals(2, listener.getWorkFailedCallCount());
+ Assert.assertEquals(2, listener.getWorkExceptions().size());
+ }
+
+ /**
+ * Tests running a single job that has no listener
+ */
+ @Test
+ public void testSingleFastJobWithNoListener() {
+ // Create the work and register it
+ JSR237MyRunnable fast = new JSR237MyRunnable(10);
+ workSchedular.scheduleWork(fast);
+
+ // Wait for the job to complete
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ int completedCount = fast.getRunCompletedCount();
+ if (completedCount == 1) {
+ break;
+ }
+
+ if (System.currentTimeMillis() - startTime > WAIT_TIMEOUT) {
+ Assert.fail("Only " + completedCount + " work items completed before timeout");
+ return;
+ }
+
+ // Lets wait for the job to complete
+ try {
+ Thread.sleep(25);
+ } catch (InterruptedException ex) {
+ Assert.fail("Unexpected exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * Tests scheduling a null as the work item
+ */
+ @Test
+ public void testNullWork() {
+ try {
+ workSchedular.scheduleWork(null);
+ Assert.fail("Should have thrown IllegalArgumentException ");
+ } catch (IllegalArgumentException ex) {
+ // As expected
+ Assert.assertTrue(ex.toString().indexOf("null") != -1);
+ }
+ }
+
+ /**
+ * Waits for the specified number of jobs to complete or the timeout to fire.
+ *
+ * @param listener The listener to use to track Work unit completion
+ * @param completedWorkItemsToWaitFor The number of Work items to complete
+ */
+ private void waitForWorkToComplete(JSR237MyRunnerListener listener, int completedWorkItemsToWaitFor) {
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ int completedCount = listener.getWorkCompletedCallCount() + listener.getWorkFailedCallCount();
+ if (completedCount == completedWorkItemsToWaitFor) {
+ return;
+ }
+
+ if (System.currentTimeMillis() - startTime > WAIT_TIMEOUT) {
+ Assert.fail("Only " + completedCount + " work items completed before timeout");
+ return;
+ }
+
+ // Lets wait for more jobs to complete
+ try {
+ Thread.sleep(25);
+ } catch (InterruptedException ex) {
+ Assert.fail("Unexpected exception: " + ex);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TestWorkListener.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TestWorkListener.java
new file mode 100644
index 0000000000..ba32a92c18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TestWorkListener.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.core.work;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.Assert;
+
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkListener;
+
+/**
+ * A simple WorkListener that tracks invocations to it.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestWorkListener implements WorkListener {
+
+ /**
+ * Count of workAccepted() method calls
+ */
+ private AtomicInteger workAcceptedCallCount = new AtomicInteger();
+
+ /**
+ * Count of workStarted() method calls
+ */
+ private AtomicInteger workStartedCallCount = new AtomicInteger();
+
+ /**
+ * Count of workCompleted() method calls
+ */
+ private AtomicInteger workCompletedCallCount = new AtomicInteger();
+
+ /**
+ * Count of workRejected() method calls
+ */
+ private AtomicInteger workRejectedCallCount = new AtomicInteger();
+
+ /**
+ * List of all exceptions thrown by Work items
+ */
+ private List<WorkException> workExceptions = Collections.synchronizedList(new ArrayList<WorkException>());
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workAccepted(WorkEvent work) {
+ workAcceptedCallCount.incrementAndGet();
+
+ // Validate the WorkEvent
+ Assert.assertNotNull(work.getWorkItem());
+ Assert.assertEquals(WorkEvent.WORK_ACCEPTED, work.getType());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workStarted(WorkEvent work) {
+ workStartedCallCount.incrementAndGet();
+
+ // Validate the WorkEvent
+ Assert.assertNotNull(work.getWorkItem());
+ Assert.assertEquals(WorkEvent.WORK_STARTED, work.getType());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workCompleted(WorkEvent work) {
+ if (work.getException() != null) {
+ workExceptions.add(work.getException());
+ }
+
+ // Validate the WorkEvent
+ Assert.assertNotNull(work.getWorkItem());
+ Assert.assertEquals(WorkEvent.WORK_COMPLETED, work.getType());
+
+ workCompletedCallCount.incrementAndGet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void workRejected(WorkEvent work) {
+ workRejectedCallCount.incrementAndGet();
+
+ // Validate the WorkEvent
+ Assert.assertNotNull(work.getWorkItem());
+ Assert.assertEquals(WorkEvent.WORK_REJECTED, work.getType());
+ }
+
+ /**
+ * Returns the number of calls to workAccepted()
+ *
+ * @return The number of calls to workAccepted()
+ */
+ public int getWorkAcceptedCallCount() {
+ return workAcceptedCallCount.get();
+ }
+
+ /**
+ * Returns the number of calls to workStarted()
+ *
+ * @return The number of calls to workStarted()
+ */
+ public int getWorkStartedCallCount() {
+ return workStartedCallCount.get();
+ }
+
+ /**
+ * Returns the number of calls to workCompleted()
+ *
+ * @return The number of calls to workCompleted()
+ */
+ public int getWorkCompletedCallCount() {
+ return workCompletedCallCount.get();
+ }
+
+ /**
+ * Returns the number of calls to workRejected()
+ *
+ * @return The number of calls to workRejected()
+ */
+ public int getWorkRejectedCallCount() {
+ return workRejectedCallCount.get();
+ }
+
+ /**
+ * Returns a List of all exceptions that are thrown by the Work items
+ *
+ * @return A List of all exceptions that are thrown by the Work items
+ */
+ public List<WorkException> getWorkExceptions() {
+ return Collections.unmodifiableList(workExceptions);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManagerTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManagerTestCase.java
new file mode 100644
index 0000000000..715f5f95c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManagerTestCase.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.core.work;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * This test case will test the ThreadPoolWorkManager
+ *
+ * @version $Rev$ $Date$
+ */
+public class ThreadPoolWorkManagerTestCase {
+
+ /**
+ * Wait up to 20 seconds for the Work units to complete
+ */
+ private static final long WAIT_TIMEOUT = 20000;
+
+ /**
+ * This is the shared instance of the ThreadPoolWorkManager used by the tests
+ */
+ private static ThreadPoolWorkManager workManager = null;
+
+ /**
+ * Setup the ThreadPoolWorkManager
+ */
+ @BeforeClass
+ public static void setup() {
+ workManager = new ThreadPoolWorkManager(10);
+ }
+
+ /**
+ * Make sure that the ThreadPoolWorkManager is stopped after running the tests
+ */
+ @AfterClass
+ public static void destroy() {
+ if (workManager != null) {
+ workManager.destroy();
+ }
+ }
+
+ /**
+ * Tests running a single fast job on the ThreadPoolWorkManager
+ */
+ @Test
+ public void testSingleFastJob() {
+ // Create the work and register it
+ TimeDelayWork fast = new TimeDelayWork(10);
+ TestWorkListener listener = new TestWorkListener();
+ workManager.schedule(fast, listener);
+
+ // Wait for the 1 job to complete
+ waitForWorkToComplete(listener, 1);
+
+ // Test that the job completed successfully.
+ Assert.assertEquals(1, listener.getWorkAcceptedCallCount());
+ Assert.assertEquals(0, listener.getWorkRejectedCallCount());
+ Assert.assertEquals(1, listener.getWorkStartedCallCount());
+ Assert.assertEquals(1, listener.getWorkCompletedCallCount());
+ Assert.assertEquals(0, listener.getWorkExceptions().size());
+ }
+
+ /**
+ * Tests running a single job that fails on the ThreadPoolWorkManager
+ */
+ @Test
+ public void testSingleFailingJob() {
+ // Create the work and register it
+ FailingWork fail = new FailingWork();
+ TestWorkListener listener = new TestWorkListener();
+ workManager.schedule(fail, listener);
+
+ // Wait for the 1 job to complete
+ waitForWorkToComplete(listener, 1);
+
+ // Test that the job completed successfully.
+ Assert.assertEquals(1, listener.getWorkAcceptedCallCount());
+ Assert.assertEquals(0, listener.getWorkRejectedCallCount());
+ Assert.assertEquals(1, listener.getWorkStartedCallCount());
+ Assert.assertEquals(1, listener.getWorkCompletedCallCount());
+ Assert.assertEquals(1, listener.getWorkExceptions().size());
+ }
+
+ /**
+ * Tests running a mixture of fast and slow jobs on the ThreadPoolWorkManager
+ */
+ @Test
+ public void testMultipleJobs() {
+ // Create the work and register it
+ TimeDelayWork fast1 = new TimeDelayWork(50);
+ TimeDelayWork fast2 = new TimeDelayWork(100);
+ TimeDelayWork fast3 = new TimeDelayWork(200);
+ TimeDelayWork slow1= new TimeDelayWork(2000);
+ TimeDelayWork slow2 = new TimeDelayWork(2000);
+ TestWorkListener listener = new TestWorkListener();
+ workManager.schedule(fast1, listener);
+ workManager.schedule(fast2, listener);
+ workManager.schedule(fast3, listener);
+ workManager.schedule(slow1, listener);
+ workManager.schedule(slow2, listener);
+
+ // Wait for the 5 jobs to complete
+ waitForWorkToComplete(listener, 5);
+
+ // Test that the job completed successfully.
+ Assert.assertEquals(5, listener.getWorkAcceptedCallCount());
+ Assert.assertEquals(0, listener.getWorkRejectedCallCount());
+ Assert.assertEquals(5, listener.getWorkStartedCallCount());
+ Assert.assertEquals(5, listener.getWorkCompletedCallCount());
+ Assert.assertEquals(0, listener.getWorkExceptions().size());
+ }
+
+ /**
+ * Tests running a mixture of fast and slow jobs some of which fail on the
+ * ThreadPoolWorkManager
+ */
+ @Test
+ public void testMultipleJobsSomeFail() {
+ // Create the work and register it
+ TimeDelayWork fast1 = new TimeDelayWork(50);
+ TimeDelayWork fast2 = new TimeDelayWork(100);
+ TimeDelayWork fast3 = new TimeDelayWork(200);
+ TimeDelayWork slow1= new TimeDelayWork(2000);
+ TimeDelayWork slow2 = new TimeDelayWork(2000);
+ FailingWork fail1 = new FailingWork();
+ FailingWork fail2 = new FailingWork();
+ TestWorkListener listener = new TestWorkListener();
+ workManager.schedule(fast1, listener);
+ workManager.schedule(fast2, listener);
+ workManager.schedule(fail1, listener);
+ workManager.schedule(fast3, listener);
+ workManager.schedule(slow1, listener);
+ workManager.schedule(fail2, listener);
+ workManager.schedule(slow2, listener);
+
+ // Wait for the 7 jobs to complete
+ waitForWorkToComplete(listener, 7);
+
+ // Test that the job completed successfully.
+ Assert.assertEquals(7, listener.getWorkAcceptedCallCount());
+ Assert.assertEquals(0, listener.getWorkRejectedCallCount());
+ Assert.assertEquals(7, listener.getWorkStartedCallCount());
+ Assert.assertEquals(7, listener.getWorkCompletedCallCount());
+ Assert.assertEquals(2, listener.getWorkExceptions().size());
+ }
+
+ /**
+ * Tests creating a ThreadPoolWorkManager with invalid pool sizes of -10 to 0
+ * inclusive
+ */
+ @Test
+ public void testThreadPoolWorkManagerLessThan1Size() {
+ for (int i = 0; i >= -10; i--) {
+ try {
+ new ThreadPoolWorkManager(i);
+ Assert.fail("Should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException ex) {
+ Assert.assertTrue(ex.toString().indexOf(Integer.toString(i)) != -1);
+ }
+ }
+ }
+
+ /**
+ * Tests running a single job that has no listener
+ */
+ @Test
+ public void testSingleFastJobWithNoListener() {
+ // Create the work and register it
+ TimeDelayWork fast = new TimeDelayWork(10);
+ workManager.schedule(fast);
+
+ // Wait for the job to complete
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ int completedCount = fast.getRunCompletedCount();
+ if (completedCount == 1) {
+ break;
+ }
+
+ if (System.currentTimeMillis() - startTime > WAIT_TIMEOUT) {
+ Assert.fail("Only " + completedCount + " work items completed before timeout");
+ return;
+ }
+
+ // Lets wait for the job to complete
+ try {
+ Thread.sleep(25);
+ } catch (InterruptedException ex) {
+ Assert.fail("Unexpected exception: " + ex);
+ }
+ }
+
+ // Make sure we have got one completed run
+ Assert.assertEquals(1, fast.getRunCompletedCount());
+ }
+
+ /**
+ * Waits for the specified number of jobs to complete or the timeout to fire.
+ *
+ * @param listener The listener to use to track Work unit completion
+ * @param completedWorkItemsToWaitFor The number of Work items to complete
+ */
+ private void waitForWorkToComplete(TestWorkListener listener, int completedWorkItemsToWaitFor) {
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ int completedCount = listener.getWorkCompletedCallCount();
+ if (completedCount == completedWorkItemsToWaitFor) {
+ return;
+ }
+
+ if (System.currentTimeMillis() - startTime > WAIT_TIMEOUT) {
+ Assert.fail("Only " + completedCount + " work items completed before timeout");
+ return;
+ }
+
+ // Lets wait for more jobs to complete
+ try {
+ Thread.sleep(25);
+ } catch (InterruptedException ex) {
+ Assert.fail("Unexpected exception: " + ex);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TimeDelayWork.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TimeDelayWork.java
new file mode 100644
index 0000000000..3b30d86f14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TimeDelayWork.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.core.work;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import commonj.work.Work;
+
+/**
+ * Simple Work item that will sleep in the run() method for the specified
+ * period of time
+ *
+ * @version $Rev$ $Date$
+ */
+public class TimeDelayWork implements Work {
+
+ /**
+ * Count of completed run() method calls
+ */
+ private AtomicInteger runCompletedCount = new AtomicInteger();
+
+ /**
+ * The amount of time to sleep in the Run loop
+ */
+ private final long sleepTime;
+
+ /**
+ * Constructor
+ *
+ * @param sleepTime The amount of time to sleep (in milliseconds) in the run() method
+ */
+ public TimeDelayWork(long sleepTime) {
+ this.sleepTime = sleepTime;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isDaemon() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void release() {
+ }
+
+ /**
+ * Sleeps for a period of time defined by sleepTime
+ */
+ public void run() {
+ System.out.println("Starting " + this);
+ try {
+ Thread.sleep(sleepTime);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ System.out.println("Done " + this);
+ runCompletedCount.incrementAndGet();
+ }
+
+ /**
+ * Returns the number of completed calls to run()
+ *
+ * @return The number of completed calls to run()
+ */
+ public int getRunCompletedCount() {
+ return runCompletedCount.get();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java b/sca-java-1.x/branches/sca-android/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java
new file mode 100644
index 0000000000..341d889b7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.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-android/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest b/sca-java-1.x/branches/sca-android/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest
new file mode 100644
index 0000000000..9ed0928a33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest
@@ -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.
+
+name=implementation.last, stage=implementation, after=*
+name=reference.first, stage=reference, before=*
+name=reference.transaction, stage=reference, after=reference.interface
+name=service.transaction, stage=service, after=service.binding, before=component.service
+name=implementation.transaction, stage=implementation, before=implementation.policy \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/LICENSE b/sca-java-1.x/branches/sca-android/modules/databinding/LICENSE
new file mode 100644
index 0000000000..616bec99ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/LICENSE
@@ -0,0 +1,244 @@
+
+ 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.
+
+-----------------------------------------------------------------
+The test cases use xmlunit with the following license:
+-----------------------------------------------------------------
+
+/*
+******************************************************************
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
+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 xmlunit.sourceforge.net 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.
+
+******************************************************************
+*/
+
+
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/META-INF/README b/sca-java-1.x/branches/sca-android/modules/databinding/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/NOTICE b/sca-java-1.x/branches/sca-android/modules/databinding/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/databinding/pom.xml b/sca-java-1.x/branches/sca-android/modules/databinding/pom.xml
new file mode 100644
index 0000000000..890abcc2ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/pom.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding</artifactId>
+ <name>Apache Tuscany SCA DataBinding Framework</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-xsd</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0-2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.databinding</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.databinding*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java
new file mode 100644
index 0000000000..547f9d9f4f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.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;
+
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * DataBinding represents a data representation, for example, SDO, JAXB and AXIOM
+ *
+ * @version $Rev$ $Date$
+ */
+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 dataType The data type to be introspected
+ * @param operation The operation
+ * @return true if the databinding has recognized the given data type
+ */
+ boolean introspect(DataType dataType, Operation operation);
+
+ /**
+ * Introspect the data to figure out the corresponding data type
+ *
+ * @param value The object to be checked
+ * @param operation The operation
+ * @return The DataType or null if the java type is not supported by this databinding
+ */
+ DataType introspect(Object value, Operation operation);
+
+ /**
+ * 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 object source object to copy
+ * @param dataType The data type
+ * @param operation The operation
+ * @return copy of the object passed in as argument
+ */
+ Object copy(Object object, DataType dataType, Operation operation);
+
+ /**
+ * Get the type mapper for simple types
+ * @return The databinding-specific simple type mapper
+ */
+ SimpleTypeMapper getSimpleTypeMapper();
+
+ /**
+ * Get the XML type helper for Java types
+ * @return The databinding-specific XML type helper class
+ */
+ XMLTypeHelper getXMLTypeHelper();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java
new file mode 100644
index 0000000000..2ff5d866b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.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;
+
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * An extension point for data binding extensions.
+ *
+ * @version $Rev$ $Date$
+ */
+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 operation TODO
+ * @return A DataType representing the java type or null if no databinding
+ * recognizes the java type
+ */
+ boolean introspectType(DataType dataType, Operation operation);
+
+ /**
+ * Introspect the value to figure out the corresponding DataType
+ *
+ * @param value The object value
+ * @param operation TODO
+ * @return A DataType representing the value or null if no databinding
+ * recognizes the value
+ */
+ DataType introspectType(Object value, Operation operation);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java
new file mode 100644
index 0000000000..505a810276
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DataPipe<S, R> {
+
+ /**
+ * 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.java
new file mode 100644
index 0000000000..1aac6d48be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.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.databinding;
+
+/**
+ * Data pipe allows a data source pushes data into its sink and pipe the data into its result
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DataPipeTransformer<S, R> extends Transformer {
+
+ DataPipe<S, R> newInstance();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
new file mode 100644
index 0000000000..b2da024a72
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.databinding;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+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.XMLType;
+
+/**
+ * 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>();
+ private final List<DataBinding> databindings = new ArrayList<DataBinding>();
+ private static final Logger logger = Logger.getLogger(DefaultDataBindingExtensionPoint.class.getName());
+ private boolean loadedDataBindings;
+
+ public DefaultDataBindingExtensionPoint() {
+ }
+
+ public DataBinding getDataBinding(String id) {
+ if (id == null) {
+ return null;
+ }
+ DataBinding dataBinding = bindings.get(id.toLowerCase());
+ if (dataBinding == null) {
+ loadDataBindings();
+ dataBinding = bindings.get(id.toLowerCase());
+ }
+ return dataBinding;
+ }
+
+ public void addDataBinding(DataBinding dataBinding) {
+ if (logger.isLoggable(Level.FINE)) {
+ String className = dataBinding.getClass().getName();
+ boolean lazy = false;
+ if (dataBinding instanceof LazyDataBinding) {
+ className = ((LazyDataBinding)dataBinding).dataBindingDeclaration.getClassName();
+ lazy = true;
+ }
+ logger.fine("Adding databinding: " + className + ";type=" + dataBinding.getName() + ",lazy=" + lazy);
+ }
+ databindings.add(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) {
+ databindings.remove(dataBinding);
+ String[] aliases = dataBinding.getAliases();
+ if (aliases != null) {
+ for (String alias : aliases) {
+ bindings.remove(alias.toLowerCase());
+ }
+ }
+ }
+ return dataBinding;
+ }
+
+ /**
+ * Dynamically load data bindings declared under META-INF/services
+ */
+ private synchronized void loadDataBindings() {
+ if (loadedDataBindings)
+ return;
+
+ // Get the databinding service declarations
+ Set<ServiceDeclaration> dataBindingDeclarations;
+ try {
+ dataBindingDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(DataBinding.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load data bindings
+ for (ServiceDeclaration dataBindingDeclaration : dataBindingDeclarations) {
+ Map<String, String> attributes = dataBindingDeclaration.getAttributes();
+ String type = attributes.get("type");
+ String name = attributes.get("name");
+
+ // Create a data binding wrapper and register it
+ DataBinding dataBinding = new LazyDataBinding(type, name, dataBindingDeclaration);
+ addDataBinding(dataBinding);
+ }
+
+ loadedDataBindings = true;
+ }
+
+ /**
+ * A data binding facade allowing data bindings to be lazily loaded and
+ * initialized.
+ */
+ private static class LazyDataBinding implements DataBinding {
+
+ private String name;
+ private String[] aliases;
+ private ServiceDeclaration dataBindingDeclaration;
+ private DataBinding dataBinding;
+
+ private LazyDataBinding(String type, String name, ServiceDeclaration dataBindingDeclaration) {
+ this.name = type;
+ if (name != null) {
+ this.aliases = new String[] {name};
+ }
+ this.dataBindingDeclaration = dataBindingDeclaration;
+ }
+
+ /**
+ * Load and instantiate the data binding class.
+ *
+ * @return The data binding.
+ */
+ @SuppressWarnings("unchecked")
+ private DataBinding getDataBinding() {
+ if (dataBinding == null) {
+ try {
+ Class<DataBinding> dataBindingClass = (Class<DataBinding>)dataBindingDeclaration.loadClass();
+ Constructor<DataBinding> constructor = dataBindingClass.getConstructor();
+ dataBinding = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return dataBinding;
+ }
+
+ public Object copy(Object object, DataType dataType, Operation operation) {
+ return getDataBinding().copy(object, dataType, operation);
+ }
+
+ public String[] getAliases() {
+ return aliases;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public SimpleTypeMapper getSimpleTypeMapper() {
+ return getDataBinding().getSimpleTypeMapper();
+ }
+
+ public XMLTypeHelper getXMLTypeHelper() {
+ return getDataBinding().getXMLTypeHelper();
+ }
+
+ public WrapperHandler getWrapperHandler() {
+ return getDataBinding().getWrapperHandler();
+ }
+
+ public boolean introspect(DataType dataType, Operation operation) {
+ return getDataBinding().introspect(dataType, operation);
+ }
+
+ public DataType introspect(Object value, Operation operation) {
+ return getDataBinding().introspect(value, operation);
+ }
+ }
+
+ //FIXME The following methods should not be on the extension point
+ // they should be on a separate class
+ public boolean introspectType(DataType dataType, Operation operation) {
+ loadDataBindings();
+ for (DataBinding binding : databindings) {
+ // 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, operation)) {
+ return true;
+ }
+ }
+ }
+ // FIXME: Should we honor the databinding from operation/interface
+ // level?
+ Class physical = dataType.getPhysical();
+ if (physical == Object.class) {
+ dataType.setDataBinding(JavaBeansDataBinding.NAME);
+ return false;
+ }
+ if (dataType.getPhysical().isArray()) {
+ introspectArray(dataType, operation);
+ return true;
+ } else if (Throwable.class.isAssignableFrom(physical)) {
+ dataType.setDataBinding(JavaExceptionDataBinding.NAME);
+ return true;
+ } else {
+ dataType.setDataBinding(JavaBeansDataBinding.NAME);
+ return false;
+ }
+ }
+
+ private boolean introspectArray(DataType dataType, Operation operation) {
+ Class physical = dataType.getPhysical();
+ if (!physical.isArray() || physical == byte[].class) {
+ return false;
+ }
+ Class componentType = physical.getComponentType();
+ DataType logical = new DataTypeImpl(componentType, dataType.getLogical());
+ introspectType(logical, operation);
+ dataType.setDataBinding("java:array");
+ dataType.setLogical(logical);
+ return true;
+ }
+
+ public DataType introspectType(Object value, Operation operation) {
+ loadDataBindings();
+ DataType dataType = null;
+ for (DataBinding binding : databindings) {
+ // 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, operation);
+ }
+ if (dataType != null) {
+ return dataType;
+ }
+ }
+ return new DataTypeImpl<XMLType>(JavaBeansDataBinding.NAME, value.getClass(), XMLType.UNKNOWN);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java
new file mode 100644
index 0000000000..7aa55d2cff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java
@@ -0,0 +1,306 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.databinding.impl.DirectedGraph;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultTransformerExtensionPoint implements TransformerExtensionPoint {
+ private static final Logger logger = Logger.getLogger(DefaultTransformerExtensionPoint.class.getName());
+ private boolean loadedTransformers;
+
+ private final DirectedGraph<Object, Transformer> graph = new DirectedGraph<Object, Transformer>();
+
+ public DefaultTransformerExtensionPoint() {
+ }
+
+ public void addTransformer(String sourceType, String resultType, int weight, Transformer transformer, boolean publicTransformer) {
+ if (logger.isLoggable(Level.FINE)) {
+ String className = transformer.getClass().getName();
+ boolean lazy = false;
+ boolean pull = (transformer instanceof PullTransformer);
+ if (transformer instanceof LazyPullTransformer) {
+ className = ((LazyPullTransformer)transformer).transformerDeclaration.getClassName();
+ lazy = true;
+ }
+ if (transformer instanceof LazyPushTransformer) {
+ className = ((LazyPushTransformer)transformer).transformerDeclaration.getClassName();
+ lazy = true;
+ }
+
+ logger.fine("Adding transformer: " + className
+ + ";source="
+ + sourceType
+ + ",target="
+ + resultType
+ + ",weight="
+ + weight
+ + ",type="
+ + (pull ? "pull" : "push")
+ + ",lazy="
+ + lazy);
+ }
+ graph.addEdge(sourceType, resultType, transformer, weight, publicTransformer);
+ }
+
+ public void addTransformer(Transformer transformer, boolean publicTransformer) {
+ addTransformer(transformer.getSourceDataBinding(),
+ transformer.getTargetDataBinding(),
+ transformer.getWeight(),
+ transformer, publicTransformer);
+ }
+
+ public boolean removeTransformer(String sourceType, String resultType) {
+ return graph.removeEdge(sourceType, resultType);
+ }
+
+ public Transformer getTransformer(String sourceType, String resultType) {
+ loadTransformers();
+
+ DirectedGraph<Object, Transformer>.Edge edge = graph.getEdge(sourceType, resultType);
+ return (edge == null) ? null : edge.getValue();
+ }
+
+ /**
+ * Dynamically load transformers registered under META-INF/services.
+ *
+ */
+ private synchronized void loadTransformers() {
+ if (loadedTransformers) {
+ return;
+ }
+ loadedTransformers = true;
+ loadTransformers(PullTransformer.class);
+ loadTransformers(PushTransformer.class);
+
+ }
+
+ /**
+ * Dynamically load transformers registered under META-INF/services.
+ *
+ * @param transformerClass
+ */
+ private void loadTransformers(Class<?> transformerClass) {
+
+ // Get the transformer service declarations
+ Set<ServiceDeclaration> transformerDeclarations;
+
+ try {
+ transformerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(transformerClass);
+
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load transformers
+ for (ServiceDeclaration transformerDeclaration : transformerDeclarations) {
+ Map<String, String> attributes = transformerDeclaration.getAttributes();
+
+ String source = attributes.get("source");
+ String target = attributes.get("target");
+ int weight = Integer.valueOf(attributes.get("weight"));
+ String b = attributes.get("public");
+ boolean pub = true;
+ if (b != null) {
+ pub = Boolean.valueOf(b);
+ }
+
+ // Create a transformer wrapper and register it
+ Transformer transformer;
+ if (transformerClass == PullTransformer.class) {
+ transformer = new LazyPullTransformer(source, target, weight, transformerDeclaration);
+ } else {
+ transformer = new LazyPushTransformer(source, target, weight, transformerDeclaration);
+ }
+ addTransformer(transformer, pub);
+ }
+ }
+
+ /**
+ * A transformer facade allowing transformers to be lazily loaded
+ * and initialized.
+ */
+ private static class LazyPullTransformer implements PullTransformer<Object, Object> {
+
+ private String source;
+ private String target;
+ private int weight;
+ private ServiceDeclaration transformerDeclaration;
+ private PullTransformer<Object, Object> transformer;
+
+ public LazyPullTransformer(String source, String target, int weight, ServiceDeclaration transformerDeclaration) {
+ this.source = source;
+ this.target = target;
+ this.weight = weight;
+ this.transformerDeclaration = transformerDeclaration;
+ }
+
+ /**
+ * Load and instantiate the transformer class.
+ *
+ * @return The transformer.
+ */
+ @SuppressWarnings("unchecked")
+ private PullTransformer<Object, Object> getTransformer() {
+ if (transformer == null) {
+ try {
+ Class<PullTransformer<Object, Object>> transformerClass =
+ (Class<PullTransformer<Object, Object>>)transformerDeclaration.loadClass();
+ Constructor<PullTransformer<Object, Object>> constructor = transformerClass.getConstructor();
+ transformer = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return transformer;
+ }
+
+ public String getSourceDataBinding() {
+ return source;
+ }
+
+ public String getTargetDataBinding() {
+ return target;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ return getTransformer().transform(source, context);
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer(super.toString());
+ sb.append(";className=").append(transformerDeclaration.getClassName());
+ return sb.toString();
+ }
+ }
+
+ /**
+ * A transformer facade allowing transformers to be lazily loaded
+ * and initialized.
+ */
+ private static class LazyPushTransformer implements PushTransformer<Object, Object> {
+
+ private String source;
+ private String target;
+ private int weight;
+ private ServiceDeclaration transformerDeclaration;
+ private PushTransformer<Object, Object> transformer;
+
+ public LazyPushTransformer(String source, String target, int weight, ServiceDeclaration transformerDeclaration) {
+ this.source = source;
+ this.target = target;
+ this.weight = weight;
+ this.transformerDeclaration = transformerDeclaration;
+ }
+
+ /**
+ * Load and instantiate the transformer class.
+ *
+ * @return The transformer.
+ */
+ @SuppressWarnings("unchecked")
+ private PushTransformer<Object, Object> getTransformer() {
+ if (transformer == null) {
+ try {
+ Class<PushTransformer<Object, Object>> transformerClass =
+ (Class<PushTransformer<Object, Object>>)transformerDeclaration.loadClass();
+ Constructor<PushTransformer<Object, Object>> constructor = transformerClass.getConstructor();
+ transformer = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return transformer;
+ }
+
+ public String getSourceDataBinding() {
+ return source;
+ }
+
+ public String getTargetDataBinding() {
+ return target;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public void transform(Object source, Object sink, TransformationContext context) {
+ getTransformer().transform(source, sink, context);
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer(super.toString());
+ sb.append(";className=").append(transformerDeclaration.getClassName());
+ return sb.toString();
+ }
+ }
+
+ //FIXME The following methods should be on a different class from
+ // extension point
+
+ public List<Transformer> getTransformerChain(String sourceType, String resultType) {
+ loadTransformers();
+
+ String source = sourceType;
+ String result = resultType;
+ List<Transformer> transformers = new ArrayList<Transformer>();
+ // First check if there is a direct path, if yes, use it regardless of the weight
+ DirectedGraph<Object, Transformer>.Edge link = graph.getEdge(sourceType, resultType);
+ if (link != null) {
+ transformers.add(link.getValue());
+ } else {
+ 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;
+ }
+
+ @Override
+ public String toString() {
+ loadTransformers();
+
+ return graph.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java
new file mode 100644
index 0000000000..6b8acfc7b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java
new file mode 100644
index 0000000000..81264923eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java
new file mode 100644
index 0000000000..600a6477f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.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;
+
+/**
+ * A transformer that pushes data from its source into the sink
+ *
+ * @param <S>
+ * @param <R>
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java
new file mode 100644
index 0000000000..4e6d130aa9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.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.databinding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Type Mapper between XML schema simple data types and java objects
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java
new file mode 100644
index 0000000000..9ffadd1eae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.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.databinding;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * Context for data transformation
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TransformationContext {
+
+ /**
+ * @return
+ */
+ Operation getSourceOperation();
+
+ /**
+ * @param sourceOperation
+ */
+ void setSourceOperation(Operation sourceOperation);
+
+ /**
+ * @return
+ */
+ Operation getTargetOperation();
+
+ /**
+ * @param targetOperation
+ */
+ 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 Returns the ClassLoader
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Get a map of metadata
+ *
+ * @return Returns a map of the metadata
+ */
+ Map<String, Object> getMetadata();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java
new file mode 100644
index 0000000000..4f949f7dff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.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.databinding;
+
+
+/**
+ * Reports problems during data transformation
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java
new file mode 100644
index 0000000000..2aa0ad7c15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.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;
+
+/**
+ * A transformer provides the data transformation from source type to target type. The cost of the transformation is
+ * modelled as weight.
+ *
+ * @version $Rev$ $Date$
+ */
+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 identifying 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 identifying 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java
new file mode 100644
index 0000000000..ee7efe4860
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.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;
+
+import java.util.List;
+
+/**
+ * An extension point for data transformer extensions.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TransformerExtensionPoint {
+
+ /**
+ * Register a transformer
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @param weight
+ * @param transformer
+ * @param publicTransformer TODO
+ */
+ void addTransformer(String sourceDataBinding,
+ String targetDataBinding,
+ int weight,
+ Transformer transformer,
+ boolean publicTransformer);
+
+ /**
+ * Register a transformer
+ *
+ * @param transformer
+ * @param publicTransformer TODO
+ */
+ void addTransformer(Transformer transformer, boolean publicTransformer);
+
+ /**
+ * 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java
new file mode 100644
index 0000000000..a91410ed71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.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;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * A contract for transformers to deal with wrapping/unwrapping for WSDL wrapper style operations
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WrapperHandler<T> {
+ /**
+ * Create a wrapper element
+ * @param operation The operation
+ * @param input Is it for input or output
+ * @return An object representing the wrapper element
+ */
+ T create(Operation operation, boolean input);
+
+ /**
+ * Get the data type for the wrapper
+ * @param operation The operation
+ * @param input Is it for input or output?
+ * @return The data type of the wrapper, null if it's not a wrapper type
+ */
+ DataType getWrapperType(Operation operation, boolean input);
+
+ /**
+ * Check if the given data is an instance of the wrapper
+ * @param wrapper
+ * @param operation The operation
+ * @param input Input or output
+ * @return
+ */
+ boolean isInstance(Object wrapper, Operation operation, boolean input);
+
+ /**
+ * Populate the wrapper element with the child objects
+ * @param wrapper The wrapper object
+ * @param childObjects The child objects
+ * @param operation The operation
+ * @param input Is it for input or output
+ */
+ public void setChildren(T wrapper,
+ Object[] childObjects,
+ Operation operation,
+ boolean input);
+
+ /**
+ * Get a list of child elements from the wrapper
+ * @param wrapper The wrapper object
+ * @param operation The operation
+ * @param input Is it for input or output
+ * @return child elements under the wrapper
+ */
+ List getChildren(T wrapper, Operation operation, boolean input);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java
new file mode 100644
index 0000000000..e940f8675f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.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.databinding;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.xsd.XSDFactory;
+import org.apache.tuscany.sca.xsd.XSDefinition;
+
+/**
+ * XML and schema helper for Java types
+ */
+public interface XMLTypeHelper {
+
+ // FIXME: This method seems to require the XMLHelper instance to be stateful
+ /**
+ * Convert a Java type into XML type information
+ * @param javaType the physical Java class
+ * @param logical the logical type information
+ * @return the XML type information
+ */
+ TypeInfo getTypeInfo(Class javaType, Object logical);
+
+ /**
+ * Get schema definitions for the Java types known to this helper
+ * @return A list of schema definitions
+ */
+ // List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver);
+
+ /**
+ * Get a list of XML schemas for the given data types
+ * @param factory
+ * @param resolver
+ * @param dataTypes
+ * @return
+ */
+ List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, List<DataType> dataTypes);
+ /**
+ * Get a list of XML schemas for the given interface
+ * @param factory
+ * @param resolver
+ * @param intf
+ * @return
+ */
+ List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, Interface intf);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java
new file mode 100644
index 0000000000..4405077e29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.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.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 the mapping style for an interface or operation
+ *
+ * @version $Rev$ $Date$
+ */
+// FIXME: [rfeng] We should consider to use javax.jws.soap.SOAPBinding
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+public @interface DataBinding {
+
+ /**
+ * Indicate the effective databinding that controls the WSDL/Java mapping of the
+ * interface/operation
+ *
+ * @return the data binding with the MIME media type syntax
+ */
+ String value();
+
+ /**
+ * Indicate if the operation is mapped using WRAPPED or BARE style. Originated from
+ * javax.jws.soap.SOAPBinding.ParameterStyle: Determines whether method parameters
+ * represent the entire message body, or whether the parameters are elements wrapped
+ * inside a top-level element named after the operation
+ *
+ * @return true if the parameter style is WRAPPED, false if BARE
+ */
+ boolean wrapped() default false;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.java
new file mode 100644
index 0000000000..650e909c61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.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.databinding.annotation;
+
+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;
+
+/**
+ * Used to demarcate expected data types for parameters and return type
+ *
+ * @version $Rev$ $Date$
+ */
+@Target( {METHOD, PARAMETER})
+@Retention(RUNTIME)
+public @interface DataType {
+
+ /**
+ * Returns the data binding configuration in MIME media type syntax
+ * @return the data binding
+ */
+ String value();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java
new file mode 100644
index 0000000000..640a43f55d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.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.databinding.externalizable;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+
+/**
+ * DataNinding for Externalizable objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExternalizableDataBinding extends BaseDataBinding {
+
+ public static final String NAME = java.io.Externalizable.class.getName();
+ public static final String[] ALIASES = new String[] {"externalizable"};
+
+ public ExternalizableDataBinding() {
+ super(NAME, ALIASES, java.io.Externalizable.class);
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java
new file mode 100644
index 0000000000..4bbcf7ddef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.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.impl;
+
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.XMLTypeHelper;
+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.XMLType;
+
+/**
+ * Base Implementation of DataBinding
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseDataBinding implements DataBinding {
+
+ private Class<?> baseType;
+
+ private String name;
+ private 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;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean introspect(DataType type, Operation operation) {
+ assert type != null;
+ Class cls = type.getPhysical();
+ if (baseType != null && baseType.isAssignableFrom(cls)) {
+ type.setDataBinding(getName());
+ if (type.getLogical() == null) {
+ type.setLogical(XMLType.UNKNOWN);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public DataType introspect(Object value, Operation operation) {
+ if (value == null) {
+ return null;
+ } else {
+ DataType<Class> dataType = new DataTypeImpl<Class>(value.getClass(), value.getClass());
+ if (introspect(dataType, (Operation) 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 Object copy(Object object, DataType dataType, Operation operation) {
+ return object;
+ }
+
+ public SimpleTypeMapper getSimpleTypeMapper() {
+ return new SimpleTypeMapperImpl();
+ }
+
+ public XMLTypeHelper getXMLTypeHelper() {
+ return null;
+ }
+
+ public String[] getAliases() {
+ return aliases;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java
new file mode 100644
index 0000000000..94a2cdb0bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.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.impl;
+
+import org.apache.tuscany.sca.databinding.Transformer;
+
+/**
+ * Base Implementation of Transformer which provides the registration to the
+ * transformer registry
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseTransformer<S, T> implements Transformer {
+
+ protected BaseTransformer() {
+ super();
+ }
+
+ protected abstract Class<S> getSourceType();
+
+ protected abstract Class<T> 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java
new file mode 100644
index 0000000000..64b3d22c10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.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.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * Helper for DOM
+ *
+ * @version $Rev$ $Date$
+ */
+public final class DOMHelper {
+ private static DocumentBuilderFactory FACTORY;
+
+ private DOMHelper() {
+ }
+
+ public static Document newDocument() throws ParserConfigurationException {
+ return newDocumentBuilder().newDocument();
+ }
+
+ public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
+ init();
+ return FACTORY.newDocumentBuilder();
+ }
+
+ /**
+ *
+ */
+ private static synchronized void init() {
+ if (FACTORY == null) {
+ FACTORY = DocumentBuilderFactory.newInstance();
+ FACTORY.setNamespaceAware(true);
+ }
+ }
+
+ 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);
+ }
+
+ /**
+ * Wrap an element as a DOM document
+ * @param node
+ * @return
+ */
+ public static Document promote(Node node) {
+ if (node instanceof Document) {
+ return (Document)node;
+ }
+ Element element = (Element)node;
+ Document doc = element.getOwnerDocument();
+ if (doc.getDocumentElement() == element) {
+ return doc;
+ }
+ doc = (Document)element.getOwnerDocument().cloneNode(false);
+ Element schema = (Element)doc.importNode(element, true);
+ doc.appendChild(schema);
+ Node parent = element.getParentNode();
+ while (parent instanceof Element) {
+ Element root = (Element)parent;
+ NamedNodeMap nodeMap = root.getAttributes();
+ for (int i = 0; i < nodeMap.getLength(); i++) {
+ Attr attr = (Attr)nodeMap.item(i);
+ String name = attr.getName();
+ if ("xmlns".equals(name) || name.startsWith("xmlns:")) {
+ if (schema.getAttributeNode(name) == null) {
+ schema.setAttributeNodeNS((Attr)doc.importNode(attr, true));
+ }
+ }
+ }
+ parent = parent.getParentNode();
+ }
+ return doc;
+ }
+
+ /**
+ * @param context
+ * @param element
+ */
+ public static Element adjustElementName(TransformationContext context, Element element) {
+ if (context != null) {
+ DataType dataType = context.getTargetDataType();
+ Object logical = dataType == null ? null : dataType.getLogical();
+ if (!(logical instanceof XMLType)) {
+ return element;
+ }
+ XMLType xmlType = (XMLType)logical;
+ QName name = new QName(element.getNamespaceURI(), element.getLocalName());
+ if (xmlType.isElement() && !xmlType.getElementName().equals(name)) {
+ QName newName = xmlType.getElementName();
+ String prefix = newName.getPrefix();
+ String qname = newName.getLocalPart();
+ if (prefix != null && !prefix.equals("")) {
+ qname = prefix + ":" + qname;
+ }
+ Document doc = element.getOwnerDocument();
+ Element newElement = doc.createElementNS(newName.getNamespaceURI(), qname);
+ // Copy the attributes to the new element
+ NamedNodeMap attrs = element.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Attr attr = (Attr)doc.importNode(attrs.item(i), true);
+ newElement.getAttributes().setNamedItem(attr);
+ }
+
+ // Move all the children
+ while (element.hasChildNodes()) {
+ newElement.appendChild(element.getFirstChild());
+ }
+
+ // Replace the old node with the new node
+ if (element.getParentNode() != null) {
+ element.getParentNode().replaceChild(newElement, element);
+ }
+
+ return newElement;
+ }
+ }
+ return element;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
new file mode 100644
index 0000000000..01916dfb96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
@@ -0,0 +1,452 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.ArrayList;
+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;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Directed, weighted graph
+ *
+ * @param <V> The type of vertex object
+ * @param <E> The type of edge object
+ *
+ * @version $Rev$ $Date$
+ */
+public class DirectedGraph<V, E> implements Cloneable {
+ 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;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!VertexPair.class.isInstance(object)) {
+ return false;
+ }
+ VertexPair pair = (VertexPair)object;
+ return source == pair.source && target == pair.target;
+ }
+
+ @Override
+ public int hashCode() {
+ int x = source == null ? 0 : source.hashCode();
+ int y = target == null ? 0 : target.hashCode();
+ return x ^ y;
+ }
+
+ }
+
+ // Fix for TUSCANY-2069, making the map concurrent
+ private final Map<VertexPair, Path> paths = new ConcurrentHashMap<VertexPair, Path>();
+ private final Path NULL_PATH = new 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 Map<Vertex, Edge> inEdges = new HashMap<Vertex, Edge>();
+
+ private Vertex(V value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "(" + value + ")";
+ }
+
+ public V getValue() {
+ return value;
+ }
+
+ public Map<Vertex, Edge> getOutEdges() {
+ return outEdges;
+ }
+
+ public Map<Vertex, Edge> getInEdges() {
+ return inEdges;
+ }
+
+ }
+
+ /**
+ * An Edge connects two vertices in one direction
+ */
+ public final class Edge {
+ private Vertex sourceVertex;
+
+ private Vertex targetVertex;
+
+ private E value;
+
+ private int weight;
+
+ private boolean pub = true;
+
+ public Edge(Vertex source, Vertex target, E value, int weight, boolean pub) {
+ this.sourceVertex = source;
+ this.targetVertex = target;
+ this.value = value;
+ this.weight = weight;
+ this.pub = pub;
+ }
+
+ @Override
+ 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;
+ }
+
+ public boolean isPublic() {
+ return pub;
+ }
+
+ public void setPublic(boolean pub) {
+ this.pub = pub;
+ }
+ }
+
+ 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, boolean publicEdge) {
+ 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, publicEdge);
+ s.outEdges.put(t, edge);
+ t.inEdges.put(s, edge);
+ }
+
+ public void addEdge(V soure, V target) {
+ addEdge(soure, target, null, 0, true);
+ }
+
+ 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 && t.inEdges.remove(s) != null;
+
+ }
+
+ public void removeEdge(Edge edge) {
+ edge.sourceVertex.outEdges.remove(edge.targetVertex);
+ edge.targetVertex.inEdges.remove(edge.sourceVertex);
+ }
+
+ public void removeVertex(Vertex vertex) {
+ vertices.remove(vertex.getValue());
+ for (Edge e : new ArrayList<Edge>(vertex.outEdges.values())) {
+ removeEdge(e);
+ }
+ for (Edge e : new ArrayList<Edge>(vertex.inEdges.values())) {
+ removeEdge(e);
+ }
+ }
+
+ public Edge getEdge(Vertex source, Vertex target) {
+ return source.outEdges.get(target);
+ }
+
+ public Edge getEdge(V source, V target) {
+ Vertex sv = getVertex(source);
+ if (sv == null) {
+ return null;
+ }
+ Vertex tv = getVertex(target);
+ if (tv == null) {
+ return null;
+ }
+ return getEdge(getVertex(source), getVertex(target));
+ }
+
+ /**
+ * Get the shortest 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);
+ Path path = null;
+ if (paths.containsKey(pair)) {
+ path = paths.get(pair);
+ return path == NULL_PATH? null: path;
+ }
+
+ // Check if there is a direct link, if yes, use it instead
+ Edge direct = getEdge(source, target);
+ path = new Path();
+ if (direct != null) {
+ path.addEdge(direct);
+ 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>();
+ Node nextNode = null;
+ while (!otherNodes.isEmpty()) {
+ nextNode = extractMin(otherNodes);
+ if (nextNode.vertex == target) {
+ path = getPath(nextNode);
+ paths.put(pair, path); // Cache it
+ return path == NULL_PATH? null: path;
+ }
+ nodesOnPath.add(nextNode);
+ for (Edge edge : nextNode.vertex.outEdges.values()) {
+ Node adjacentNode = nodes.get(edge.targetVertex);
+ // The private edge can only be used if the edge connects to the target directly
+ if (edge.isPublic() || edge.getTargetVertex() == target) {
+ if (nextNode.distance + edge.weight < adjacentNode.distance) {
+ adjacentNode.distance = nextNode.distance + edge.weight;
+ adjacentNode.previous = nextNode;
+ }
+ }
+ }
+ }
+ paths.put(pair, NULL_PATH); // 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;
+ }
+
+ @Override
+ public String toString() {
+ return edges + ", " + weight;
+ }
+ }
+
+ private Path getPath(Node t) {
+ if (t.distance == Integer.MAX_VALUE) {
+ return NULL_PATH;
+ }
+ 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;
+ }
+
+ @Override
+ 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, true);
+ }
+ }
+ }
+
+ private Vertex getFirst() {
+ for (Vertex v : vertices.values()) {
+ if (v.inEdges.isEmpty()) {
+ return v;
+ }
+ }
+ if (!vertices.isEmpty()) {
+ throw new IllegalArgumentException("Circular ordering has been detected: " + toString());
+ } else {
+ return null;
+ }
+ }
+
+ public List<V> topologicalSort(boolean readOnly) {
+ DirectedGraph<V, E> graph = (!readOnly) ? this : (DirectedGraph<V, E>)clone();
+ List<V> list = new ArrayList<V>();
+ while (true) {
+ Vertex v = graph.getFirst();
+ if (v == null) {
+ break;
+ }
+ list.add(v.getValue());
+ graph.removeVertex(v);
+ }
+
+ return list;
+ }
+
+ @Override
+ public Object clone() {
+ DirectedGraph<V, E> copy = new DirectedGraph<V, E>();
+ copy.addGraph(this);
+ return copy;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java
new file mode 100644
index 0000000000..cc7b40d06b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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<Object> getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class<Object> getTargetType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java
new file mode 100644
index 0000000000..4a918488c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.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.impl;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * 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")
+ @Override
+ public boolean introspect(DataType type, Operation operation) {
+ 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));
+ Object logical = getLogical(cls, null);
+ if (logical != null) {
+ type.setLogical(getLogical(cls, null));
+ } else {
+ type.setLogical(XMLType.UNKNOWN);
+ }
+ 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 operation TODO
+ * @return
+ */
+ protected abstract Object getLogical(Class<?> type, Operation operation);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java
new file mode 100644
index 0000000000..45896ca6a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.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.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.databinding.javabeans.SimpleJavaDataBinding;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from a simple java object to a databinding's representation
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+
+ @Override
+ public Class<Object> getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+
+ protected abstract T createElement(QName element, String literal, TransformationContext context);
+
+ @Override
+ public String getSourceDataBinding() {
+ return SimpleJavaDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
new file mode 100644
index 0000000000..b7ddf87a41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.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.databinding.impl;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+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.DataPipeTransformer;
+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.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+
+/**
+ * Default Mediator implementation
+ *
+ * @version $Rev$ $Date$
+ */
+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) {
+ if (source != null) {
+ Operation operation = (Operation) metadata.get("source.operation");
+ sourceDataType = dataBindings.introspectType(source, operation);
+ }
+ }
+ if (sourceDataType == null || targetDataType == 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) {
+ DataPipeTransformer dataPipeFactory = (i < size - 1) ? (DataPipeTransformer)path.get(++i) : null;
+ DataPipe dataPipe = dataPipeFactory == null ? null : dataPipeFactory.newInstance();
+ ((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());
+
+ //FIXME The ClassLoader should be passed in
+ // Allow privileged access to get ClassLoader. Requires RuntimePermission in security
+ // policy.
+ ClassLoader classLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return 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) {
+ Operation operation = (Operation) metadata.get("source.operation");
+ sourceDataType = dataBindings.introspectType(source, operation);
+ }
+ 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) {
+ DataPipeTransformer dataPipeFactory = (i < size - 1) ? (DataPipeTransformer)path.get(++i) : null;
+ DataPipe dataPipe = dataPipeFactory == null ? null : dataPipeFactory.newInstance();
+ 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: " + sourceId + "->" + targetId);
+ 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java
new file mode 100644
index 0000000000..a1a89005b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.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.impl;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.DataPipeTransformer;
+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> Intermediate type
+ * @param <R> Result type
+ *
+ * @version $Rev$ $Date$
+ */
+public class PipedTransformer<S, I, R> implements PullTransformer<S, R> {
+ private PushTransformer<S, I> pusher;
+
+ private DataPipeTransformer<I, R> pipe;
+
+ /**
+ * @param pumper
+ * @param pipe
+ */
+ public PipedTransformer(PushTransformer<S, I> pumper, DataPipeTransformer<I, R> pipe) {
+ super();
+ this.pusher = pumper;
+ this.pipe = pipe;
+ }
+
+ public R transform(S source, TransformationContext context) {
+ DataPipe<I, R> dataPipe = pipe.newInstance();
+ pusher.transform(source, dataPipe.getSink(), context);
+ return dataPipe.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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java
new file mode 100644
index 0000000000..c91176fc2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.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 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.databinding.javabeans.SimpleJavaDataBinding;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from a databinding's representation of simple
+ * types to Java Objects
+ *
+ * @version $Rev$ $Date$
+ */
+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();
+ QName type = (xmlType != null) ? xmlType.getTypeName() : null;
+ if (type == null) {
+ xmlType = (XMLType)context.getTargetDataType().getLogical();
+ type = (xmlType != null) ? xmlType.getTypeName() : null;
+ }
+ Object result = mapper.toJavaObject(type, getText(source), context);
+ close(source);
+ return result;
+ }
+
+ @Override
+ protected Class<Object> getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public int getWeight() {
+ // Cannot be used for intermediate
+ return 10000;
+ }
+
+ /**
+ * Get the string value from the source
+ * @param source
+ * @return A string
+ */
+ protected abstract String getText(T source);
+
+ /**
+ * To be overrided by the subclass
+ * @param source
+ */
+ protected void close(T source) {
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return SimpleJavaDataBinding.NAME;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java
new file mode 100644
index 0000000000..32a2313f59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java
@@ -0,0 +1,401 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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;
+
+/**
+ * Simple type mapper that maps from XSD types to Java Classes and Java Classes to XSD types.
+ *
+ * @version $Rev$ $Date$
+ */
+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 (xmlType != null && URI_2001_SCHEMA_XSD.equals(xmlType.getNamespaceURI())) {
+ return XML2JAVA.get(xmlType.getLocalPart());
+ } else {
+ return null;
+ }
+ }
+
+ public static 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 == null) {
+ // It could be null if nilable=true
+ return null;
+ }
+ 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java
new file mode 100644
index 0000000000..a6c0639411
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.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.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();
+ // This is used only for testing
+ 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java
new file mode 100644
index 0000000000..fb747864e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java
@@ -0,0 +1,945 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java
new file mode 100644
index 0000000000..2f95c2a9c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.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.databinding.javabeans;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Transformer to convert data from DOM Node to JavaBean
+ *
+ * @version $Rev$ $Date$
+ */
+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 Iterator<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.iterator();
+ }
+
+ @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;
+ }
+
+ @Override
+ public boolean isTextOnly(Node element) throws XML2JavaMapperException {
+ NodeList childNodes = element.getChildNodes();
+ return childNodes.getLength() == 1 && isTextElement(childNodes.item(0));
+ }
+
+ @Override
+ public Node getFirstChildWithName(Node element, QName name) throws XML2JavaMapperException {
+ Node child;
+ for (child = element.getFirstChild();
+ child != null && !(child.getNodeName() == name.getLocalPart()
+ && child.getNamespaceURI() == name.getNamespaceURI()) ;
+ child = child.getNextSibling()) {
+ }
+ return child;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java
new file mode 100644
index 0000000000..9615f43572
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.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.javabeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This exception is used to encapsulate and rethrow exceptions that arise out
+ * of converting JavaBean objects to XML
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java
new file mode 100644
index 0000000000..58f594751a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.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.javabeans;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ * Transformer to convert data from a JavaBean object to DOM Node
+ *
+ * @version $Rev$ $Date$
+ */
+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 void appendText(Node parentElement, String textData) throws Java2XMLMapperException {
+ Node textNode;
+ if (textData != null) {
+ textNode = factory.createTextNode(textData);
+ } else {
+ Attr nil = factory.createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:nil");
+ nil.setValue("true");
+ textNode = nil;
+ }
+ appendChild(parentElement, textNode);
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.java
new file mode 100644
index 0000000000..4942fef0da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.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.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.BeanXMLStreamReaderImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from a JavaBean object to XMLStreamReader.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaBean2XMLStreamReaderTransformer extends BaseTransformer<Object, XMLStreamReader> implements
+ PullTransformer<Object, XMLStreamReader> {
+
+ public XMLStreamReader transform(Object source, TransformationContext context) {
+ try {
+ javax.xml.namespace.QName name = null;
+ if (context != null) {
+ Object logical = context.getSourceDataType().getLogical();
+ if (logical instanceof XMLType) {
+ name = ((XMLType)logical).getElementName();
+ }
+ }
+ return new BeanXMLStreamReaderImpl(name, source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ protected Class<Object> getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java
new file mode 100644
index 0000000000..b96b394bb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from a JavaBean object to xml
+ *
+ * @version $Rev$ $Date$
+ */
+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) {
+ QName rootElement = null;
+ if (context != null) {
+ DataType<?> type = context.getTargetDataType();
+ if (type != null) {
+ Object logical = type.getLogical();
+ if (logical instanceof XMLType) {
+ rootElement = ((XMLType)logical).getElementName();
+ }
+ }
+ }
+ //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)) {
+ appendText(parent, mapper.toXMLLiteral(null, javaObject, context));
+ } else if (javaType.isArray()) {
+ int size = Array.getLength(javaObject);
+ for (int count = 0; count < size; ++count) {
+ Object item = Array.get(javaObject, count);
+ element = createElement(elementName);
+ appendChild(parent, element);
+ appendChildElements(element, elementName, javaType.getComponentType(), item, context);
+ }
+ } 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.getMethods();
+ String fieldName = null;
+ for (Method aMethod : methods) {
+ try {
+ if (Modifier.isPublic(aMethod.getModifiers()) && aMethod.getName().startsWith(GET)
+ && aMethod.getParameterTypes().length == 0
+ && isMappedGetter(aMethod.getName())) {
+ 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;
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Subclasses can override this method to prevent some getter methods
+ * from being mapped. The default implementation provided by this class
+ * maps all getter methods.
+ */
+ protected boolean isMappedGetter(String methodName) {
+ return true;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ @Override
+ public Class<Object> 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
+ || javaObject instanceof Boolean) {
+ 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;
+ }
+
+ /**
+ * Create an element with the given name
+ * @param qName
+ * @return
+ * @throws Java2XMLMapperException
+ */
+ public abstract T createElement(QName qName) throws Java2XMLMapperException;
+
+ /**
+ * Create a text node and add it to the parent
+ * @param parentElement
+ * @param textData
+ * @throws Java2XMLMapperException
+ */
+ public abstract void appendText(T parentElement, String textData) throws Java2XMLMapperException;
+
+ /**
+ * Add the child element to the parent
+ * @param parentElement
+ * @param childElement
+ * @throws Java2XMLMapperException
+ */
+ public abstract void appendChild(T parentElement, T childElement) throws Java2XMLMapperException;
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java
new file mode 100644
index 0000000000..fb04014051
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * DataBinding for JavaBeans
+ *
+ * @version $Rev$ $Date$
+ */
+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 = "java:complexType";
+
+ public JavaBeansDataBinding() {
+ super(NAME, Object.class);
+ }
+
+ protected JavaBeansDataBinding(String name, Class<?> baseType) {
+ super(name, baseType);
+ }
+
+ @Override
+ public Object copy(Object arg, DataType dataType, Operation operation) {
+ 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();
+
+ // Work out which ClassLoader to use for deserializing arg
+ // We want to use:
+ // * The ClassLoader of arg if it is not the System ClassLoader
+ // * The ThreadContext ClassLoader if the ClassLoader of arg is the System ClassLoader
+ // because Collection classes are loaded by the System ClassLoader but their contents
+ // may be loaded from another ClassLoader
+ //
+ ClassLoader classLoaderToUse = clazz.getClassLoader();
+ if (classLoaderToUse == null)
+ {
+ // ClassLoader of arg is the System ClassLoader so we will use the ThreadContext ClassLoader
+ // instead
+ classLoaderToUse = Thread.currentThread().getContextClassLoader();
+ }
+
+ ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+ ObjectInputStream ois = getObjectInputStream(bis, classLoaderToUse);
+ Object objectCopy = ois.readObject();
+ ois.close();
+ bis.close();
+ return objectCopy;
+ } else {
+ // return arg;
+ throw new IllegalArgumentException("Argument type '" + arg.getClass().getCanonicalName() + "' is not Serializable. " +
+ " Pass-by-value cannot be performed on this argument");
+ }
+ } 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) {
+ try {
+ // For OSGi, use context ClassLoader if the bundle ClassLoader cannot load the class
+ if (cl != Thread.currentThread().getContextClassLoader()) {
+ return Class.forName(desc.getName(), false, Thread.currentThread().getContextClassLoader());
+ }
+ } catch (ClassNotFoundException e1) {
+ // ignore
+ } catch (NoClassDefFoundError e1) {
+ // ignore
+ }
+ return super.resolveClass(desc);
+ }
+ }
+
+ };
+ return ois;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.java
new file mode 100644
index 0000000000..7ae64c6a27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.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.javabeans;
+
+
+/**
+ * DataBinding for Java Exceptions
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaExceptionDataBinding extends JavaBeansDataBinding {
+
+ public static final String NAME = "java:exception";
+
+ public JavaExceptionDataBinding() {
+ super(NAME, null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java
new file mode 100644
index 0000000000..11c82e062c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.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.javabeans;
+
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * DataBinding for Java simple types
+ *
+ * @version $Rev$ $Date$
+ */
+public class SimpleJavaDataBinding extends BaseDataBinding {
+ public static final String NAME = "java:simpleType";
+
+ public SimpleJavaDataBinding() {
+ super(NAME, Object.class);
+ }
+
+ @Override
+ public Object copy(Object arg, DataType dataType, Operation operation) {
+ if (arg instanceof byte[]) {
+ return ((byte[])arg).clone();
+ }
+ return arg;
+ }
+
+ @Override
+ public boolean introspect(DataType type, Operation operation) {
+ Class<?> cls = type.getPhysical();
+ if (cls == Object.class) {
+ return false;
+ }
+ // HACK: [rfeng] By pass the one know to XMLString
+ String db = type.getDataBinding();
+ if (db != null && (XMLStringDataBinding.NAME.equals(db) || XMLStringDataBinding.ALIASES[0].equals(db))) {
+ return false;
+ }
+ if (SimpleTypeMapperImpl.JAVA2XML.keySet().contains(cls)) {
+ type.setDataBinding(NAME);
+ QName elementName = null;
+ Object logical = type.getLogical();
+ if (logical instanceof XMLType) {
+ elementName = ((XMLType)logical).getElementName();
+ }
+ TypeInfo typeInfo = SimpleTypeMapperImpl.getXMLType(cls);
+ type.setLogical(new XMLType(elementName, typeInfo == null ? null : typeInfo.getQName()));
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java
new file mode 100644
index 0000000000..06feeffabd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java
@@ -0,0 +1,329 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.Constructor;
+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.Iterator;
+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
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class XML2JavaBeanTransformer<T> extends BaseTransformer<T, Object> implements
+ PullTransformer<T, Object> {
+
+ public static final String SET = "set";
+ public static final QName QNAME_MESSAGE = new QName("message");
+
+ protected SimpleTypeMapperImpl mapper;
+
+ public XML2JavaBeanTransformer() {
+ this.mapper = new SimpleTypeMapperImpl();
+ }
+
+ @Override
+ public int getWeight() {
+ return JavaBeansDataBinding.HEAVY_WEIGHT;
+ }
+
+ public Object transform(T source, TransformationContext context) {
+ //FIXME why is the logical type sometimes a Class instead of an XMLType?
+ if (context.getSourceDataType().getLogical() instanceof XMLType) {
+ XMLType xmlType = (XMLType) context.getSourceDataType().getLogical();
+ return toJavaObject(xmlType.getTypeName(), getRootElement(source), context);
+ } else {
+ return toJavaObject(null, getRootElement(source), context);
+ }
+ }
+
+ public Object toJavaObject(QName xmlType, T xmlElement, TransformationContext context) {
+ if (xmlType != null && 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 {
+ if (isTextOnly(element)) {
+ return (L) mapper.toJavaObject(SimpleTypeMapperImpl.getXMLType(javaType).getQName(),
+ getText(element),
+ context);
+ } else {
+ String fieldName = null;
+ try {
+ L javaInstance;
+ T detailMsg = null;
+ if (Throwable.class.isAssignableFrom(javaType)) {
+ T msgElement = getFirstChildWithName(element, QNAME_MESSAGE);
+ if (msgElement != null && isTextOnly(msgElement)) {
+ detailMsg = msgElement; // skip this when handling child elements
+ Constructor constructor = javaType.getConstructor(new Class[] {String.class});
+ javaInstance = (L)constructor.newInstance(new Object[] {getText(detailMsg)});
+ } else {
+ javaInstance = javaType.newInstance();
+ }
+ } else {
+ javaInstance = javaType.newInstance();
+ }
+ Map<Field, List<Object>> arrayFields = new Hashtable<Field, List<Object>>();
+ Map<Method, List<Object>> arraySetters = new Hashtable<Method, List<Object>>();
+
+ for (Iterator<T> childElements = getChildElements(element); childElements.hasNext(); ) {
+ T childElement = childElements.next();
+ if (!isTextElement(childElement) && childElement != detailMsg) {
+ fieldName = getElementName(childElement);
+ try {
+ Field javaField = javaType.getField(fieldName);
+ setFieldValue(javaInstance,
+ javaField,
+ childElement,
+ arrayFields,
+ context);
+
+ } catch (NoSuchFieldException e1) {
+ setFieldValueUsingSetter(javaType,
+ javaInstance,
+ fieldName,
+ childElement,
+ 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 Iterator<T> getChildElements(T parent) throws XML2JavaMapperException;
+
+ public abstract String getElementName(T element) throws XML2JavaMapperException;
+
+ public abstract boolean isTextElement(T element) throws XML2JavaMapperException;
+
+ public abstract boolean isTextOnly(T element) throws XML2JavaMapperException;
+
+ public abstract T getFirstChildWithName(T element, QName name) throws XML2JavaMapperException;
+
+ public abstract T getRootElement(T element) throws XML2JavaMapperException;
+
+ @Override
+ public Class<Object> getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java
new file mode 100644
index 0000000000..a723fd445c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.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.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.
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java
new file mode 100644
index 0000000000..1e39150f4a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.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.databinding.util;
+
+import java.lang.reflect.GenericArrayType;
+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.HashSet;
+import java.util.List;
+import java.util.Set;
+
+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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataTypeHelper {
+ private DataTypeHelper() {
+ }
+
+ /**
+ * Find all classes referenced by this data type though java generics
+ * @param d
+ * @return
+ */
+ public static Set<Class<?>> findClasses(DataType d) {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ Set<Type> visited = new HashSet<Type>();
+ findClasses(d, classes, visited);
+ return classes;
+ }
+
+ private static void findClasses(DataType d, Set<Class<?>> classes, Set<Type> visited) {
+ if (d == null) {
+ return;
+ }
+ classes.add(d.getPhysical());
+ if (d.getPhysical() != d.getGenericType()) {
+ findClasses(d.getGenericType(), classes, visited);
+ }
+ }
+
+ /**
+ * Find referenced classes in the generic type
+ * @param type
+ * @param classSet
+ * @param visited
+ */
+ private static void findClasses(Type type, Set<Class<?>> classSet, Set<Type> visited) {
+ if (visited.contains(type) || type == null) {
+ return;
+ }
+ visited.add(type);
+ if (type instanceof Class) {
+ Class<?> cls = (Class<?>)type;
+ if (!cls.isInterface()) {
+ classSet.add(cls);
+ }
+ return;
+ } else if (type instanceof ParameterizedType) {
+ ParameterizedType pType = (ParameterizedType)type;
+ findClasses(pType.getRawType(), classSet, visited);
+ for (Type t : pType.getActualTypeArguments()) {
+ findClasses(t, classSet, visited);
+ }
+ } else if (type instanceof TypeVariable) {
+ TypeVariable<?> tv = (TypeVariable<?>)type;
+ for (Type t : tv.getBounds()) {
+ findClasses(t, classSet, visited);
+ }
+ } else if (type instanceof GenericArrayType) {
+ GenericArrayType gType = (GenericArrayType)type;
+ findClasses(gType, classSet, visited);
+ } else if (type instanceof WildcardType) {
+ WildcardType wType = (WildcardType)type;
+ for (Type t : wType.getLowerBounds()) {
+ findClasses(t, classSet, visited);
+ }
+ for (Type t : wType.getUpperBounds()) {
+ findClasses(t, classSet, visited);
+ }
+ }
+ }
+
+ /**
+ * Get all the data types in the interface
+ * @param intf The interface
+ * @param useWrapper Use wrapper classes?
+ * @return A list of DataTypes
+ */
+ public static List<DataType> getDataTypes(Interface intf, boolean useWrapper) {
+ List<DataType> dataTypes = new ArrayList<DataType>();
+ for (Operation op : intf.getOperations()) {
+ getDataTypes(dataTypes, op, useWrapper);
+ }
+ return dataTypes;
+ }
+
+ /**
+ * Get all the data types in the operation
+ * @param op The operaiton
+ * @param useWrapper Use wrapper classes?
+ * @return A list of DataTypes
+ */
+ public static List<DataType> getDataTypes(Operation op, boolean useWrapper) {
+ List<DataType> dataTypes = new ArrayList<DataType>();
+ getDataTypes(dataTypes, op, useWrapper);
+ return dataTypes;
+ }
+
+ private static void getDataTypes(List<DataType> dataTypes, Operation op, boolean useWrapper) {
+ WrapperInfo wrapper = op.getWrapper();
+ if (useWrapper && wrapper != null) {
+ DataType dt1 = wrapper.getInputWrapperType();
+ if (dt1 != null) {
+ dataTypes.add(dt1);
+ }
+ DataType dt2 = wrapper.getOutputWrapperType();
+ if (dt2 != null) {
+ dataTypes.add(dt2);
+ }
+ }
+ // FIXME: [rfeng] We may need to find the referenced classes in the child types
+ // else
+ {
+ for (DataType dt1 : op.getInputType().getLogical()) {
+ dataTypes.add(dt1);
+ }
+ DataType dt2 = op.getOutputType();
+ if (dt2 != null) {
+ dataTypes.add(dt2);
+ }
+ }
+ for (DataType<DataType> dt3 : op.getFaultTypes()) {
+ DataType dt4 = dt3.getLogical();
+ if (dt4 != null) {
+ dataTypes.add(dt4);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/LRUCache.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/LRUCache.java
new file mode 100644
index 0000000000..34a82fd2d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/LRUCache.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.util;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * A Simple LRU Cache
+ *
+ * @version $Revision$
+ * @param <K>
+ * @param <V>
+ */
+
+public class LRUCache<K, V> extends LinkedHashMap<K, V> {
+ private static final long serialVersionUID = -342098639681884413L;
+ protected int maxCacheSize = 4096;
+
+ /**
+ * Default constructor for an LRU Cache The default capacity is 10000
+ */
+ public LRUCache() {
+ this(0, 4096, 0.75f, true);
+ }
+
+ /**
+ * Constructs a LRUCache with a maximum capacity
+ *
+ * @param maximumCacheSize
+ */
+ public LRUCache(int maximumCacheSize) {
+ this(0, maximumCacheSize, 0.75f, true);
+ }
+
+ /**
+ * Constructs an empty <tt>LRUCache</tt> instance with the specified
+ * initial capacity, maximumCacheSize,load factor and ordering mode.
+ *
+ * @param initialCapacity the initial capacity.
+ * @param maximumCacheSize
+ * @param loadFactor the load factor.
+ * @param accessOrder the ordering mode - <tt>true</tt> for access-order,
+ * <tt>false</tt> for insertion-order.
+ * @throws IllegalArgumentException if the initial capacity is negative or
+ * the load factor is non-positive.
+ */
+
+ public LRUCache(int initialCapacity, int maximumCacheSize, float loadFactor, boolean accessOrder) {
+ super(initialCapacity, loadFactor, accessOrder);
+ this.maxCacheSize = maximumCacheSize;
+ }
+
+ /**
+ * @return Returns the maxCacheSize.
+ */
+ public int getMaxCacheSize() {
+ return maxCacheSize;
+ }
+
+ /**
+ * @param maxCacheSize The maxCacheSize to set.
+ */
+ public void setMaxCacheSize(int maxCacheSize) {
+ this.maxCacheSize = maxCacheSize;
+ }
+
+ @Override
+ protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
+ return size() > maxCacheSize;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
new file mode 100644
index 0000000000..3423d3e3b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.databinding.xml;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BeanXMLStreamReaderImpl extends XmlTreeStreamReaderImpl {
+ private static final Comparator<Accessor> COMPARATOR = new Comparator<Accessor>() {
+ public int compare(Accessor o1, Accessor o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ };
+
+ public static class BeanXmlNodeImpl extends SimpleXmlNodeImpl implements XmlNode {
+ private static final Object[] NULL = null;
+ private static final SimpleTypeMapperImpl MAPPER = new SimpleTypeMapperImpl();
+
+ public BeanXmlNodeImpl(Object bean) {
+ super(getName(bean == null ? null : bean.getClass()), bean);
+ }
+
+ public BeanXmlNodeImpl(QName name, Object bean) {
+ super(name, bean);
+ }
+
+ private static boolean isSimpleType(Class<?> javaType) {
+ return SimpleTypeMapperImpl.getXMLType(javaType) != null;
+ }
+
+ private static String getStringValue(Object o) {
+ if (o == null) {
+ return null;
+ }
+ TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass());
+ if (info != null) {
+ return MAPPER.toXMLLiteral(info.getQName(), o, null);
+ } else {
+ return String.valueOf(o);
+ }
+ }
+
+ @Override
+ public Iterator<XmlNode> children() {
+ if (name == null) {
+ return null;
+ }
+ if (value == null) {
+ return super.children();
+ }
+ if (isSimpleType(value.getClass())) {
+ XmlNode textNode = new BeanXmlNodeImpl(null, value);
+ return Arrays.asList(textNode).iterator();
+ }
+ if (Map.class.isAssignableFrom(value.getClass())) {
+ List<XmlNode> entries = new ArrayList<XmlNode>();
+ QName entryName = new QName(name.getNamespaceURI(), "entry");
+ Map map = (Map)value;
+ if (map != null) {
+ for (Object e : map.entrySet()) {
+ Map.Entry entry = (Map.Entry)e;
+ entries.add(new BeanXmlNodeImpl(entryName, entry));
+ }
+ }
+ return entries.iterator();
+ }
+ try {
+ Map<String, Accessor> accessorMap = getAccessors(value);
+ List<Accessor> accessorList = new ArrayList<Accessor>(accessorMap.values());
+ Collections.sort(accessorList, COMPARATOR);
+
+ List<XmlNode> props = new ArrayList<XmlNode>();
+ for (Accessor accessor : accessorList) {
+ Class<?> pType = accessor.getType();
+
+ QName pName = new QName(name.getNamespaceURI(), accessor.getName());
+ Object pValue = accessor.getValue();
+ if (pType.isArray()) {
+ if (pValue != null) {
+ int i1 = Array.getLength(pValue);
+ for (int j = 0; j < i1; j++) {
+ Object o = Array.get(pValue, j);
+ props.add(new BeanXmlNodeImpl(pName, o));
+ }
+ } else {
+ // TODO: How to handle null?
+ }
+ } else if (Collection.class.isAssignableFrom(pType)) {
+ Collection objList = (Collection)pValue;
+ if (objList != null && objList.size() > 0) {
+ for (Iterator j = objList.iterator(); j.hasNext();) {
+ Object o = j.next();
+ props.add(new BeanXmlNodeImpl(pName, o));
+ }
+
+ } else {
+ // How to handle null
+ }
+ } else {
+ props.add(new BeanXmlNodeImpl(pName, pValue));
+ }
+ }
+ return props.iterator();
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ @Override
+ public QName getName() {
+ return name;
+ }
+
+ @Override
+ public String getValue() {
+ return getStringValue(value);
+ }
+
+ private static String getPackageName(Class<?> cls) {
+ String name = cls.getName();
+ int index = name.lastIndexOf('.');
+ return index == -1 ? "" : name.substring(0, index);
+ }
+
+ public static QName getName(Class<?> cls) {
+ if (cls == null) {
+ return null;
+ }
+
+ String packageName = getPackageName(cls);
+
+ if ("".equals(packageName)) {
+ return new QName("", cls.getSimpleName());
+ }
+ StringBuffer ns = new StringBuffer("http://");
+ String[] names = packageName.split("\\.");
+ for (int i = names.length - 1; i >= 0; i--) {
+ ns.append(names[i]);
+ if (i != 0) {
+ ns.append('.');
+ }
+ }
+ ns.append('/');
+ return new QName(ns.toString(), cls.getSimpleName());
+ }
+
+ }
+
+ public BeanXMLStreamReaderImpl(QName name, Object bean) {
+ super(getXmlNode(name, bean));
+ }
+
+ private static BeanXmlNodeImpl getXmlNode(QName name, Object bean) {
+ BeanXmlNodeImpl root = null;
+ if (name != null) {
+ root = new BeanXmlNodeImpl(name, bean);
+ } else {
+ root = new BeanXmlNodeImpl(bean);
+ }
+ return root;
+ }
+
+ public static interface Accessor {
+ String getName();
+
+ Class<?> getType();
+
+ Object getValue() throws Exception;
+
+ void setValue(Object value) throws Exception;
+ }
+
+ private static class FieldAccessor implements Accessor {
+ private Object target;
+ private Field field;
+
+ public FieldAccessor(Object target, Field field) {
+ super();
+ this.target = target;
+ this.field = field;
+ this.field.setAccessible(true);
+ }
+
+ public String getName() {
+ return field.getName();
+ }
+
+ public Object getValue() throws Exception {
+ return field.get(target);
+ }
+
+ public void setValue(Object value) throws Exception {
+ field.set(target, value);
+ }
+
+ public Class<?> getType() {
+ return field.getType();
+ }
+
+ }
+
+ private static class PropertyAccessor implements Accessor {
+ private Object target;
+ private PropertyDescriptor prop;
+
+ public PropertyAccessor(Object target, PropertyDescriptor prop) {
+ super();
+ this.target = target;
+ this.prop = prop;
+ }
+
+ public String getName() {
+ return prop.getName();
+ }
+
+ public Class<?> getType() {
+ return prop.getPropertyType();
+ }
+
+ public Object getValue() throws Exception {
+ Method getter = prop.getReadMethod();
+ if (getter != null) {
+ getter.setAccessible(true);
+ return getter.invoke(target);
+ }
+ throw new IllegalAccessException("The property cannot be read: " + getName());
+ }
+
+ public void setValue(Object value) throws Exception {
+ Method setter = prop.getWriteMethod();
+ if (setter != null) {
+ setter.setAccessible(true);
+ setter.invoke(target);
+ }
+ throw new IllegalAccessException("The property cannot be written: " + getName());
+ }
+
+ }
+
+ private static Map<String, Accessor> getAccessors(Object target) throws Exception {
+ if (target == null) {
+ return Collections.emptyMap();
+ }
+ Map<String, Accessor> map = new HashMap<String, Accessor>();
+ Class<?> type = target.getClass();
+ for (Field f : type.getFields()) {
+ map.put(f.getName(), new FieldAccessor(target, f));
+ }
+ BeanInfo info = Introspector.getBeanInfo(type, Object.class);
+ for (PropertyDescriptor p : info.getPropertyDescriptors()) {
+ // if (p.getReadMethod() != null && p.getWriteMethod() != null) {
+ map.put(p.getName(), new PropertyAccessor(target, p));
+ // }
+ }
+ return map;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java
new file mode 100644
index 0000000000..92058d769f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.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.databinding.xml;
+
+
+import javax.xml.namespace.QName;
+
+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.Operation;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+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 static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/dom/1.0";
+ public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
+
+ public DOMDataBinding() {
+ super(NAME, ALIASES, Node.class);
+ }
+
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return new DOMWrapperHandler();
+ }
+
+ @Override
+ public Object copy(Object source, DataType dataType, Operation operation) {
+ if (Node.class.isAssignableFrom(source.getClass())) {
+ Node nodeSource = (Node)source;
+ return nodeSource.cloneNode(true);
+ }
+ return super.copy(source, dataType, operation);
+ }
+
+ @Override
+ public boolean introspect(DataType type, Operation operation) {
+ if (Node.class.isAssignableFrom(type.getPhysical())) {
+ if (type.getLogical() == null) {
+ type.setLogical(new XMLType(ROOT_ELEMENT, null));
+ }
+ type.setDataBinding(NAME);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java
new file mode 100644
index 0000000000..9e1ebb3522
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+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.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.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class DOMWrapperHandler implements WrapperHandler<Node> {
+
+ public DOMWrapperHandler() {
+ super();
+ }
+
+ public Node create(Operation operation, boolean input) {
+ try {
+ WrapperInfo wrapperInfo = operation.getWrapper();
+ ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement();
+ // Class<?> wrapperClass = input ? wrapperInfo.getInputWrapperClass() : wrapperInfo.getOutputWrapperClass();
+ Document document = DOMHelper.newDocument();
+ QName name = element.getQName();
+ return DOMHelper.createElement(document, name);
+ } catch (ParserConfigurationException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public void setChildren(Node wrapper,
+ Object[] childObjects,
+ Operation operation, boolean input) {
+ List<ElementInfo> childElements = input? operation.getWrapper().getInputChildElements():
+ operation.getWrapper().getOutputChildElements();
+ for (int i = 0; i < childElements.size(); i++) {
+ setChild(wrapper, i, childElements.get(i), childObjects[i]);
+ }
+
+ }
+ 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, Operation operation, boolean input) {
+ assert wrapper != null;
+ List<ElementInfo> childElements = input? operation.getWrapper().getInputChildElements():
+ operation.getWrapper().getOutputChildElements();
+ 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;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(Operation, boolean)
+ */
+ public DataType getWrapperType(Operation operation, boolean input) {
+ WrapperInfo wrapper = operation.getWrapper();
+ ElementInfo element = input? wrapper.getInputWrapperElement(): wrapper.getOutputWrapperElement();
+ DataType<XMLType> wrapperType =
+ new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(element));
+ return wrapperType;
+ }
+
+ public boolean isInstance(Object wrapperObj,
+ Operation operation,
+ boolean input) {
+ WrapperInfo wrapperInfo = operation.getWrapper();
+ ElementInfo element = input ? wrapperInfo.getInputWrapperElement() : wrapperInfo.getOutputWrapperElement();
+ List<ElementInfo> childElements =
+ input ? wrapperInfo.getInputChildElements() : wrapperInfo.getOutputChildElements();
+ Node wrapper = (Node)wrapperObj;
+ if (wrapper.getNodeType() == Node.DOCUMENT_NODE) {
+ wrapper = ((Document)wrapper).getDocumentElement();
+ }
+ QName elementName = new QName(wrapper.getNamespaceURI(), wrapper.getLocalName());
+ if (!element.getQName().equals(elementName)) {
+ return false;
+ }
+ Set<QName> names = new HashSet<QName>();
+ for (ElementInfo e : childElements) {
+ names.add(e.getQName());
+ }
+ NodeList nodes = wrapper.getChildNodes();
+ for (int j = 0; j < nodes.getLength(); j++) {
+ Node node = nodes.item(j);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ elementName = new QName(wrapper.getNamespaceURI(), wrapper.getLocalName());
+ if (!names.contains(elementName)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java
new file mode 100644
index 0000000000..8c7a742cdd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.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.xml;
+
+import org.w3c.dom.Node;
+
+public class DOMXMLStreamReader extends XmlTreeStreamReaderImpl {
+
+ public DOMXMLStreamReader(Node node) {
+ super(new DOMXmlNodeImpl(node));
+ switch (node.getNodeType()) {
+ case Node.DOCUMENT_NODE:
+ break;
+ case Node.ELEMENT_NODE:
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal node type: " + node);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java
new file mode 100644
index 0000000000..507c141c33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.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.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DOMXmlNodeImpl implements XmlNode {
+ private Node node;
+ private Map<String, String> namespaces;
+ private Type type;
+
+ /**
+ * @param element
+ */
+ public DOMXmlNodeImpl(Node element) {
+ super();
+ if (element.getNodeType() == Node.DOCUMENT_NODE) {
+ this.node = ((Document)element).getDocumentElement();
+ } else {
+ this.node = element;
+ }
+ switch (node.getNodeType()) {
+ case Node.CDATA_SECTION_NODE:
+ this.type = Type.CHARACTERS;
+ break;
+ case Node.ELEMENT_NODE:
+ this.type = Type.ELEMENT;
+ break;
+ case Node.TEXT_NODE:
+ this.type = Type.CHARACTERS;
+ break;
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes()
+ */
+ public List<XmlNode> attributes() {
+ if (type != Type.ELEMENT) {
+ return null;
+ }
+ NamedNodeMap attrs = node.getAttributes();
+ List<XmlNode> xmlAttrs = new ArrayList<XmlNode>();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Attr attr = (Attr)attrs.item(i);
+ if (!attr.getName().equals("xmlns") && !attr.getName().startsWith("xmlns:")) {
+ xmlAttrs.add(new SimpleXmlNodeImpl(getQName(attr), attr.getValue(), XmlNode.Type.ATTRIBUTE));
+ }
+ }
+ return xmlAttrs;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children()
+ */
+ public Iterator<XmlNode> children() {
+ if (type != Type.ELEMENT) {
+ return null;
+ }
+ NodeList nodes = node.getChildNodes();
+ List<XmlNode> xmlNodes = new ArrayList<XmlNode>();
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node child = (Node)nodes.item(i);
+ int nodeType = child.getNodeType();
+ if (nodeType == Node.ELEMENT_NODE || nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) {
+ xmlNodes.add(new DOMXmlNodeImpl(child));
+ }
+ }
+ return xmlNodes.iterator();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName()
+ */
+ public QName getName() {
+ return getQName(node);
+ }
+
+ private static QName getQName(Node node) {
+ int type = node.getNodeType();
+ if (type == Node.ELEMENT_NODE || type == Node.ATTRIBUTE_NODE) {
+ String ns = node.getNamespaceURI();
+ String prefix = node.getPrefix();
+ String localName = node.getLocalName();
+ return new QName(ns == null ? "" : ns, localName, prefix == null ? "" : prefix);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue()
+ */
+ public String getValue() {
+ return node.getNodeValue();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces()
+ */
+ public Map<String, String> namespaces() {
+ if (type != Type.ELEMENT) {
+ return null;
+ }
+ if (namespaces == null) {
+ namespaces = new HashMap<String, String>();
+ NamedNodeMap attrs = node.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Attr attr = (Attr)attrs.item(i);
+ if ("xmlns".equals(attr.getPrefix())) {
+ namespaces.put(attr.getLocalName(), attr.getValue());
+ }
+ if ("xmlns".equals(attr.getName())) {
+ namespaces.put("", attr.getValue());
+ }
+ }
+ }
+ return namespaces;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java
new file mode 100644
index 0000000000..7f49a50e1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 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 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 = 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java
new file mode 100644
index 0000000000..5f583da283
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ public Class<InputSource> getSourceType() {
+ return InputSource.class;
+ }
+
+ @Override
+ public Class<Node> getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java
new file mode 100644
index 0000000000..39116ba4a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ public Class<InputSource> getSourceType() {
+ return InputSource.class;
+ }
+
+ @Override
+ public Class<ContentHandler> getTargetType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
new file mode 100644
index 0000000000..e40c3006fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ public Class<InputStream> getSourceType() {
+ return InputStream.class;
+ }
+
+ @Override
+ public Class<Node> getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java
new file mode 100644
index 0000000000..3b7bd3088a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.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 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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ public Class<InputStream> getSourceType() {
+ return InputStream.class;
+ }
+
+ @Override
+ public Class<ContentHandler> getTargetType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java
new file mode 100644
index 0000000000..5a31d9db91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java
new file mode 100644
index 0000000000..fdc3c4139b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 attributes 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java
new file mode 100644
index 0000000000..5500d0bcca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ protected Class<Node> getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class<OutputStream> getTargetType() {
+ return OutputStream.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java
new file mode 100644
index 0000000000..d5bf7e76b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.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.xml;
+
+import org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ * Transformer to convert data from a simple java Object to OMElement.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Node2SimpleJavaType extends SimpleType2JavaTransformer<Node> {
+
+ @Override
+ protected String getText(Node source) {
+ if (source instanceof Document) {
+ source = ((Document)source).getDocumentElement();
+ }
+ return source.getTextContent();
+
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java
new file mode 100644
index 0000000000..3c9022bc3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.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.xml;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+
+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 TrAX Node to Source
+ *
+ * @version $Rev$ $Date$
+ */
+public class Node2SourceTransformer extends BaseTransformer<Node, Source> implements
+ PullTransformer<Node, Source> {
+
+ public Source transform(Node source, TransformationContext context) {
+ try {
+ return new DOMSource(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ protected Class<Node> getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class<Source> getTargetType() {
+ return Source.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java
new file mode 100644
index 0000000000..1b54b1fd1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ public Class<Node> getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ public Class<String> getTargetType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java
new file mode 100644
index 0000000000..c9631595dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ protected Class<Node> getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class<Writer> getTargetType() {
+ return Writer.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
new file mode 100644
index 0000000000..1e8d14a151
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+public class Node2XMLStreamReader extends BaseTransformer<Node, XMLStreamReader> implements
+ PullTransformer<Node, XMLStreamReader> {
+
+ public XMLStreamReader transform(Node source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ DOMXMLStreamReader reader = new DOMXMLStreamReader(source);
+ return reader;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ protected Class<Node> getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java
new file mode 100644
index 0000000000..70387fa862
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ protected Class<Reader> getSourceType() {
+ return Reader.class;
+ }
+
+ @Override
+ protected Class<Node> getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java
new file mode 100644
index 0000000000..188ecaffa3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.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 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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ protected Class<Reader> getSourceType() {
+ return Reader.class;
+ }
+
+ @Override
+ protected Class<ContentHandler> getTargetType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java
new file mode 100644
index 0000000000..38c61d64c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java
@@ -0,0 +1,246 @@
+/*
+ * 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
+ *
+ * @version $Rev$ $Date$
+ */
+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 = 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 = 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 = namespaceDecls.get(i++);
+
+ if (prefix == null || prefix.equals(EMPTYSTRING)) {
+ tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX, namespaceDecls.get(i));
+ } else {
+ tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix, 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 = 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 = 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 = 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
new file mode 100644
index 0000000000..cb9d538389
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.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.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.DataPipeTransformer;
+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 DataPipeTransformer<ContentHandler, Node> {
+
+ /**
+ *
+ */
+ public SAX2DOMPipe() {
+ super();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.DataPipeTransformer#newInstance()
+ */
+ public DataPipe<ContentHandler, Node> newInstance() {
+ return new Pipe();
+ }
+
+ @Override
+ protected Class<Node> getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class<ContentHandler> getSourceType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+ private static class Pipe implements DataPipe<ContentHandler, Node> {
+ private SAX2DOM pipe;
+
+ public Pipe() {
+ super();
+ try {
+ this.pipe = new SAX2DOM();
+ } catch (ParserConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Node getResult() {
+ return pipe.getDOM();
+ }
+
+ public ContentHandler getSink() {
+ return pipe;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java
new file mode 100644
index 0000000000..d2625fba11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.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.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.databinding.impl.Java2SimpleTypeTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.Java2XMLMapperException;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ * Transformer to convert data from an simple OMElement to Java Object
+ *
+ * @version $Rev$ $Date$
+ */
+public class SimpleJavaType2Node extends Java2SimpleTypeTransformer<Node> {
+
+ private Document factory;
+
+ public SimpleJavaType2Node() {
+ super();
+ try {
+ factory = DOMHelper.newDocument();
+ } catch (ParserConfigurationException e) {
+ throw new Java2XMLMapperException(e);
+ }
+ }
+
+ @Override
+ protected Node createElement(QName element, String text, TransformationContext context) {
+ if (element == null) {
+ element = DOMDataBinding.ROOT_ELEMENT;
+ }
+ Node root = DOMHelper.createElement(factory, element);
+ if (text != null) {
+ root.appendChild(factory.createTextNode(text));
+ } else {
+ Attr nil = factory.createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:nil");
+ nil.setValue("true");
+ root.appendChild(nil);
+ }
+ return root;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java
new file mode 100644
index 0000000000..e041f85214
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.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.xml;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SimpleXmlNodeImpl implements XmlNode {
+ private static final String XSI_PREFIX = "xsi";
+ private static final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
+ private static final QName XSI_NIL = new QName(XSI_NS, "nil", XSI_PREFIX);
+ private static final Map<String, String> NS_MAP = new HashMap<String, String>();
+ static {
+ NS_MAP.put(XSI_PREFIX, XSI_NS);
+ }
+
+ protected Type type;
+ protected QName name;
+ protected Object value;
+
+ public SimpleXmlNodeImpl(QName name, Object value) {
+ this(name, value, name != null ? Type.ELEMENT : Type.CHARACTERS);
+ }
+
+ public SimpleXmlNodeImpl(QName name, Object value, Type type) {
+ super();
+ this.type = type;
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes()
+ */
+ public List<XmlNode> attributes() {
+ if (type == Type.ELEMENT && value == null) {
+ // Nil element
+ XmlNode attr = new SimpleXmlNodeImpl(XSI_NIL, "true");
+ return Arrays.asList(attr);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children()
+ */
+ public Iterator<XmlNode> children() {
+ if (type == Type.ELEMENT && value != null) {
+ // Nil element
+ XmlNode node = new SimpleXmlNodeImpl(null, value);
+ return Arrays.asList(node).iterator();
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName()
+ */
+ public QName getName() {
+ return name;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue()
+ */
+ public String getValue() {
+ return value == null ? null : String.valueOf(value);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces()
+ */
+ public Map<String, String> namespaces() {
+ if (type == Type.ELEMENT && value == null) {
+ return NS_MAP;
+ }
+ return null;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java
new file mode 100644
index 0000000000..ee9aa1bb76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.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.xml;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+
+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;
+
+/**
+ * Transform TrAX Source to Node
+ *
+ * @version $Rev$ $Date$
+ */
+public class Source2NodeTransformer extends BaseTransformer<Source, Node> implements
+ PullTransformer<Source, Node> {
+ private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
+
+ public Node transform(Source source, TransformationContext context) {
+ try {
+ javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
+ DOMResult result = new DOMResult();
+ transformer.transform(source, result);
+ Document doc = (Document) result.getNode();
+ return DOMHelper.adjustElementName(context, doc.getDocumentElement());
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ protected Class<Source> getSourceType() {
+ return Source.class;
+ }
+
+ @Override
+ protected Class<Node> getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java
new file mode 100644
index 0000000000..8a2b6b39aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.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 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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ protected Class<Source> getSourceType() {
+ return Source.class;
+ }
+
+ @Override
+ protected Class<Result> getTargetType() {
+ return Result.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java
new file mode 100644
index 0000000000..2ed548ad76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.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.databinding.xml;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+
+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;
+
+/**
+ * Transform TrAX Source to String
+ *
+ * @version $Rev$ $Date$
+ */
+public class Source2StringTransformer extends BaseTransformer<Source, String> implements
+ PullTransformer<Source, String> {
+ private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
+
+ public String transform(Source source, TransformationContext context) {
+ try {
+ javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
+ StringWriter sw = new StringWriter();
+ StreamResult result = new StreamResult(sw);
+ transformer.transform(source, result);
+ return sw.toString();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ protected Class<Source> getSourceType() {
+ return Source.class;
+ }
+
+ @Override
+ protected Class<String> getTargetType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java
new file mode 100644
index 0000000000..52a1d02631
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.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 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.Operation;
+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);
+ }
+
+ @Override
+ public boolean introspect(DataType type, Operation operation) {
+ if (super.introspect(type, operation)) {
+ type.setLogical(XMLType.UNKNOWN);
+ type.setDataBinding(NAME);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java
new file mode 100644
index 0000000000..103ecbd7d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java
new file mode 100644
index 0000000000..f8967e35b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.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.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.DataPipeTransformer;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class StreamDataPipe extends BaseTransformer<OutputStream, InputStream> implements
+ DataPipeTransformer<OutputStream, InputStream> {
+
+ public DataPipe<OutputStream, InputStream> newInstance() {
+ return new Pipe();
+ }
+
+ @Override
+ protected Class<InputStream> getTargetType() {
+ return InputStream.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+ @Override
+ protected Class<OutputStream> getSourceType() {
+ return OutputStream.class;
+ }
+
+ public static class Pipe implements DataPipe<OutputStream, InputStream> {
+ private ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ public InputStream getResult() {
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+
+ public OutputStream getSink() {
+ return outputStream;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java
new file mode 100644
index 0000000000..062e10cc45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.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 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);
+ }
+ }
+
+ @Override
+ protected Class<String> getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ protected Class<Node> getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java
new file mode 100644
index 0000000000..c56dba1843
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+ }
+
+ @Override
+ protected Class<String> getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ protected Class<ContentHandler> getTargetType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java
new file mode 100644
index 0000000000..c2de202a9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.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.StringReader;
+
+import javax.xml.transform.Source;
+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;
+
+/**
+ * Transform XML String to Source
+ *
+ * @version $Rev$ $Date$
+ */
+public class String2SourceTransformer extends BaseTransformer<String, Source> implements
+ PullTransformer<String, Source> {
+
+ public Source transform(String source, TransformationContext context) {
+ try {
+ return new StreamSource(new StringReader(source));
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ protected Class<String> getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ protected Class<Source> getTargetType() {
+ return Source.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
new file mode 100644
index 0000000000..a7364006d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.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 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);
+ }
+ }
+
+ @Override
+ protected Class<String> getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java
new file mode 100644
index 0000000000..d73e495798
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.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.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.StreamReaderDelegate;
+
+public class WrappingXMLStreamReader extends StreamReaderDelegate implements XMLFragmentStreamReader {
+
+ private boolean done;
+ private int level;
+
+ public WrappingXMLStreamReader(XMLStreamReader realReader) throws XMLStreamException {
+ super(realReader);
+ if (realReader == null) {
+ throw new UnsupportedOperationException("Reader cannot be null");
+ }
+
+ if (realReader instanceof XMLFragmentStreamReader) {
+ ((XMLFragmentStreamReader)realReader).init();
+ }
+
+ if (realReader.getEventType() == START_DOCUMENT) {
+ // Position to the 1st element
+ realReader.nextTag();
+ }
+ if (realReader.getEventType() != START_ELEMENT) {
+ throw new IllegalStateException("The reader is not positioned at START_DOCUMENT or START_ELEMENT");
+ }
+ this.done = false;
+ this.level = 1;
+ }
+
+ @Override
+ public boolean hasNext() throws XMLStreamException {
+ return !done && super.hasNext();
+ }
+
+ @Override
+ public int next() throws XMLStreamException {
+ if (!hasNext()) {
+ throw new IllegalStateException("No more events");
+ }
+ int event = super.next();
+ if (!super.hasNext()) {
+ done = true;
+ }
+ if (event == START_ELEMENT) {
+ level++;
+ } else if (event == END_ELEMENT) {
+ level--;
+ if (level == 0) {
+ done = true;
+ }
+ }
+ return event;
+ }
+
+ @Override
+ public int nextTag() throws XMLStreamException {
+ int event = 0;
+ while (true) {
+ event = next();
+ if (event == START_ELEMENT || event == END_ELEMENT) {
+ return event;
+ }
+ }
+ }
+
+ public void setParentNamespaceContext(NamespaceContext nsContext) {
+ // nothing to do here
+ }
+
+ public void init() {
+ // Nothing to do here
+ }
+
+ public boolean isDone() {
+ return done;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java
new file mode 100644
index 0000000000..5ab7272d58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.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.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.DataPipeTransformer;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class Writer2ReaderDataPipe extends BaseTransformer<Writer, Reader> implements DataPipeTransformer<Writer, Reader> {
+
+ public DataPipe<Writer, Reader> newInstance() {
+ return new Pipe();
+ }
+
+ @Override
+ protected Class<Reader> getTargetType() {
+ return Reader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+ @Override
+ protected Class<Writer> getSourceType() {
+ return Writer.class;
+ }
+
+ private static class Pipe implements DataPipe<Writer, Reader> {
+ private StringWriter writer = new StringWriter();
+
+ public Reader getResult() {
+ return new StringReader(writer.toString());
+ }
+
+ public Writer getSink() {
+ return writer;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java
new file mode 100644
index 0000000000..cd33e64176
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java
@@ -0,0 +1,482 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.
+ *
+ * @version $Rev$ $Date$
+ */
+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 boolean fragment;
+ private int level = 0;
+
+ 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) {
+ fragment = false;
+ 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;
+ }
+ if (fragment && returnEvent == END_ELEMENT) {
+ level--;
+ if (level == 0) {
+ // We are now at the end of the top-level element in the fragment
+ state = STATE_COMPLETE_AT_NEXT;
+ }
+ }
+ if (fragment && returnEvent == START_ELEMENT) {
+ level++;
+ }
+ break;
+ case STATE_INIT:
+ state = STATE_SWITCHED;
+ returnEvent = realReader.getEventType();
+ if (returnEvent == START_ELEMENT) {
+ // The real reader is positioned at the top-level element in the fragment
+ level = 0;
+ fragment = true;
+ }
+ 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()) {
+ int returnEvent = realReader.nextTag();
+ if (fragment && returnEvent == END_ELEMENT) {
+ level--;
+ if (level == 0) {
+ // We are now at the end of the top-level element in the fragment
+ state = STATE_COMPLETE_AT_NEXT;
+ }
+ }
+ if (fragment && returnEvent == START_ELEMENT) {
+ level++;
+ }
+ return returnEvent;
+ } 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java
new file mode 100644
index 0000000000..f1084cf2a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 hands 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 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 separately
+ * 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 HashTable and take that into an array
+ */
+ private String[] makePrefixArray() {
+ String[] prefixes = 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
+ // straight away
+ 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 possibilities has been tried! Let's treat
+ // the thing as a bean and try generating events from it
+ childReader = new WrappingXMLStreamReader(new BeanXMLStreamReaderImpl(propertyQName, propertyValue));
+ // 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java
new file mode 100644
index 0000000000..f7c895db1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.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.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.databinding.impl.GroupDataBinding;
+import org.apache.tuscany.sca.interfacedef.Operation;
+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, Operation operation) {
+ return XMLType.UNKNOWN;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
new file mode 100644
index 0000000000..e2d0416aec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.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.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+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;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Transform DOM Node to XML XMLStreamReader
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLStreamReader2Node extends BaseTransformer<XMLStreamReader, Node> implements
+ PullTransformer<XMLStreamReader, Node> {
+
+ private XMLStreamReader2SAX stax2sax = new XMLStreamReader2SAX();
+
+ public Node transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ DataPipe<ContentHandler, Node> pipe = new SAX2DOMPipe().newInstance();
+ stax2sax.transform(source, pipe.getSink(), context);
+ Node node = pipe.getResult();
+ source.close();
+ if (node instanceof Document) {
+ Document doc = (Document)node;
+ return DOMHelper.adjustElementName(context, doc.getDocumentElement());
+ } else {
+ return node;
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ protected Class<Node> getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
new file mode 100644
index 0000000000..9b39f039b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLStreamReader2SAX extends BaseTransformer<XMLStreamReader, ContentHandler> implements
+ PushTransformer<XMLStreamReader, ContentHandler> {
+
+ @Override
+ protected Class<ContentHandler> getTargetType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#getWeight()
+ */
+ @Override
+ 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);
+ source.close();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
new file mode 100644
index 0000000000..6db731bc9f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.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 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 {
+ String str = StAXHelper.save(source);
+ source.close();
+ return str;
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ protected Class<String> getTargetType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java
new file mode 100644
index 0000000000..920ebb511c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java
@@ -0,0 +1,287 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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
+ *
+ * @version $Rev$ $Date$
+ */
+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 Serializer 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.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 declaring 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java
new file mode 100644
index 0000000000..36cf5e9c9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+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, Operation operation) {
+ if (type.getPhysical() == String.class && NAME.equals(type.getDataBinding()) || ALIASES[0].equals(type.getDataBinding())) {
+ type.setDataBinding(NAME);
+ type.setLogical(XMLType.UNKNOWN);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java
new file mode 100644
index 0000000000..86ebd627f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.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.xml;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface XmlNode {
+ enum Type {ELEMENT, ATTRIBUTE, CHARACTERS, READER};
+ /**
+ * Returns the children of the receiver as an <code>Iterator</code>.
+ */
+ Iterator<XmlNode> children();
+
+ /**
+ * Returns the attributes of the element as an <code>List</code>. Namespace declarations
+ * should be excluded.
+ *
+ * @return
+ */
+ List<XmlNode> attributes();
+
+ /**
+ * Returns a map of prefix to namespace URI
+ * @return
+ */
+ Map<String, String> namespaces();
+
+ /**
+ * Return the QName of the element. If it's for a text node, the name is null.
+ * @return
+ */
+ QName getName();
+
+ /**
+ * Return the text value of the leaf element
+ * @return
+ */
+ <T> T getValue();
+
+ /**
+ * Return the type of the XML node
+ * @return
+ */
+ Type getType();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java
new file mode 100644
index 0000000000..3dd125463e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XmlNodeIterator implements Iterator<XmlNode> {
+ public static final int START = 0;
+ public static final int END = 1;
+
+ protected FastStack<ElementHolder> stack;
+ protected int state;
+ protected NamespaceContextImpl nsContext;
+
+ public XmlNodeIterator(XmlNode rootNode) {
+ super();
+ List<XmlNode> v = new ArrayList<XmlNode>(1);
+ v.add(rootNode);
+ stack = new FastStack<ElementHolder>();
+ Iterator<XmlNode> i = v.iterator();
+ stack.push(new ElementHolder(null, i));
+ this.state = START;
+ this.nsContext = new NamespaceContextImpl(null);
+ }
+
+ public boolean hasNext() {
+ return !(stack.empty() || (state == END && stack.peek().parent == null));
+ }
+
+ public XmlNode next() {
+ this.state = START;
+ ElementHolder element = stack.peek();
+ Iterator<XmlNode> it = element.children;
+ if (it == null || (!it.hasNext())) {
+ // End of the children, return END event of parent
+ stack.pop();
+ this.state = END;
+ this.nsContext = (NamespaceContextImpl)nsContext.getParent();
+ return element.parent;
+ }
+ XmlNode node = it.next();
+ stack.push(new ElementHolder(node, node.children()));
+ this.nsContext = new NamespaceContextImpl(this.nsContext);
+ populateNamespaces(node);
+ return node;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return nsContext;
+ }
+
+ private void populateNamespaces(XmlNode element) {
+ if (element.getName() != null) {
+ if (element.namespaces() != null) {
+ for (Map.Entry<String, String> e : element.namespaces().entrySet()) {
+ nsContext.register(e.getKey(), e.getValue());
+ }
+ }
+ }
+ }
+
+ private static class ElementHolder {
+ private XmlNode parent;
+ private Iterator<XmlNode> children;
+
+ public ElementHolder(XmlNode parent, Iterator<XmlNode> children) {
+ this.parent = parent;
+ this.children = children;
+ }
+ }
+
+ private static class NamespaceContextImpl implements NamespaceContext {
+ private NamespaceContext parent;
+ private Map<String, String> map = new HashMap<String, String>();
+
+ /**
+ * @param parent
+ */
+ public NamespaceContextImpl(NamespaceContext parent) {
+ super();
+ this.parent = parent;
+ if (parent == null) {
+ map.put("xml", "http://www.w3.org/XML/1998/namespace");
+ map.put("xmlns", "http://www.w3.org/2000/xmlns/");
+ }
+ }
+
+ public String getNamespaceURI(String prefix) {
+ if (prefix == null) {
+ throw new IllegalArgumentException("Prefix is null");
+ }
+
+ String ns = (String)map.get(prefix);
+ if (ns != null) {
+ return ns;
+ }
+ if (parent != null) {
+ return parent.getNamespaceURI(prefix);
+ }
+ return null;
+ }
+
+ public String getPrefix(String nsURI) {
+ if (nsURI == null)
+ throw new IllegalArgumentException("Namespace is null");
+ for (Iterator<Map.Entry<String, String>> i = map.entrySet().iterator(); i.hasNext();) {
+ Map.Entry<String, String> entry = i.next();
+ if (entry.getValue().equals(nsURI)) {
+ return entry.getKey();
+ }
+ }
+ if (parent != null) {
+ return parent.getPrefix(nsURI);
+ }
+ return null;
+ }
+
+ public Iterator getPrefixes(String nsURI) {
+ List<String> prefixList = new ArrayList<String>();
+ for (Iterator<Map.Entry<String, String>> i = map.entrySet().iterator(); i.hasNext();) {
+ Map.Entry<String, String> entry = i.next();
+ if (entry.getValue().equals(nsURI)) {
+ prefixList.add(entry.getKey());
+ }
+ }
+ final Iterator currentIterator = prefixList.iterator();
+ final Iterator parentIterator = parent != null ? null : parent.getPrefixes(nsURI);
+ return new Iterator() {
+
+ public boolean hasNext() {
+ return currentIterator.hasNext() || (parentIterator != null && parentIterator.hasNext());
+ }
+
+ public Object next() {
+ if (!hasNext()) {
+ throw new IllegalStateException("End of iterator has reached");
+ }
+ return currentIterator.hasNext() ? currentIterator.next() : parentIterator.next();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+
+ }
+
+ public void register(String prefix, String ns) {
+ map.put(prefix, ns);
+ }
+
+ public NamespaceContext getParent() {
+ return parent;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer(map.toString());
+ if (parent != null) {
+ sb.append("\nParent: ");
+ sb.append(parent);
+ }
+ return sb.toString();
+ }
+ }
+
+ /**
+ * 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-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java
new file mode 100644
index 0000000000..f4bc357c7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java
@@ -0,0 +1,531 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.Collections;
+import java.util.List;
+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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class XmlTreeStreamReaderImpl implements XMLStreamReader {
+
+ protected int state;
+ protected XmlNodeIterator iterator;
+ protected XmlNode current;
+
+ protected XMLStreamReader reader;
+
+ /*
+ * 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 XmlTreeStreamReaderImpl(XmlNode root) {
+ this.iterator = new XmlNodeIterator(root);
+ this.current = null;
+ this.state = START_DOCUMENT;
+ this.reader = null;
+ }
+
+ public void close() throws XMLStreamException {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+
+ private void checkElementState() {
+ if (getEventType() != START_ELEMENT && getEventType() != END_ELEMENT) {
+ throw new IllegalStateException();
+ }
+ }
+
+ private List<XmlNode> getAttributes() {
+ if (current != null && current.attributes() != null) {
+ return current.attributes();
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ public int getAttributeCount() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeCount();
+ }
+ return getAttributes().size();
+ }
+
+ public String getAttributeLocalName(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeLocalName(i);
+ }
+ return getAttributes().get(i).getName().getLocalPart();
+ }
+
+ /**
+ * @param i
+ */
+ public QName getAttributeName(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeName(i);
+ }
+ return getAttributes().get(i).getName();
+ }
+
+ public String getAttributeNamespace(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeNamespace(i);
+ }
+ return getAttributes().get(i).getName().getNamespaceURI();
+ }
+
+ public String getAttributePrefix(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributePrefix(i);
+ }
+ return getAttributes().get(i).getName().getPrefix();
+ }
+
+ public String getAttributeType(int i) {
+ if (reader != null) {
+ return reader.getAttributeType(i);
+ }
+ return null; // not supported
+ }
+
+ public String getAttributeValue(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeValue(i);
+ }
+ return getAttributes().get(i).getValue();
+ }
+
+ public String getAttributeValue(String nsUri, String localName) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeValue(nsUri, localName);
+ }
+ int count = getAttributeCount();
+ String value = null;
+ QName attrQName;
+ for (int i = 0; i < count; i++) {
+ attrQName = getAttributeName(i);
+ if (nsUri == null) {
+ if (localName.equals(attrQName.getLocalPart())) {
+ value = getAttributeValue(i);
+ break;
+ }
+ } else {
+ if (localName.equals(attrQName.getLocalPart()) && nsUri.equals(attrQName.getNamespaceURI())) {
+ value = getAttributeValue(i);
+ break;
+ }
+ }
+
+ }
+
+ return value;
+ }
+
+ public String getCharacterEncodingScheme() {
+ if (reader != null) {
+ return reader.getCharacterEncodingScheme();
+ }
+ return "UTF-8";
+ }
+
+ public String getElementText() throws XMLStreamException {
+ checkElementState();
+ if (reader != null) {
+ return reader.getElementText();
+ }
+ return current.getValue();
+ }
+
+ public String getEncoding() {
+ if (reader != null) {
+ return reader.getEncoding();
+ }
+ return "UTF-8";
+ }
+
+ public int getEventType() {
+ return state;
+ }
+
+ public String getLocalName() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getLocalName();
+ }
+ return current.getName().getLocalPart();
+ }
+
+ /**
+ */
+ public Location getLocation() {
+ if (reader != null) {
+ return reader.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() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getName();
+ }
+ return current.getName();
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ if (reader != null) {
+ return reader.getNamespaceContext();
+ }
+ return iterator.getNamespaceContext();
+ }
+
+ private Map<String, String> getNamespaces() {
+ if (current != null && current.namespaces() != null) {
+ return current.namespaces();
+ } else {
+ return Collections.emptyMap();
+ }
+ }
+
+ public int getNamespaceCount() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getNamespaceCount();
+ }
+ return getNamespaces().size();
+ }
+
+ /**
+ * @param i
+ */
+ public String getNamespacePrefix(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getNamespacePrefix(i);
+ }
+ return new ArrayList<Map.Entry<String, String>>(getNamespaces().entrySet()).get(i).getKey();
+ }
+
+ public String getNamespaceURI() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getNamespaceURI();
+ }
+ return current.getName().getNamespaceURI();
+ }
+
+ public String getNamespaceURI(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getNamespaceURI(i);
+ }
+ return new ArrayList<Map.Entry<String, String>>(getNamespaces().entrySet()).get(i).getValue();
+ }
+
+ public String getNamespaceURI(String prefix) {
+ if (reader != null) {
+ return reader.getNamespaceURI(prefix);
+ }
+ return getNamespaceContext().getNamespaceURI(prefix);
+ }
+
+ public String getPIData() {
+ if (reader != null) {
+ return reader.getPIData();
+ }
+ throw new UnsupportedOperationException("Yet to be implemented !!");
+ }
+
+ public String getPITarget() {
+ if (reader != null) {
+ return reader.getPITarget();
+ }
+ throw new UnsupportedOperationException("Yet to be implemented !!");
+ }
+
+ public String getPrefix() {
+ if (reader != null) {
+ return reader.getPrefix();
+ }
+ if (state == START_ELEMENT || state == END_ELEMENT) {
+ String prefix = current.getName().getPrefix();
+ return "".equals(prefix) ? null : prefix;
+ } else if (state == START_DOCUMENT) {
+ return null;
+ } else {
+ throw new IllegalStateException("State==" + state);
+ }
+ }
+
+ /**
+ * @param key
+ * @throws IllegalArgumentException
+ */
+ public Object getProperty(String key) throws IllegalArgumentException {
+ if (reader != null) {
+ return reader.getProperty(key);
+ }
+ return null;
+ }
+
+ public String getText() {
+ if (reader != null) {
+ return reader.getText();
+ }
+ return current.getValue();
+ }
+
+ public char[] getTextCharacters() {
+ if (reader != null) {
+ return reader.getTextCharacters();
+ }
+ String value = current.getValue();
+ return value == null ? new char[0] : value.toCharArray();
+ }
+
+ 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 (reader != null) {
+ return reader.getTextCharacters(i, chars, i1, i2);
+ }
+ return copy(i, chars, i1, i2);
+ }
+
+ public int getTextLength() {
+ if (reader != null) {
+ return reader.getTextLength();
+ }
+ return getTextCharacters().length;
+ }
+
+ public int getTextStart() {
+ if (reader != null) {
+ return reader.getTextStart();
+ }
+ return 0;
+ }
+
+ public String getVersion() {
+ return "1.0";
+ }
+
+ public boolean hasName() {
+ if (reader != null) {
+ return reader.hasName();
+ }
+ return current.getName() != null;
+ }
+
+ /**
+ * @throws XMLStreamException
+ */
+ public boolean hasNext() throws XMLStreamException {
+ return iterator.hasNext() || state != END_DOCUMENT || (reader != null && reader.hasNext());
+ }
+
+ public boolean hasText() {
+ if (reader != null) {
+ return reader.hasText();
+ }
+ return current.getType() == XmlNode.Type.CHARACTERS;
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ if (reader != null) {
+ return reader.isAttributeSpecified(i);
+ }
+ return false; // not supported
+ }
+
+ public boolean isCharacters() {
+ if (reader != null) {
+ return reader.isCharacters();
+ }
+ return current.getType() == XmlNode.Type.CHARACTERS;
+ }
+
+ public boolean isEndElement() {
+ if (reader != null) {
+ return reader.isEndElement();
+ }
+ return getEventType() == END_ELEMENT;
+ }
+
+ public boolean isStandalone() {
+ return true;
+ }
+
+ public boolean isStartElement() {
+ if (reader != null) {
+ return reader.isStartElement();
+ }
+ return getEventType() == START_ELEMENT;
+ }
+
+ public boolean isWhiteSpace() {
+ if (reader != null) {
+ return reader.isWhiteSpace();
+ }
+ return false;
+ }
+
+ /**
+ * 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 {
+ if (!hasNext()) {
+ throw new IllegalStateException("No more events");
+ }
+ if (reader != null) {
+ if (!reader.hasNext()) {
+ this.reader = null;
+ } else {
+ // Go to the delegation mode
+ state = reader.next();
+ return state;
+ }
+ }
+ if (!iterator.hasNext()) {
+ state = END_DOCUMENT;
+ current = null;
+ return state;
+ }
+ current = iterator.next();
+ XmlNode.Type type = current.getType();
+
+ int itState = iterator.getState();
+ if (itState == XmlNodeIterator.END) {
+ if (type == XmlNode.Type.ELEMENT) {
+ state = END_ELEMENT;
+ } else {
+ // Ignore the pop
+ state = next();
+ }
+ }
+ if (itState == XmlNodeIterator.START) {
+ if (type == XmlNode.Type.ELEMENT) {
+ state = START_ELEMENT;
+ } else if (type == XmlNode.Type.CHARACTERS) {
+ state = CHARACTERS;
+ } else if (type == XmlNode.Type.READER) {
+ XMLStreamReader value = current.getValue();
+ this.reader = new WrappingXMLStreamReader(value);
+ state = reader.getEventType();
+ return state;
+ }
+ }
+ return state;
+ }
+
+ /**
+ * TODO implement this
+ *
+ * @throws XMLStreamException
+ */
+ public int nextTag() throws XMLStreamException {
+ while (true) {
+ int event = next();
+ if (event == START_ELEMENT || event == END_ELEMENT) {
+ return event;
+ }
+ }
+ }
+
+ public void require(int i, String ns, String localPart) throws XMLStreamException {
+ if (reader != null) {
+ reader.require(i, ns, localPart);
+ return;
+ }
+ int event = getEventType();
+ if (event != i) {
+ throw new IllegalStateException("Event type is " + event + " (!=" + i + ")");
+ }
+ QName name = getName();
+ String ns1 = name.getNamespaceURI();
+ String localName1 = name.getLocalPart();
+
+ if (ns != null && !ns.equals(ns1)) {
+ throw new IllegalStateException("Namespace URI is " + ns1 + " (!=" + ns + ")");
+ }
+
+ if (localPart != null && !localPart.equals(localName1)) {
+ throw new IllegalStateException("Local name is " + localName1 + " (!=" + localPart + ")");
+ }
+
+ }
+
+ public boolean standaloneSet() {
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..10e6082b34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
@@ -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.
+
+# implementation classes for the databindings
+org.apache.tuscany.sca.databinding.xml.DOMDataBinding;type=org.w3c.dom.Node,name=dom
+org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;type=java.lang.String,name=xml.string
+org.apache.tuscany.sca.databinding.xml.XMLGroupDataBinding;type=databinding:group
+org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;type=java:complexType
+org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;type=java:simpleType
+org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;type=java:exception
+org.apache.tuscany.sca.databinding.externalizable.ExternalizableDataBinding;type=java.io.Externalizable,name=externalizable
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint
new file mode 100644
index 0000000000..568e04f9de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..96115be404
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.xml.InputSource2Node;source=org.xml.sax.InputSource,target=org.w3c.dom.Node,weight=80
+org.apache.tuscany.sca.databinding.xml.InputStream2Node;source=java.io.InputStream,target=org.w3c.dom.Node,weight=80
+# org.apache.tuscany.sca.databinding.javabeans.DOMNode2JavaBeanTransformer;source=org.w3c.dom.Node,target=java:complexType,weight=80000
+org.apache.tuscany.sca.databinding.xml.Node2String;source=org.w3c.dom.Node,target=java.lang.String,weight=80
+org.apache.tuscany.sca.databinding.xml.Node2XMLStreamReader;source=org.w3c.dom.Node,target=javax.xml.stream.XMLStreamReader,weight=80
+# org.apache.tuscany.sca.databinding.javabeans.JavaBean2DOMNodeTransformer;source=java:complexType,target=org.w3c.dom.Node,weight=80000
+# org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLStreamReaderTransformer;source=java:complexType,target=javax.xml.stream.XMLStreamReader,weight=79000
+org.apache.tuscany.sca.databinding.xml.Reader2Node;source=java.io.Reader,target=org.w3c.dom.Node,weight=80
+org.apache.tuscany.sca.databinding.xml.SAX2DOMPipe;source=org.xml.sax.ContentHandler,target=org.w3c.dom.Node,weight=70
+org.apache.tuscany.sca.databinding.xml.StreamDataPipe;source=java.io.OutputStream,target=java.io.InputStream,weight=90
+org.apache.tuscany.sca.databinding.xml.String2Node;source=java.lang.String,target=org.w3c.dom.Node,weight=90
+org.apache.tuscany.sca.databinding.xml.String2XMLStreamReader;source=java.lang.String,target=javax.xml.stream.XMLStreamReader,weight=90
+org.apache.tuscany.sca.databinding.xml.Writer2ReaderDataPipe;source=java.io.Writer,target=java.io.Reader,weight=90
+org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node;source=javax.xml.stream.XMLStreamReader,target=org.w3c.dom.Node,weight=80
+org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;source=javax.xml.stream.XMLStreamReader,target=java.lang.String,weight=80
+# org.apache.tuscany.sca.databinding.xml.Node2SimpleJavaType;source=org.w3c.dom.Node,target=java:simpleType,weight=80000
+# org.apache.tuscany.sca.databinding.xml.SimpleJavaType2Node;source=java:simpleType,target=org.w3c.dom.Node,weight=80000
+org.apache.tuscany.sca.databinding.xml.Source2NodeTransformer;source=javax.xml.transform.Source,target=org.w3c.dom.Node,weight=80
+org.apache.tuscany.sca.databinding.xml.Source2StringTransformer;source=javax.xml.transform.Source,target=java.lang.String,weight=80
+
+org.apache.tuscany.sca.databinding.xml.Node2SourceTransformer;source=org.w3c.dom.Node,target=javax.xml.transform.Source,weight=80
+org.apache.tuscany.sca.databinding.xml.String2SourceTransformer;source=java.lang.String,target=javax.xml.transform.Source,weight=80
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
new file mode 100644
index 0000000000..e02cd5c934
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.xml.InputSource2SAX;source=org.xml.sax.InputSource,target=org.xml.sax.ContentHandler,weight=80
+org.apache.tuscany.sca.databinding.xml.InputStream2SAX;source=java.io.InputStream,target=org.xml.sax.ContentHandler,weight=80
+org.apache.tuscany.sca.databinding.xml.Node2OutputStream;source=org.w3c.dom.Node,target=java.io.OutputStream,weight=80
+org.apache.tuscany.sca.databinding.xml.Node2Writer;source=org.w3c.dom.Node,target=java.io.Writer,weight=80
+org.apache.tuscany.sca.databinding.xml.Reader2SAX;source=java.io.Reader,target=org.xml.sax.ContentHandler,weight=80
+org.apache.tuscany.sca.databinding.xml.Source2ResultTransformer;source=javax.xml.transform.Source,target=javax.xml.transform.Result,weight=80
+org.apache.tuscany.sca.databinding.xml.String2SAX;source=java.lang.String,target=org.xml.sax.ContentHandler,weight=80
+org.apache.tuscany.sca.databinding.xml.XMLStreamReader2SAX;source=javax.xml.stream.XMLStreamReader,target=org.xml.sax.ContentHandler,weight=70
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint
new file mode 100644
index 0000000000..7d8642fb1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java
new file mode 100644
index 0000000000..8c710062ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.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.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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class DOMHelperTestCase extends TestCase {
+ private static final QName FOO_NAME = new QName("http://foo", "foo");
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ 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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java
new file mode 100644
index 0000000000..f9e331fbf3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataBindingExtensionTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ 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);
+
+ 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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java
new file mode 100644
index 0000000000..562c22354c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.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.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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+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");
+ if (System.getProperty("java.vendor").toUpperCase().contains("SUN") && System.getProperty("java.version").contains("1.5.0")
+ ||
+ System.getProperty("java.vendor").toUpperCase().contains("APPLE INC.") && System.getProperty("java.version").contains("1.5.0")) {
+
+ // Work around a bug in SUN JDK (including Mac OS JDK)
+ SAMPLE_VALUES.put("gMonth", "--02--");
+ } else {
+ 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()
+ */
+ @Override
+ 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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java
new file mode 100644
index 0000000000..243ac71201
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+public class TransformerExtensionTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ 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.eq(true));
+ EasyMock
+ .expect(registry.getTransformer(transformer.getSourceDataBinding(), transformer.getTargetDataBinding()))
+ .andReturn(transformer);
+ EasyMock.replay(registry);
+ registry.addTransformer(transformer, true);
+ assertSame(transformer, registry.getTransformer(transformer.getSourceDataBinding(), transformer
+ .getTargetDataBinding()));
+ }
+
+ private static class MyTransformer extends BaseTransformer<Node, XMLStreamReader> {
+
+ @Override
+ protected Class<Node> getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java
new file mode 100644
index 0000000000..07ee0b0ca4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.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.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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class XSDDataTypeConverterTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ 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 = c.parseDate(s);
+ assertEquals(s, c.printDate(calendar));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java
new file mode 100644
index 0000000000..db210683dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.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.impl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+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.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.easymock.EasyMock;
+import org.xml.sax.ContentHandler;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataBindingRegistryImplTestCase extends TestCase {
+ private DataBindingExtensionPoint registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ 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)), (Operation) 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)), (Operation) 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);
+ //FIXME does not match with dynamically loaded databindings
+ //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);
+ //FIXME does not match with dynamically loaded databindings
+ //assertEquals("java.lang.Object", dt.getDataBinding());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java
new file mode 100644
index 0000000000..7c882c0285
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.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.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java
new file mode 100644
index 0000000000..053e4f2a59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.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.databinding.impl;
+
+import java.util.Arrays;
+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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class DirectedGraphTestCase extends TestCase {
+ private DirectedGraph<String, Object> graph;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ graph = new DirectedGraph<String, Object>();
+ }
+
+ public void testGraph() {
+ graph.addEdge("a", "b", null, 3, true);
+ graph.addEdge("b", "c", null, 1, true);
+ // graph.addEdge("a", "c", null, 8, true);
+ graph.addEdge("a", "d", null, 3, true);
+ graph.addEdge("b", "d", null, 2, true);
+ graph.addEdge("d", "c", null, 3, true);
+ graph.addEdge("c", "b", null, 1, true);
+ graph.addEdge("c", "d", null, 2, true);
+ graph.addEdge("d", "b", null, 1, true);
+ graph.addEdge("a", "e", null, 8, true);
+ graph.addEdge("c", "c", null, 2, true);
+ graph.addEdge("f", "g", null, 2, false);
+ graph.addEdge("f", "h", null, 8, true);
+ graph.addEdge("g", "j", null, 2, false);
+ graph.addEdge("j", "i", null, 2, true);
+ graph.addEdge("h", "i", null, 8, true);
+
+ 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);
+
+ DirectedGraph<String, Object>.Path path5 = graph.getShortestPath("f", "i");
+ Assert.assertTrue(path5.getWeight() == 16 && path5.getEdges().size() == 2);
+
+ }
+
+ public void testSort() {
+ graph.addEdge("a", "b");
+ graph.addEdge("a", "c");
+ graph.addEdge("c", "d");
+ graph.addEdge("b", "c");
+ List<String> order = graph.topologicalSort(true);
+ assertEquals(Arrays.asList("a", "b", "c", "d"), order);
+ assertTrue(!graph.getVertices().isEmpty());
+
+ graph.addEdge("d", "a");
+ try {
+ order = graph.topologicalSort(true);
+ assertTrue("Should have failed", false);
+ } catch (IllegalArgumentException e) {
+ assertTrue(true);
+ }
+
+ graph.removeEdge("d", "a");
+ order = graph.topologicalSort(false);
+ assertEquals(Arrays.asList("a", "b", "c", "d"), order);
+ assertTrue(graph.getVertices().isEmpty());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
new file mode 100644
index 0000000000..6cc8868397
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.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.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
+ *
+ * @version $Rev$ $Date$
+ */
+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;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ DataBindingExtensionPoint dataBindingRegistry = new DefaultDataBindingExtensionPoint();
+ TransformerExtensionPoint registry = new DefaultTransformerExtensionPoint();
+
+ registry.addTransformer(new String2SAX(), true);
+ registry.addTransformer(new SAX2DOMPipe(), true);
+ registry.addTransformer(new Node2String(), true);
+ registry.addTransformer(new Node2Writer(), true);
+
+ 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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java
new file mode 100644
index 0000000000..31c3fd4f00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.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.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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class TransformerRegistryImplTestCase extends TestCase {
+ private TransformerExtensionPoint registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new DefaultTransformerExtensionPoint();
+ }
+
+ public void testRegisterTransformer1() {
+ Transformer transformer = createMock(Transformer.class);
+ registry.addTransformer("a", "b", 10, transformer, true);
+ 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, true);
+ Transformer t = registry.getTransformer("a", "b");
+ Assert.assertSame(t, transformer);
+ }
+
+ public void testUnregisterTransformer() {
+ Transformer transformer = createMock(Transformer.class);
+ registry.addTransformer("a", "b", 10, transformer, true);
+ 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, true);
+ registry.addTransformer(t2, true);
+ registry.addTransformer(t3, true);
+
+ 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() == 1 && l2.get(0) == t3);
+ List<Transformer> l3 = registry.getTransformerChain("a", "d");
+ Assert.assertNull(l3);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java
new file mode 100644
index 0000000000..dd3d000798
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.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.impl;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.databinding.xml.XMLDocumentStreamReader;
+import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XMLDocumentStreamReaderTestCase {
+ private static final String xml = "<e1><e2 a2=\"a2\"><e4>E4</e4></e2><e3 a3=\"a3\"/></e1>";
+
+ @org.junit.Test
+ public void testReader() throws Exception {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ XMLStreamReader r1 = factory.createXMLStreamReader(new StringReader(xml));
+ XMLDocumentStreamReader r2 = new XMLDocumentStreamReader(r1);
+ XMLStreamReader2String t1 = new XMLStreamReader2String();
+ String result = t1.transform(r2, null);
+ System.out.println(result);
+ XMLStreamReader r3 = factory.createXMLStreamReader(new StringReader(xml));
+ r3.nextTag();
+ r3.nextTag();
+ Assert.assertEquals(XMLStreamConstants.START_ELEMENT, r3.getEventType());
+ Assert.assertEquals(new QName(null, "e2"), r3.getName());
+ XMLDocumentStreamReader r4 = new XMLDocumentStreamReader(r3);
+ result = t1.transform(r4, null);
+ System.out.println(result);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..bdc9690285
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.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.xml;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.custommonkey.xmlunit.Diff;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanXMLStreamReaderTestCase extends TestCase {
+ private static final String XML_RESULT =
+ "<?xml version='1.0' encoding='UTF-8'?>" + "<MyBean xmlns=\"http://xml.databinding.sca.tuscany.apache.org/\">"
+ + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean><i>1</i>"
+ + "<list>Item1</list><list>Item2</list>"
+ + "<map><entry><key>key1</key><value>value1</value></entry>"
+ + "<entry><key>key2</key><value>value2</value></entry></map>"
+ + "<nil xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\" />"
+ + "<str>ABC</str></MyBean>";
+
+ // The map entries can come in a different order
+ private static final String XML_RESULT1 =
+ "<?xml version='1.0' encoding='UTF-8'?>" + "<MyBean xmlns=\"http://xml.databinding.sca.tuscany.apache.org/\">"
+ + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean><i>1</i>"
+ + "<list>Item1</list><list>Item2</list>"
+ + "<map><entry><key>key2</key><value>value2</value></entry>"
+ + "<entry><key>key1</key><value>value1</value></entry></map>"
+ + "<nil xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\" />"
+ + "<str>ABC</str></MyBean>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() throws Exception {
+ 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");
+ bean.list.add("Item1");
+ bean.list.add("Item2");
+ bean.map.put("key1", "value1");
+ bean.map.put("key2", "value2");
+ XMLStreamReader reader = new BeanXMLStreamReaderImpl(null, bean);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ Diff diff = new Diff(XML_RESULT, xml);
+ Diff diff1 = new Diff(XML_RESULT1, xml);
+ assertTrue(diff.similar() || diff1.similar());
+ }
+
+ private static class MyBean {
+ private long arr[];
+ private String str;
+ private int i;
+ private String nil;
+ private List<String> list = new ArrayList();
+ private AnotherBean bean;
+ private Map<String, String> map = new HashMap<String, String>();
+
+ /**
+ * @return the i
+ */
+ public int getI() {
+ return i;
+ }
+
+ /**
+ * @param i the i to set
+ */
+ public void setI(int i) {
+ this.i = i;
+ }
+
+ /**
+ * @return the arr
+ */
+ public long[] getArr() {
+ return arr;
+ }
+
+ /**
+ * @param arr the arr to set
+ */
+ public void setArr(long[] arr) {
+ this.arr = arr;
+ }
+
+ /**
+ * @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;
+ }
+
+ public List<String> getList() {
+ return list;
+ }
+
+ public void setList(List<String> list) {
+ this.list = list;
+ }
+
+ public String getNil() {
+ return nil;
+ }
+
+ public void setNil(String nil) {
+ this.nil = nil;
+ }
+
+ public Map<String, String> getMap() {
+ return map;
+ }
+
+ public void setMap(Map<String, String> map) {
+ this.map = map;
+ }
+
+ }
+
+ 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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java
new file mode 100644
index 0000000000..9e9dabcea7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.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.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.custommonkey.xmlunit.XMLAssert;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+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()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() throws Exception {
+ 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);
+ XMLAssert.assertXMLEqual(IPO_XML, xml);
+ // assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+ public void testTransformation2() throws Exception {
+ 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);
+ XMLAssert.assertXMLEqual(CRAZY_XML, xml);
+ assertTrue(xml.contains("<p:e2 xmlns:p=\"http://p2\""));
+ }
+
+ public void testTransformation3() throws Exception {
+ String2Node t1 = new String2Node();
+ Node node = t1.transform(IPO_XML, null);
+ DOMXmlNodeImpl element = new DOMXmlNodeImpl(node);
+ XmlTreeStreamReaderImpl reader = new XmlTreeStreamReaderImpl(element);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ XMLAssert.assertXMLEqual(IPO_XML, xml);
+ // assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java
new file mode 100644
index 0000000000..f3b37c86db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.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.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.DataPipe;
+import org.apache.tuscany.sca.databinding.DataPipeTransformer;
+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
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataPipeTestCase extends TestCase {
+
+ public final void testStreamPipe() throws IOException {
+ byte[] bytes = new byte[] {1, 2, 3};
+ DataPipeTransformer<OutputStream, InputStream> pipe = new StreamDataPipe();
+ DataPipe<OutputStream, InputStream> dataPipe = pipe.newInstance();
+ OutputStream os = dataPipe.getSink();
+ os.write(bytes);
+ byte[] newBytes = new byte[16];
+ int count = dataPipe.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());
+ DataPipe<Writer, Reader> dataPipe = pipe.newInstance();
+ dataPipe.getSink().write(str);
+ char[] buf = new char[16];
+ int count = dataPipe.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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..3a287a5bb7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLStreamReaderTransformer;
+import org.custommonkey.xmlunit.XMLAssert;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaBean2XMLStreamReaderTestCase extends TestCase {
+ private static final String XML_RESULT =
+ "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<MyBean xmlns=\"http://xml.databinding.sca.tuscany.apache.org/\">"
+ + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean><i>1</i><str>ABC</str>"
+ + "</MyBean>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() throws Exception {
+ JavaBean2XMLStreamReaderTransformer t2 = new JavaBean2XMLStreamReaderTransformer();
+ 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);
+ XMLAssert.assertXMLEqual(XML_RESULT, xml);
+
+ }
+
+ 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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java
new file mode 100644
index 0000000000..cc1f9375c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.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.databinding.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
new file mode 100644
index 0000000000..5ae0616577
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.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 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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+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()
+ */
+ @Override
+ 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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java
new file mode 100644
index 0000000000..9ca490f2d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.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 javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.custommonkey.xmlunit.XMLAssert;
+
+/**
+ * Test Case for StAXHelper
+ *
+ * @version $Rev$ $Date$
+ */
+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()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testHelper() throws Exception {
+ XMLStreamReader reader = StAXHelper.createXMLStreamReader(XML);
+ String xml = StAXHelper.save(reader);
+ XMLAssert.assertXMLEqual(XML, xml);
+ reader = StAXHelper.createXMLStreamReader(xml);
+ assertNotNull(reader);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java
new file mode 100644
index 0000000000..ff6f8c1406
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.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.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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class TraxTransformerTestCase extends TestCase {
+ private URL url;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ 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-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java
new file mode 100644
index 0000000000..0463e7d9f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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 java.util.ArrayList;
+import java.util.Arrays;
+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.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.custommonkey.xmlunit.XMLAssert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XmlTreeStreamReaderTestCase {
+ 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 XML_RESULT =
+ "<?xml version='1.0' encoding='UTF-8'?>" + "<p1:e1 xmlns:p1=\"http://ns\">"
+ + "<p2:e11 xmlns:p2=\"http://ns1\">MyText</p2:e11>"
+ + "<p1:e12><p1:e121 /></p1:e12>"
+ + "<ipo:purchaseOrder xmlns:ipo=\"http://www.example.com/IPO\" "
+ + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ + "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></p1:e1>";
+ private XmlNodeImpl root;
+
+ @Before
+ public void setUp() throws Exception {
+ root = new XmlNodeImpl();
+ root.name = new QName("http://ns", "e1", "p1");
+
+ XmlNodeImpl e11 = new XmlNodeImpl();
+ e11.name = new QName("http://ns1", "e11", "p2");
+
+ XmlNodeImpl e12 = new XmlNodeImpl();
+ e12.name = new QName("http://ns", "e12");
+
+ root.children.add(e11);
+ root.children.add(e12);
+
+ XmlNodeImpl e121 = new XmlNodeImpl();
+ e121.name = new QName("http://ns", "e121");
+ e12.children.add(e121);
+
+ XmlNodeImpl e111 = new XmlNodeImpl();
+ e111.value = "MyText";
+ e11.children.add(e111);
+
+ XmlNodeImpl e13 = new XmlNodeImpl();
+ e13.value = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ root.children.add(e13);
+
+ }
+
+ @Test
+ public void testIterator() {
+ List<QName> elements = new ArrayList<QName>();
+ XmlNodeIterator i = new XmlNodeIterator(root);
+ for (; i.hasNext();) {
+ XmlNode e = i.next();
+ elements.add(e.getName());
+ }
+ // System.out.println(elements);
+ QName[] names =
+ {new QName("http://ns", "e1"), new QName("http://ns1", "e11"), null, null, new QName("http://ns1", "e11"),
+ new QName("http://ns", "e12"), new QName("http://ns", "e121"), new QName("http://ns", "e121"),
+ new QName("http://ns", "e12"), null, null, new QName("http://ns", "e1")};
+ Assert.assertEquals(Arrays.asList(names), elements);
+ }
+
+ @Test
+ public void testReader() throws Exception {
+ XmlTreeStreamReaderImpl reader = new XmlTreeStreamReaderImpl(root);
+ XMLStreamReader2String t = new XMLStreamReader2String();
+ String xml = t.transform(reader, null);
+ XMLAssert.assertXMLEqual(XML_RESULT, xml);
+ }
+
+ private static class XmlNodeImpl implements XmlNode {
+ private List<XmlNode> children = new ArrayList<XmlNode>();
+ private List<XmlNode> attrs = new ArrayList<XmlNode>();
+ private Map<String, String> namespaces = new HashMap<String, String>();
+ private QName name;
+ private Object value = "123";
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes()
+ */
+ public List<XmlNode> attributes() {
+ return attrs;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children()
+ */
+ public Iterator<XmlNode> children() {
+ return children.iterator();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName()
+ */
+ public QName getName() {
+ return name;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue()
+ */
+ public <T> T getValue() {
+ return (T)value;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces()
+ */
+ public Map<String, String> namespaces() {
+ return namespaces;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(name);
+ }
+
+ public Type getType() {
+ if (value instanceof XMLStreamReader) {
+ return Type.READER;
+ }
+ return name == null ? Type.CHARACTERS : Type.ELEMENT;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/definitions-xml/LICENSE b/sca-java-1.x/branches/sca-android/modules/definitions-xml/LICENSE
new file mode 100644
index 0000000000..6e529a25c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-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-android/modules/definitions-xml/META-INF/README b/sca-java-1.x/branches/sca-android/modules/definitions-xml/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/NOTICE b/sca-java-1.x/branches/sca-android/modules/definitions-xml/NOTICE
new file mode 100644
index 0000000000..1325efd8bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/definitions-xml/pom.xml b/sca-java-1.x/branches/sca-android/modules/definitions-xml/pom.xml
new file mode 100644
index 0000000000..75db3b51b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <name>Apache Tuscany SCA Definitions XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.definitions.xml</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.definitions.xml*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java
new file mode 100644
index 0000000000..0b760ef712
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.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.definitions.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
+import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * A SCA Definitions Document processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADefinitionsDocumentProcessor implements URLArtifactProcessor<SCADefinitions> {
+ private StAXArtifactProcessor<Object> extensionProcessor;
+ private XMLInputFactory inputFactory;
+ private static final String TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+ private static final String DEFINITIONS = "definitions";
+ private static final QName DEFINITIONS_QNAME = new QName(TUSCANY_NS, DEFINITIONS);
+ private Monitor monitor;
+
+ /**
+ * Construct a new SCADefinitions processor
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ public SCADefinitionsDocumentProcessor(StAXArtifactProcessor<Object> staxProcessor,
+ XMLInputFactory inputFactory,
+ Monitor monitor) {
+ this.extensionProcessor = (StAXArtifactProcessor<Object>)staxProcessor;
+ this.inputFactory = inputFactory;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Constructs a new SCADefinitions processor.
+ *
+ * @param modelFactories
+ * @param staxProcessor
+ */
+ public SCADefinitionsDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor<Object> staxProcessor,
+ Monitor monitor) {
+ this.extensionProcessor = (StAXArtifactProcessor<Object>)staxProcessor;
+ this.inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "definitions-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "definitions-xml-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+
+ public SCADefinitions read(URL contributionURL, final URI uri, final URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+ // Allow privileged access to open URL stream. Add FilePermission to added to security
+ // policy file.
+ try {
+ urlStream = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
+ public InputStream run() throws IOException {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ return connection.getInputStream();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ error("PrivilegedActionException", url, (IOException)e.getException());
+ throw (IOException)e.getException();
+ }
+
+ //urlStream = createInputStream(url);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+
+ SCADefinitions definitions = new SCADefinitionsImpl();
+ QName name = null;
+ int event;
+ while ( reader.hasNext() ) {
+ event = reader.next();
+
+ if ( event == XMLStreamConstants.START_ELEMENT ||
+ event == XMLStreamConstants.END_ELEMENT ) {
+ name = reader.getName();
+ if ( name.equals(DEFINITIONS_QNAME) ) {
+ if ( event == XMLStreamConstants.END_ELEMENT ) {
+ return definitions;
+ }
+ } else {
+ SCADefinitions aDefn = (SCADefinitions)extensionProcessor.read(reader);
+ SCADefinitionsUtil.aggregateSCADefinitions(aDefn, definitions);
+ }
+ }
+ }
+
+ return definitions;
+ } catch (XMLStreamException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", inputFactory, ce);
+ throw ce;
+ } catch (IOException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", inputFactory, ce);
+ throw ce;
+ } finally {
+
+ try {
+ if (urlStream != null) {
+ urlStream.close();
+ urlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(SCADefinitions scaDefinitions, ModelResolver resolver) throws ContributionResolveException {
+ SCADefinitionsUtil.stripDuplicates(scaDefinitions);
+ extensionProcessor.resolve(scaDefinitions, resolver);
+ }
+
+ public String getArtifactType() {
+ return "definitions.xml";
+ }
+
+ public Class<SCADefinitions> getModelType() {
+ return SCADefinitions.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
new file mode 100644
index 0000000000..b87d890866
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.definitions.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.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Processor for SCA Definitions
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADefinitionsProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SCADefinitions> {
+
+ private StAXArtifactProcessor<Object> extensionProcessor;
+ private Monitor monitor;
+
+ public static final String BINDING = "binding";
+ public static final String IMPLEMENTATION = "implementation";
+ public static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ public static final String SCA_DEFINITIONS = "definitions";
+ public static final QName SCA_DEFINITIONS_QNAME = new QName(SCA10_NS, SCA_DEFINITIONS);
+ public static final String TARGET_NAMESPACE = "targetNamespace";
+ public static final String NAME = "name";
+
+ /**
+ * Construct a new definitions processor
+ * @param extensionProcessor
+ * @param modelResolver
+ */
+ public SCADefinitionsProcessor(StAXArtifactProcessor<Object> extensionProcessor,
+ ModelResolver modelResolver, Monitor monitor) {
+ this.extensionProcessor = extensionProcessor;
+ this.monitor = monitor;
+ }
+
+ public SCADefinitionsProcessor(ExtensionPointRegistry extensionPoints,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ Monitor monitor) {
+ this.extensionProcessor = extensionProcessor;
+ this.monitor = monitor;
+ }
+
+ public SCADefinitions read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ QName name = null;
+ SCADefinitions definitions = null;
+ String targetNamespace = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT: {
+ name = reader.getName();
+ if ( SCA_DEFINITIONS_QNAME.equals(name)) {
+ definitions = new SCADefinitionsImpl();
+ targetNamespace = reader.getAttributeValue(null, TARGET_NAMESPACE);
+ definitions.setTargetNamespace(targetNamespace);
+ } else {
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null) {
+ if ( extension instanceof Intent ) {
+ Intent intent = (Intent)extension;
+ intent.setName(new QName(targetNamespace,
+ intent.getName().getLocalPart()));
+ if ( intent instanceof QualifiedIntent ) {
+ QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
+ qualifiedIntent.getQualifiableIntent().
+ setName(new QName(targetNamespace,
+ qualifiedIntent.getQualifiableIntent().getName().getLocalPart()));
+ }
+
+ // FIXME: Workaround for TUSCANY-2499
+ intent.setUnresolved(false);
+
+ definitions.getPolicyIntents().add(intent);
+ } else if ( extension instanceof PolicySet ) {
+ PolicySet policySet = (PolicySet)extension;
+ policySet.setName(new QName(targetNamespace,
+ policySet.getName().getLocalPart()));
+ definitions.getPolicySets().add(policySet);
+ } else if ( extension instanceof Binding ) {
+ Binding binding = (Binding)extension;
+ definitions.getBindings().add(binding);
+ } else if ( extension instanceof IntentAttachPointType ) {
+ IntentAttachPointType type = (IntentAttachPointType)extension;
+ if ( type.getName().getLocalPart().startsWith(BINDING)) {
+ definitions.getBindingTypes().add((IntentAttachPointType)extension);
+ } else if ( type.getName().getLocalPart().startsWith(IMPLEMENTATION)) {
+ definitions.getImplementationTypes().add((IntentAttachPointType)extension);
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ case XMLStreamConstants.CHARACTERS:
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+ if ( SCA_DEFINITIONS_QNAME.equals(name)) {
+ return definitions;
+ }
+ break;
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return definitions;
+ }
+
+ public void write(SCADefinitions definitions, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ writeStartDocument(writer, SCA10_NS, SCA_DEFINITIONS,
+ new XAttr(TARGET_NAMESPACE, definitions.getTargetNamespace()));
+
+ for (Intent policyIntent : definitions.getPolicyIntents()) {
+ extensionProcessor.write(policyIntent, writer);
+ }
+
+ for (PolicySet policySet : definitions.getPolicySets()) {
+ extensionProcessor.write(policySet, writer);
+ }
+
+ for (IntentAttachPointType bindingType : definitions.getBindingTypes()) {
+ extensionProcessor.write(bindingType, writer);
+ }
+
+ for (IntentAttachPointType implType : definitions.getImplementationTypes()) {
+ extensionProcessor.write(implType, writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(SCADefinitions scaDefns, ModelResolver resolver) throws ContributionResolveException {
+ // start by adding all of the top level artifacts into the resolver as there
+ // are many cross artifact references in a definitions file and we don't want
+ // to be dependent on the order things appear
+
+ List<Intent> simpleIntents = new ArrayList<Intent>();
+ List<ProfileIntent> profileIntents = new ArrayList<ProfileIntent>();
+ List<QualifiedIntent> qualifiedIntents = new ArrayList<QualifiedIntent>();
+ List<PolicySet> simplePolicySets = new ArrayList<PolicySet>();
+ List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
+
+ for (Intent policyIntent : scaDefns.getPolicyIntents()) {
+ if (policyIntent instanceof ProfileIntent)
+ profileIntents.add((ProfileIntent)policyIntent);
+ else if (policyIntent instanceof QualifiedIntent)
+ qualifiedIntents.add((QualifiedIntent)policyIntent);
+ else simpleIntents.add(policyIntent);
+
+ resolver.addModel(policyIntent);
+ }
+
+ for (PolicySet policySet : scaDefns.getPolicySets()) {
+ if (policySet.getReferencedPolicySets().isEmpty())
+ simplePolicySets.add(policySet);
+ else referredPolicySets.add(policySet);
+
+ resolver.addModel(policySet);
+ }
+
+ for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
+ resolver.addModel(bindingType);
+ }
+
+ for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
+ resolver.addModel(implType);
+ }
+
+ // now resolve everything to ensure that any references between
+ // artifacts are satisfied
+
+ for (Intent policyIntent : simpleIntents)
+ extensionProcessor.resolve(policyIntent, resolver);
+
+ for (ProfileIntent policyIntent : profileIntents)
+ extensionProcessor.resolve(policyIntent, resolver);
+
+ for (QualifiedIntent policyIntent : qualifiedIntents)
+ extensionProcessor.resolve(policyIntent, resolver);
+
+ for (PolicySet policySet : simplePolicySets)
+ extensionProcessor.resolve(policySet, resolver);
+
+ for (PolicySet policySet : referredPolicySets)
+ extensionProcessor.resolve(policySet, resolver);
+
+ for (int count = 0, size = scaDefns.getBindingTypes().size(); count < size; count++) {
+ IntentAttachPointType bindingType = scaDefns.getBindingTypes().get(count);
+ extensionProcessor.resolve(bindingType, resolver);
+ }
+
+ for (int count = 0, size = scaDefns.getImplementationTypes().size(); count < size; count++) {
+ IntentAttachPointType implType = scaDefns.getImplementationTypes().get(count);
+ extensionProcessor.resolve(implType, resolver);
+ }
+ }
+
+ public QName getArtifactType() {
+ return SCA_DEFINITIONS_QNAME;
+ }
+
+ public Class<SCADefinitions> getModelType() {
+ return SCADefinitions.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..38fe3c5225
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#definitions,model=org.apache.tuscany.sca.definitions.SCADefinitions
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
new file mode 100644
index 0000000000..4392461df1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;type=definitions.xml,model=org.apache.tuscany.sca.definitions.SCADefinitions
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/definitions-xml-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/definitions-xml-validation-messages.properties
new file mode 100644
index 0000000000..857887ec3f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/main/resources/definitions-xml-validation-messages.properties
@@ -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.
+#
+#
+ContributionReadException = ContributionReadException occured due to :
+PrivilegedActionException = Privileged Action Exception occured due to FilePermission in security policy file: \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.java b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.java
new file mode 100644
index 0000000000..187b7fa9f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.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.definitions;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface that will abstract various types of policy specifications
+ * and attachments for example WS-Policy
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Policy {
+ QName getSchemaName();
+ void setUnresolved(boolean unresolved);
+ boolean isUnresolved();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java
new file mode 100644
index 0000000000..ec4ead8b87
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.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.definitions;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev: 551296 $ $Date: 2007-06-28 01:18:35 +0530 (Thu, 28 Jun 2007) $
+ */
+public class ReadDocumentTestCase extends TestCase {
+
+ private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor = null;
+ private SCADefinitions definitions;
+ Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
+ Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
+ Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
+ Map<QName, IntentAttachPointType> implTypesTable = new Hashtable<QName, IntentAttachPointType>();
+ public static final String scaNamespace = "http://www.osoa.org/xmlns/sca/1.0";
+ public static final String namespace = "http://test";
+
+ private static final QName secureWsPolicy = new QName(namespace, "SecureWSPolicy");
+ private static final QName confidentiality = new QName(namespace, "confidentiality");
+ private static final QName integrity = new QName(namespace, "integrity");
+ private static final QName messageProtection = new QName(namespace, "messageProtection");
+ private static final QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
+ private static final QName confidentiality_message = new QName(namespace, "confidentiality.message");
+ private static final QName secureReliablePolicy = new QName(namespace, "SecureReliablePolicy");
+ private static final QName secureMessagingPolicies = new QName(namespace, "SecureMessagingPolicies");
+ private static final QName securityPolicy = new QName(namespace, "SecurityPolicy");
+ private static final QName basicAuthMsgProtSecurity = new QName(namespace, "BasicAuthMsgProtSecurity");
+ private static final QName wsBinding = new QName(scaNamespace, "binding.ws");
+ private static final QName javaImpl = new QName(scaNamespace, "implementation.java");
+
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+
+ // Create StAX processors
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
+
+ URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
+
+ URL url = getClass().getResource("test_definitions.xml");
+ URI uri = URI.create("test_definitions.xml");
+ definitions = policyDefinitionsProcessor.read(null, uri, url);
+
+ for ( Intent intent : definitions.getPolicyIntents() ) {
+ intentTable.put(intent.getName(), intent);
+ }
+
+ for ( PolicySet policySet : definitions.getPolicySets() ) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ for ( IntentAttachPointType bindingType : definitions.getBindingTypes() ) {
+ bindingTypesTable.put(bindingType.getName(), bindingType);
+ }
+
+ for ( IntentAttachPointType implType : definitions.getImplementationTypes() ) {
+ implTypesTable.put(implType.getName(), implType);
+ }
+ }
+
+ public void testReadSCADefinitions() throws Exception {
+ assertNotNull(definitions);
+
+ assertNotNull(intentTable.get(confidentiality));
+ assertNotNull(intentTable.get(messageProtection));
+ assertNotNull(intentTable.get(confidentiality_transport));
+ assertTrue(intentTable.get(confidentiality).getDescription().length() > 0 );
+
+ assertNotNull(policySetTable.get(secureReliablePolicy));
+ assertTrue(policySetTable.get(secureReliablePolicy).getProvidedIntents().size() == 2);
+ assertTrue(policySetTable.get(secureReliablePolicy).getPolicies().size() == 2);
+
+ assertNotNull(policySetTable.get(secureMessagingPolicies));
+ assertEquals(policySetTable.get(secureMessagingPolicies).getMappedPolicies().size(), 3);
+ //assertTrue(policySetTable.get(secureWsPolicy).getPolicies().get(0) instanceof org.apache.neethi.Policy);
+
+ assertEquals(bindingTypesTable.size(), 1);
+ assertNotNull(bindingTypesTable.get(wsBinding));
+ assertEquals(implTypesTable.size(), 1);
+ assertNotNull(implTypesTable.get(javaImpl));
+ }
+
+ public void testResolveSCADefinitions() throws Exception {
+ assertTrue(intentTable.get(messageProtection) instanceof ProfileIntent);
+ ProfileIntent profileIntent = (ProfileIntent)intentTable.get(new QName(namespace, "messageProtection"));
+ assertNull(profileIntent.getRequiredIntents().get(0).getDescription());
+
+ QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
+ assertTrue(intentTable.get(confidentiality_transport) instanceof QualifiedIntent);
+ QualifiedIntent qualifiedIntent = (QualifiedIntent)intentTable.get(new QName(namespace, "confidentiality.transport"));
+ assertNull(qualifiedIntent.getQualifiableIntent().getDescription());
+
+ PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
+ PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
+ PolicySet securityPolicySet = policySetTable.get(securityPolicy);
+
+ assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
+ assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
+ assertTrue(secureMessagingPolicySet.isUnresolved());
+ assertEquals(securityPolicySet.getMappedPolicies().size(), 5);
+
+ //testing to ensure that inclusion of referred policy sets has not happened
+ PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
+ assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
+ assertTrue(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
+
+ IntentAttachPointType wsBindingType = bindingTypesTable.get(wsBinding);
+ assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
+
+ IntentAttachPointType javaImplType = implTypesTable.get(javaImpl);
+ assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
+
+ ModelResolver resolver = new DefaultModelResolver();
+ policyDefinitionsProcessor.resolve(definitions, resolver);
+ //builder.build(scaDefinitions);
+
+ //testing if policy intents have been linked have property been linked up
+ assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
+ assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
+ assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
+ assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
+
+ //testing if policysets have been properly linked up with intents
+ assertFalse(secureMessagingPolicySet.isUnresolved());
+ assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
+ assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
+
+ //testing if intent maps have been properly mapped to policies
+ assertFalse(securityPolicySet.isUnresolved());
+ assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
+ assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_message)));
+
+ //testing for inclusion of referred policysets
+ assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
+ assertFalse(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
+ assertNotNull(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
+
+ assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNotNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
+
+ assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNotNull(javaImplType.getMayProvideIntents().get(0).getDescription());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java
new file mode 100644
index 0000000000..b4d7a8c584
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.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.definitions;
+
+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.sca.policy.Policy;
+
+/**
+ * A PolicyProcessor used for testing.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestPolicyProcessor implements StAXArtifactProcessor<Policy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
+ return new MockPolicyImplOne();
+ }
+
+ public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<Policy> getModelType() {
+ // TODO Auto-generated method stub
+ return Policy.class;
+ }
+
+ public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+
+ public class MockPolicyImplOne implements Policy {
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
new file mode 100644
index 0000000000..f60047e769
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
@@ -0,0 +1,255 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- Extension Types Metadata -->
+<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
+ mayProvide="test:integrity"/>
+
+<!-- Intents and Policysets to assume targetnamespace -->
+<intent name="TestIntentOne"
+ constrains="sca:binding">
+ <description>
+ Test Intent
+ </description>
+ </intent>
+
+ <intent name="TestIntentTwo"
+ constrains="sca:binding"
+ requires="test:TestIntentOne">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <policySet name="TestPolicySetOne"
+ provides="test:TestIntentOne"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+
+ <!-- qualified intents -->
+ <intent name="confidentiality.transport" />
+ <intent name="confidentiality.message" />
+ <intent name="confidentiality.message.whole" />
+ <intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <policySet name="SecureReliablePolicy"
+ provides="test:confidentiality.transport test:integrity"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+ <policySet name="SecureMessagingPolicies"
+ provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="test:confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport" alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message" alternative" -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="SecurityPolicy"
+ provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <intentMap provides="test:confidentiality" default="message">
+ <qualifier name="message">
+ <intentMap provides="message" default="whole">
+ <qualifier name="body">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for body encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="whole">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for whole message encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+ </qualifier>
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for transport encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="BasicAuthMsgProtSecurity"
+ provides="test:authentication test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <policySetReference name="test:AuthenticationPolicies"/>
+ <policySetReference name="test:ConfidentialityPolicies"/>
+</policySet>
+
+<policySet name="AuthenticationPolicies"
+ provides="test:authentication"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</policySet>
+
+<policySet name="ConfidentialityPolicies"
+ provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="test:confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="SecureWSPolicy"
+ provides="test:confidentiality"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SecurityToken>
+ <sp:TokenType>sp:X509v3</sp:TokenType>
+ </sp:SecurityToken>
+ <sp:UsernameToken />
+ <sp:SignedParts />
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:TransportBinding>
+ <sp:IncludeTimeStamp />
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </policySet>
+
+<!-- profile intent -->
+ <intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="test:messageProtection">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <intent name="messageProtection"
+ constrains="sca:binding"
+ requires="test:confidentiality test:integrity">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions/LICENSE b/sca-java-1.x/branches/sca-android/modules/definitions/LICENSE
new file mode 100644
index 0000000000..6e529a25c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/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-android/modules/definitions/META-INF/README b/sca-java-1.x/branches/sca-android/modules/definitions/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions/NOTICE b/sca-java-1.x/branches/sca-android/modules/definitions/NOTICE
new file mode 100644
index 0000000000..1325efd8bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/definitions/pom.xml b/sca-java-1.x/branches/sca-android/modules/definitions/pom.xml
new file mode 100644
index 0000000000..8e6d0cfebb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/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-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-definitions</artifactId>
+ <name>Apache Tuscany SCA Definitions</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.definitions</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.definitions*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.java b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.java
new file mode 100644
index 0000000000..2039b9ecc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.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.definitions;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+
+/**
+ * Represents SCA Definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCADefinitions {
+ /**
+ * Returns the target namespace for this SCA Definition
+ * @return the target namespace
+ */
+ String getTargetNamespace();
+
+ /**
+ * Sets the target names for this SCA Definition.
+ *
+ * @param ns the target namespace for this SCA Definition
+ */
+ void setTargetNamespace(String ns);
+
+ /**
+ * Returns a list of domain wide Policy Intents
+ *
+ * @return a list of domain wide Policy Intents
+ */
+ List<Intent> getPolicyIntents();
+
+ /**
+ * Returns a list of domain wide PolicySets
+ *
+ * @return a list of domain wide PolicySets
+ */
+ List<PolicySet> getPolicySets();
+
+ /**
+ * Returns a list of domain wide Binding Types
+ *
+ * @return a list of domain wide Binding Types
+ */
+ List<IntentAttachPointType> getBindingTypes();
+
+
+ /**
+ * Returns a list of domain wide Implementation Types
+ *
+ * @return a list of domain wide Implementation Types
+ */
+ List<IntentAttachPointType> getImplementationTypes();
+
+ /**
+ * Returns a list of domain wide binding definition objects
+ *
+ * @return a list of domain wide binding definition objects
+ */
+ List<Object> getBindings();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java
new file mode 100644
index 0000000000..a41d7a6717
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.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.definitions;
+
+
+/**
+ * Interface to abstract building of SCA Definitions for a Domain
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCADefinitionsBuilder {
+ /**
+ * Builds the SCA definitions
+ *
+ * @param scaDefns
+ */
+ void build(SCADefinitions scaDefns) throws SCADefinitionsBuilderException;
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.java b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.java
new file mode 100644
index 0000000000..85b9ad7f7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.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.definitions;
+
+/**
+ * Builder Exception
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADefinitionsBuilderException extends Exception {
+ private static final long serialVersionUID = 2513219325230252783L;
+
+ public SCADefinitionsBuilderException() {
+ }
+
+ public SCADefinitionsBuilderException(String message) {
+ super(message);
+ }
+
+ public SCADefinitionsBuilderException(Throwable cause) {
+ super(cause);
+ }
+
+ public SCADefinitionsBuilderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java
new file mode 100644
index 0000000000..8b9ff3e1a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java
@@ -0,0 +1,309 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.definitions;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Provides a concrete implementation for a SCADefinitionsBuilder
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADefinitionsBuilderImpl implements SCADefinitionsBuilder {
+
+ public void build(SCADefinitions scaDefns) throws SCADefinitionsBuilderException {
+ Map<QName, Intent> definedIntents = new HashMap<QName, Intent>();
+ for (Intent intent : scaDefns.getPolicyIntents()) {
+ definedIntents.put(intent.getName(), intent);
+ }
+
+ Map<QName, PolicySet> definedPolicySets = new HashMap<QName, PolicySet>();
+ for (PolicySet policySet : scaDefns.getPolicySets()) {
+ definedPolicySets.put(policySet.getName(), policySet);
+ }
+
+ Map<QName, IntentAttachPointType> definedBindingTypes = new HashMap<QName, IntentAttachPointType>();
+ for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
+ definedBindingTypes.put(bindingType.getName(), bindingType);
+ }
+
+ Map<QName, IntentAttachPointType> definedImplTypes = new HashMap<QName, IntentAttachPointType>();
+ for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
+ definedImplTypes.put(implType.getName(), implType);
+ }
+
+ //filling up the maps removes all duplicate entries... so fill this unique lists
+ //into the scaDefns.
+ scaDefns.getPolicyIntents().clear();
+ scaDefns.getPolicySets().clear();
+ scaDefns.getBindingTypes().clear();
+ scaDefns.getImplementationTypes().clear();
+
+ scaDefns.getPolicyIntents().addAll(definedIntents.values());
+ scaDefns.getPolicySets().addAll(definedPolicySets.values());
+ scaDefns.getBindingTypes().addAll(definedBindingTypes.values());
+ scaDefns.getImplementationTypes().addAll(definedImplTypes.values());
+
+ buildPolicyIntents(scaDefns, definedIntents);
+ buildPolicySets(scaDefns, definedPolicySets, definedIntents);
+ buildBindingTypes(scaDefns, definedBindingTypes, definedIntents);
+ buildImplementationTypes(scaDefns, definedImplTypes, definedIntents);
+ }
+
+ private void buildBindingTypes(SCADefinitions scaDefns,
+ Map<QName, IntentAttachPointType> definedBindingTypes,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+ for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
+ buildAlwaysProvidedIntents(bindingType, definedIntents);
+ buildMayProvideIntents(bindingType, definedIntents);
+ }
+
+ }
+
+ private void buildImplementationTypes(SCADefinitions scaDefns,
+ Map<QName, IntentAttachPointType> definedImplTypes,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+ for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
+ buildAlwaysProvidedIntents(implType, definedIntents);
+ buildMayProvideIntents(implType, definedIntents);
+ }
+ }
+
+
+ private void buildPolicyIntents(SCADefinitions scaDefns, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ for (Intent policyIntent : scaDefns.getPolicyIntents()) {
+ if (policyIntent instanceof ProfileIntent) {
+ buildProfileIntent((ProfileIntent)policyIntent, definedIntents);
+ }
+
+ if (policyIntent instanceof QualifiedIntent) {
+ buildQualifiedIntent((QualifiedIntent)policyIntent, definedIntents);
+ }
+ }
+ }
+
+ private void buildPolicySets(SCADefinitions scaDefns,
+ Map<QName, PolicySet> definedPolicySets,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+
+ for (PolicySet policySet : scaDefns.getPolicySets()) {
+ buildProvidedIntents(policySet, definedIntents);
+ buildIntentsInMappedPolicies(policySet, definedIntents);
+ buildReferredPolicySets(policySet, definedPolicySets);
+ }
+
+ for (PolicySet policySet : scaDefns.getPolicySets()) {
+ for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
+ includeReferredPolicySets(policySet, referredPolicySet);
+ }
+ }
+ }
+
+ private void buildProfileIntent(ProfileIntent policyIntent, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ //FIXME: Need to check for cyclic references first i.e an A requiring B and then B requiring A...
+ if (policyIntent != null) {
+ //resolve all required intents
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
+ if (requiredIntent.isUnresolved()) {
+ Intent resolvedRequiredIntent = definedIntents.get(requiredIntent.getName());
+ if (resolvedRequiredIntent != null) {
+ requiredIntents.add(resolvedRequiredIntent);
+ } else {
+ throw new SCADefinitionsBuilderException("Required Intent - " + requiredIntent
+ + " not found for ProfileIntent "
+ + policyIntent);
+
+ }
+ } else {
+ requiredIntents.add(requiredIntent);
+ }
+ }
+ policyIntent.getRequiredIntents().clear();
+ policyIntent.getRequiredIntents().addAll(requiredIntents);
+ }
+ }
+
+ private void buildQualifiedIntent(QualifiedIntent policyIntent, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ if (policyIntent != null) {
+ //resolve the qualifiable intent
+ Intent qualifiableIntent = policyIntent.getQualifiableIntent();
+ if (qualifiableIntent.isUnresolved()) {
+ Intent resolvedQualifiableIntent = definedIntents.get(qualifiableIntent.getName());
+
+ if (resolvedQualifiableIntent != null) {
+ policyIntent.setQualifiableIntent(resolvedQualifiableIntent);
+ } else {
+ throw new SCADefinitionsBuilderException("Qualifiable Intent - " + qualifiableIntent
+ + " not found for QualifiedIntent "
+ + policyIntent);
+ }
+
+ }
+ }
+ }
+
+
+ private void buildAlwaysProvidedIntents(IntentAttachPointType extensionType,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+ if (extensionType != null) {
+ // resolve all provided intents
+ List<Intent> alwaysProvided = new ArrayList<Intent>();
+ for (Intent providedIntent : extensionType.getAlwaysProvidedIntents()) {
+ if (providedIntent.isUnresolved()) {
+ Intent resolvedProvidedIntent = definedIntents.get(providedIntent.getName());
+ if (resolvedProvidedIntent != null) {
+ alwaysProvided.add(resolvedProvidedIntent);
+ } else {
+ throw new SCADefinitionsBuilderException(
+ "Always Provided Intent - " + providedIntent
+ + " not found for ExtensionType "
+ + extensionType);
+
+ }
+ } else {
+ alwaysProvided.add(providedIntent);
+ }
+ }
+ extensionType.getAlwaysProvidedIntents().clear();
+ extensionType.getAlwaysProvidedIntents().addAll(alwaysProvided);
+ }
+ }
+
+ private void buildMayProvideIntents(IntentAttachPointType extensionType,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+ if (extensionType != null) {
+ // resolve all provided intents
+ List<Intent> mayProvide = new ArrayList<Intent>();
+ for (Intent providedIntent : extensionType.getMayProvideIntents()) {
+ if (providedIntent.isUnresolved()) {
+ Intent resolvedProvidedIntent = definedIntents.get(providedIntent.getName());
+ if (resolvedProvidedIntent != null) {
+ mayProvide.add(resolvedProvidedIntent);
+ } else {
+ throw new SCADefinitionsBuilderException(
+ "May Provide Intent - " + providedIntent
+ + " not found for ExtensionType "
+ + extensionType);
+
+ }
+ } else {
+ mayProvide.add(providedIntent);
+ }
+ }
+ extensionType.getMayProvideIntents().clear();
+ extensionType.getMayProvideIntents().addAll(mayProvide);
+ }
+ }
+
+ private void buildProvidedIntents(PolicySet policySet, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ if (policySet != null) {
+ //resolve all provided intents
+ List<Intent> providedIntents = new ArrayList<Intent>();
+ for (Intent providedIntent : policySet.getProvidedIntents()) {
+ if (providedIntent.isUnresolved()) {
+ Intent resolvedProvidedIntent = definedIntents.get(providedIntent.getName());
+ if (resolvedProvidedIntent != null) {
+ providedIntents.add(resolvedProvidedIntent);
+ } else {
+ throw new SCADefinitionsBuilderException("Provided Intent - " + providedIntent
+ + " not found for PolicySet "
+ + policySet);
+
+ }
+ } else {
+ providedIntents.add(providedIntent);
+ }
+ }
+ policySet.getProvidedIntents().clear();
+ policySet.getProvidedIntents().addAll(providedIntents);
+ }
+ }
+
+ private void buildIntentsInMappedPolicies(PolicySet policySet, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
+ for (Map.Entry<Intent, List<Object>> entry : policySet.getMappedPolicies().entrySet()) {
+ Intent mappedIntent = entry.getKey();
+ if (mappedIntent.isUnresolved()) {
+ Intent resolvedMappedIntent = definedIntents.get(mappedIntent.getName());
+
+ if (resolvedMappedIntent != null) {
+ mappedPolicies.put(resolvedMappedIntent, entry.getValue());
+ } else {
+ throw new SCADefinitionsBuilderException("Mapped Intent - " + mappedIntent
+ + " not found for PolicySet "
+ + policySet);
+
+ }
+ } else {
+ mappedPolicies.put(mappedIntent, entry.getValue());
+ }
+ }
+
+ policySet.getMappedPolicies().clear();
+ policySet.getMappedPolicies().putAll(mappedPolicies);
+ }
+
+ private void buildReferredPolicySets(PolicySet policySet, Map<QName, PolicySet> definedPolicySets)
+ throws SCADefinitionsBuilderException {
+
+ List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
+ for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
+ if (referredPolicySet.isUnresolved()) {
+ PolicySet resolvedReferredPolicySet = definedPolicySets.get(referredPolicySet.getName());
+ if (resolvedReferredPolicySet != null) {
+ referredPolicySets.add(resolvedReferredPolicySet);
+ } else {
+ throw new SCADefinitionsBuilderException("Referred PolicySet - " + referredPolicySet
+ + "not found for PolicySet - "
+ + policySet);
+ }
+ } else {
+ referredPolicySets.add(referredPolicySet);
+ }
+ }
+ policySet.getReferencedPolicySets().clear();
+ policySet.getReferencedPolicySets().addAll(referredPolicySets);
+ }
+
+ private void includeReferredPolicySets(PolicySet policySet, PolicySet referredPolicySet) {
+ for (PolicySet furtherReferredPolicySet : referredPolicySet.getReferencedPolicySets()) {
+ includeReferredPolicySets(referredPolicySet, furtherReferredPolicySet);
+ }
+ policySet.getPolicies().addAll(referredPolicySet.getPolicies());
+ policySet.getMappedPolicies().putAll(referredPolicySet.getMappedPolicies());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.java b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.java
new file mode 100644
index 0000000000..a5178497a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.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.definitions.impl;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Provides a concrete implementation for SCADefinitions
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADefinitionsImpl implements SCADefinitions {
+ private String targetNamespace = null;
+ private List<Intent> policyIntents = new CopyOnWriteArrayList<Intent>();
+ private List<PolicySet> policySets = new CopyOnWriteArrayList<PolicySet>();
+ private List<IntentAttachPointType> bindingTypes = new CopyOnWriteArrayList<IntentAttachPointType>();
+ private List<IntentAttachPointType> implementationTypes = new CopyOnWriteArrayList<IntentAttachPointType>();
+ private List<Object> bindings = new CopyOnWriteArrayList<Object>();
+
+
+ public List<IntentAttachPointType> getBindingTypes() {
+ return bindingTypes;
+ }
+
+ public List<IntentAttachPointType> getImplementationTypes() {
+ return implementationTypes;
+ }
+
+ public List<Intent> getPolicyIntents() {
+ return policyIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public String getTargetNamespace() {
+ return targetNamespace;
+ }
+
+ public void setTargetNamespace(String ns) {
+ this.targetNamespace = ns;
+ }
+
+ public List<Object> getBindings() {
+ return bindings;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java
new file mode 100644
index 0000000000..8de6f63c05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.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.definitions.util;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Some utility functions to deal with SCADefinitions
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADefinitionsUtil {
+
+ public static void stripDuplicates(SCADefinitions scaDefns) {
+ Map<QName, Intent> definedIntents = new HashMap<QName, Intent>();
+ for (Intent intent : scaDefns.getPolicyIntents()) {
+ definedIntents.put(intent.getName(), intent);
+ }
+
+ Map<QName, PolicySet> definedPolicySets = new HashMap<QName, PolicySet>();
+ for (PolicySet policySet : scaDefns.getPolicySets()) {
+ definedPolicySets.put(policySet.getName(), policySet);
+ }
+
+ Map<QName, IntentAttachPointType> definedBindingTypes = new HashMap<QName, IntentAttachPointType>();
+ for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
+ definedBindingTypes.put(bindingType.getName(), bindingType);
+ }
+
+ Map<QName, IntentAttachPointType> definedImplTypes = new HashMap<QName, IntentAttachPointType>();
+ for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
+ definedImplTypes.put(implType.getName(), implType);
+ }
+
+ scaDefns.getPolicyIntents().clear();
+ scaDefns.getPolicyIntents().addAll(definedIntents.values());
+ scaDefns.getPolicySets().clear();
+ scaDefns.getPolicySets().addAll(definedPolicySets.values());
+ scaDefns.getBindingTypes().clear();
+ scaDefns.getBindingTypes().addAll(definedBindingTypes.values());
+ scaDefns.getImplementationTypes().clear();
+ scaDefns.getImplementationTypes().addAll(definedImplTypes.values());
+ }
+
+ public static void aggregateSCADefinitions(SCADefinitions source, SCADefinitions target) {
+ target.getPolicyIntents().addAll(source.getPolicyIntents());
+ target.getPolicySets().addAll(source.getPolicySets());
+ target.getBindingTypes().addAll(source.getBindingTypes());
+ target.getImplementationTypes().addAll(source.getImplementationTypes());
+ target.getBindings().addAll(source.getBindings());
+ }
+
+ public static boolean isSCADefnsFile(URI uri) {
+ int index = uri.toString().lastIndexOf("/");
+
+ index = (index != -1) ? index + 1 : 0;
+
+ return uri.toString().substring(index).equals("definitions.xml");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/LICENSE b/sca-java-1.x/branches/sca-android/modules/endpoint/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/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-android/modules/endpoint/META-INF/README b/sca-java-1.x/branches/sca-android/modules/endpoint/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/NOTICE b/sca-java-1.x/branches/sca-android/modules/endpoint/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/endpoint/pom.xml b/sca-java-1.x/branches/sca-android/modules/endpoint/pom.xml
new file mode 100644
index 0000000000..31e8adc800
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/pom.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-endpoint</artifactId>
+ <name>Apache Tuscany SCA Default Endpoint Implementation</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-monitor-logging</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.endpoint</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.endpoint*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverFactoryImpl.java
new file mode 100644
index 0000000000..f0646e934e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverFactoryImpl.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.endpoint.impl;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
+
+/**
+ * The factory for creating endpoint Binding providers
+ *
+ * @version $Rev$ $Date$
+ */
+public class EndpointResolverFactoryImpl implements EndpointResolverFactory<Endpoint> {
+
+ private ExtensionPointRegistry extensionPoints;
+
+ public EndpointResolverFactoryImpl(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+ }
+
+ public EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding) {
+
+ return new EndpointResolverImpl(extensionPoints, endpoint);
+ }
+
+ public Class<Endpoint> getModelType() {
+ return Endpoint.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverImpl.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverImpl.java
new file mode 100644
index 0000000000..b76c4b82f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverImpl.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.endpoint.impl;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint;
+
+
+/**
+ * The endpoint resolver allows unresolved endpoints to be plumbed into
+ * the runtime start and message send processing as a hook to late resolution
+ * of target services
+ *
+ * @version $Rev$ $Date$
+ */
+public class EndpointResolverImpl implements EndpointResolver {
+
+ private final static Logger logger = Logger.getLogger(EndpointResolverImpl.class.getName());
+
+ private Endpoint endpoint;
+ private List<EndpointResolver> endpointResolvers = new ArrayList<EndpointResolver>();
+
+ public EndpointResolverImpl(ExtensionPointRegistry extensionPoints,
+ Endpoint endpoint) {
+ this.endpoint = endpoint;
+
+ EndpointResolverFactoryExtensionPoint resolverFactories =
+ extensionPoints.getExtensionPoint(EndpointResolverFactoryExtensionPoint.class);
+
+ for (Binding binding : endpoint.getCandidateBindings()){
+ EndpointResolverFactory resolverFactory = resolverFactories.getEndpointResolverFactory(binding.getClass());
+
+ // if the binding in question has a endpoint resolver factory they try and
+ // create an endpoint resolver
+ if (resolverFactory != null){
+ EndpointResolver resolver = resolverFactory.createEndpointResolver(endpoint, binding);
+
+ if (resolver != null){
+ endpointResolvers.add(resolver);
+ }
+ }
+ }
+ }
+
+ public void start(){
+ // do nothing
+ }
+
+ public void stop(){
+ // do nothing
+ }
+
+ public void resolve() {
+ if (endpoint.isUnresolved()){
+ // Resolve the endpoint binding here
+
+ // first do any general resolution that's required
+
+ // ask the bindings to resolve the endpoint one by one
+ for (EndpointResolver resolver : endpointResolvers){
+ resolver.resolve();
+ if (endpoint.isUnresolved() != true){
+ break;
+ }
+ }
+
+ if (endpoint.isUnresolved()){
+ // TODO: TUSCANY-2580: if its still unresolved use the first candidate binding
+ endpoint.setSourceBinding(endpoint.getCandidateBindings().get(0));
+ endpoint.getSourceBinding().setURI(endpoint.getTargetName());
+ }
+
+ if (endpoint.isUnresolved() != true){
+ // If we have to build the endpoint because we are matching
+ // intents and policies then we do that now. If the binding
+ // is just configured by setting its uri we can just do local binding
+ // configuration here
+
+ // EndpointBuilderImpl.build(endpoint);
+ } else {
+ // raise an exception saying the endpoint can't be resolved
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory b/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory
new file mode 100644
index 0000000000..50e0a930d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 binding extension
+org.apache.tuscany.sca.endpoint.impl.EndpointResolverFactoryImpl;model=org.apache.tuscany.sca.assembly.Endpoint
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml b/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
new file mode 100644
index 0000000000..8bac9e01c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:bindingType type="sca:binding.sca" mayProvide="" alwaysProvides=""/>
+ </sca:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/AddService.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..188451ebac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/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-android/modules/endpoint/src/test/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..7ca8fb04b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/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-android/modules/endpoint/src/test/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..3d861f2018
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/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-android/modules/endpoint/src/test/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/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-android/modules/endpoint/src/test/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..1323edf55a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/DivideServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/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-android/modules/endpoint/src/test/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..91b803bc9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/MultiplyServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/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-android/modules/endpoint/src/test/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..58cc4a3547
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/calculator/SubtractServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java
new file mode 100644
index 0000000000..5a2d9babf4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.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.apace.tuscany.sca.binding.sca;
+
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
+import org.apache.tuscany.sca.endpoint.impl.EndpointResolverFactoryImpl;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * EndpointTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class EndpointTestCase {
+
+ private static URLArtifactProcessor<Contribution> contributionProcessor;
+ private static ModelResolverExtensionPoint modelResolvers;
+ private static ModelFactoryExtensionPoint modelFactories;
+ private static AssemblyFactory assemblyFactory;
+ private static XMLOutputFactory outputFactory;
+ private static StAXArtifactProcessor<Object> xmlProcessor;
+ private static CompositeBuilder compositeBuilder;
+ private static ModelResolver modelResolver;
+ private static CompositeActivator compositeActivator;
+ private static ExtensionPointRegistry extensionPoints;
+
+ @BeforeClass
+ public static void init() {
+
+ // Create extension point registry
+ extensionPoints = new DefaultExtensionPointRegistry();
+
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ Monitor monitor = monitorFactory.createMonitor();
+
+ modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ // Initialize the Tuscany module activators
+ ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
+ for (ModuleActivator activator: moduleActivators.getModuleActivators()) {
+ activator.start(extensionPoints);
+ }
+
+ // Get XML input/output factories
+
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+
+ // Get contribution workspace and assembly model factories
+ assemblyFactory = new RuntimeAssemblyFactory();
+ modelFactories.addFactory(assemblyFactory);
+
+ // Create XML artifact processors
+ StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor);
+
+ // Create contribution content processor
+ URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class);
+
+ // Get the model resolvers
+ modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
+ modelResolver = new ExtensibleModelResolver(null, modelResolvers, modelFactories);
+
+ // Create a composite builder
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
+
+ // Runtime Init ===================
+/*
+ ContextFactoryExtensionPoint contextFactories = new DefaultContextFactoryExtensionPoint(extensionPoints);
+ extensionPoints.addExtensionPoint(contextFactories);
+
+ // Create a wire post processor extension point
+ RuntimeWireProcessorExtensionPoint wireProcessors =
+ extensionPoints.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+ RuntimeWireProcessor wireProcessor = new ExtensibleWireProcessor(wireProcessors);
+
+ JavaInterfaceFactory javaInterfaceFactory =
+ extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class).getFactory(JavaInterfaceFactory.class);
+ RequestContextFactory requestContextFactory =
+ extensionPoints.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class);
+
+ ConversationManager conversationManager = new ConversationManagerImpl();
+ extensionPoints.addExtensionPoint(conversationManager);
+
+
+ ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
+ ScopeContainerFactory[] factories =
+ new ScopeContainerFactory[] {new CompositeScopeContainerFactory(), new StatelessScopeContainerFactory(),
+ new RequestScopeContainerFactory(),
+ new ConversationalScopeContainerFactory(null),
+ // new HttpSessionScopeContainer(monitor)
+ };
+ for (ScopeContainerFactory f : factories) {
+ scopeRegistry.register(f);
+ }
+
+ compositeActivator =new CompositeActivatorImpl(assemblyFactory,
+ messageFactory,
+ javaInterfaceFactory,
+ scaBindingFactory,
+ mapper,
+ scopeRegistry,
+ extensionPoints.getExtensionPoint(WorkScheduler.class),
+ wireProcessor,
+ requestContextFactory,
+ new DefaultProxyFactoryExtensionPoint(messageFactory, mapper),
+ extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class),
+ extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class),
+ conversationManager);
+
+*/
+
+
+ }
+
+ @Test
+ public void testProvider(){
+ try {
+ URI calculatorURI = URI.create("calcualtor");
+ URL calculatorURL = new File("./target/test-classes").toURI().toURL();
+ Contribution contribution = contributionProcessor.read(null, calculatorURI, calculatorURL);
+
+ contributionProcessor.resolve(contribution, modelResolver);
+
+ Composite composite = contribution.getDeployables().get(0);
+
+ compositeBuilder.build(composite);
+
+ ComponentReference ref = (composite.getComponents().get(0).getReferences().get(0));
+
+ Assert.assertEquals(1, ref.getEndpoints().size());
+
+ Endpoint endpoint = ref.getEndpoints().get(0);
+
+ EndpointResolverFactory<Endpoint> factory = new EndpointResolverFactoryImpl(extensionPoints);
+
+ EndpointResolver endpointResolver = factory.createEndpointResolver(endpoint, null);
+
+ Assert.assertNotNull(endpointResolver);
+
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ System.out.println(ex.toString());
+ Assert.fail();
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/resources/Calculator.composite b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/resources/Calculator.composite
new file mode 100644
index 0000000000..3b743f6e26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/endpoint/src/test/resources/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://calc"
+ targetNamespace="http://calc"
+ 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="AddServiceComponentOff">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ <service name="AddServiceImpl">
+ <interface.java interface="calculator.AddService"/>
+ </service>
+ </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> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/LICENSE b/sca-java-1.x/branches/sca-android/modules/extensibility/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/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-android/modules/extensibility/META-INF/README b/sca-java-1.x/branches/sca-android/modules/extensibility/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/NOTICE b/sca-java-1.x/branches/sca-android/modules/extensibility/NOTICE
new file mode 100644
index 0000000000..b3e4797aaa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/NOTICE
@@ -0,0 +1,5 @@
+Copyright (c) 2005 - 2008 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-android/modules/extensibility/pom.xml b/sca-java-1.x/branches/sca-android/modules/extensibility/pom.xml
new file mode 100644
index 0000000000..01cd2d0ca9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-extensibility</artifactId>
+ <name>Apache Tuscany SCA Extensibility</name>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.extensibility</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java
new file mode 100644
index 0000000000..48f240559c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * 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>();
+
+ /**
+ * Constructs a new registry.
+ */
+ public DefaultExtensionPointRegistry() {
+ }
+
+ /**
+ * 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
+ *
+ * @throws IllegalArgumentException if extensionPoint is null
+ */
+ public void addExtensionPoint(Object extensionPoint) {
+ if (extensionPoint == null) {
+ throw new IllegalArgumentException("Cannot register null as an ExtensionPoint");
+ }
+
+ Set<Class<?>> interfaces = getAllInterfaces(extensionPoint.getClass());
+ for (Class<?> i : interfaces) {
+ extensionPoints.put(i, extensionPoint);
+ }
+ }
+
+ private Constructor<?> getConstructor(Constructor<?>[] constructors, Class<?>[] paramTypes) {
+ for (Constructor<?> c : constructors) {
+ Class<?>[] types = c.getParameterTypes();
+ if (c.getParameterTypes().length == paramTypes.length) {
+ boolean found = true;
+ for (int i = 0; i < types.length; i++) {
+ if (types[i] != paramTypes[i]) {
+ found = false;
+ break;
+ }
+ }
+ if (found) {
+ return c;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 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
+ *
+ * @throws IllegalArgumentException if extensionPointType is null
+ */
+ public <T> T getExtensionPoint(Class<T> extensionPointType) {
+ if (extensionPointType == null) {
+ throw new IllegalArgumentException("Cannot lookup ExtensionPoint of type null");
+ }
+
+ Object extensionPoint = extensionPoints.get(extensionPointType);
+ if (extensionPoint == null) {
+
+ // Dynamically load an extension point class declared under META-INF/services
+ try {
+ Class<?> extensionPointClass =
+ ServiceDiscovery.getInstance().loadFirstServiceClass(extensionPointType);
+ if (extensionPointClass != null) {
+ // Construct the extension point
+ Constructor<?>[] constructors = extensionPointClass.getConstructors();
+ Constructor<?> constructor = getConstructor(constructors, new Class<?>[] {ExtensionPointRegistry.class});
+ if (constructor != null) {
+ extensionPoint = constructor.newInstance(this);
+ } else {
+ constructor = getConstructor(constructors, new Class<?>[] {});
+ if (constructor != null) {
+ extensionPoint = constructor.newInstance();
+ } else {
+ throw new IllegalArgumentException(
+ "No valid constructor is found for " + extensionPointClass);
+ }
+ }
+
+ // Cache the loaded extension point
+ addExtensionPoint(extensionPoint);
+ }
+ } catch (InvocationTargetException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ return extensionPointType.cast(extensionPoint);
+ }
+
+ /**
+ * Remove an extension point based on the interface that it implements
+ *
+ * @param extensionPoint The extension point to remove
+ *
+ * @throws IllegalArgumentException if extensionPoint is null
+ */
+ public void removeExtensionPoint(Object extensionPoint) {
+ if (extensionPoint == null) {
+ throw new IllegalArgumentException("Cannot remove null as an ExtensionPoint");
+ }
+
+ Set<Class<?>> interfaces = getAllInterfaces(extensionPoint.getClass());
+ for (Class<?> i : interfaces) {
+ extensionPoints.remove(i);
+ }
+ }
+
+ /**
+ * Returns the set of interfaces implemented by the given class and its
+ * ancestors or a blank set if none
+ */
+ private 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) {
+ if (Modifier.isPublic(interfaze.getModifiers())) {
+ 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-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultModuleActivatorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultModuleActivatorExtensionPoint.java
new file mode 100644
index 0000000000..8ca030c0dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultModuleActivatorExtensionPoint.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.core;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of an extension point to hold Tuscany module activators.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModuleActivatorExtensionPoint implements ModuleActivatorExtensionPoint {
+ private List<ModuleActivator> activators = new ArrayList<ModuleActivator>();
+ private boolean loadedActivators;
+
+ /**
+ * Constructs a new extension point.
+ */
+ public DefaultModuleActivatorExtensionPoint() {
+ }
+
+ public void addModuleActivator(ModuleActivator activator) {
+ activators.add(activator);
+ }
+
+ public List<ModuleActivator> getModuleActivators() {
+ loadModuleActivators();
+ return activators;
+ }
+
+ public void removeModuleActivator(Object activator) {
+ activators.remove(activator);
+ }
+
+ /**
+ * Dynamically load module activators declared under META-INF/services
+ */
+ private void loadModuleActivators() {
+ if (loadedActivators)
+ return;
+
+ // Get the activator service declarations
+ Set<ServiceDeclaration> activatorDeclarations;
+ try {
+ activatorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ModuleActivator.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load and instantiate module activators
+ for (ServiceDeclaration activatorDeclaration: activatorDeclarations) {
+ ModuleActivator activator;
+ try {
+ Class<ModuleActivator> activatorClass = (Class<ModuleActivator>)activatorDeclaration.loadClass();
+ activator = activatorClass.newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(e);
+ }
+ addModuleActivator(activator);
+ }
+
+ loadedActivators = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java
new file mode 100644
index 0000000000..6f7c83c8d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of an extension point to hold Tuscany utility utilities.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultUtilityExtensionPoint implements UtilityExtensionPoint {
+ private Map<Class<?>, Object> utilities = new HashMap<Class<?>, Object>();
+
+ private ExtensionPointRegistry extensionPoints;
+
+ /**
+ * Constructs a new extension point.
+ */
+ public DefaultUtilityExtensionPoint(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+ }
+
+ /**
+ * Add a utility to the extension point. This default implementation
+ * stores utilities against the interfaces that they implement.
+ *
+ * @param utility The instance of the utility
+ *
+ * @throws IllegalArgumentException if utility is null
+ */
+ public void addUtility(Object utility) {
+ if (utility == null) {
+ throw new IllegalArgumentException("Cannot register null as a Service");
+ }
+
+ Set<Class<?>> interfaces = getAllInterfaces(utility.getClass());
+ for (Class<?> i : interfaces) {
+ utilities.put(i, utility);
+ }
+ }
+
+ private Constructor<?> getConstructor(Constructor<?>[] constructors, Class<?>[] paramTypes) {
+ for (Constructor<?> c : constructors) {
+ Class<?>[] types = c.getParameterTypes();
+ if (c.getParameterTypes().length == paramTypes.length) {
+ boolean found = true;
+ for (int i = 0; i < types.length; i++) {
+ if (types[i] != paramTypes[i]) {
+ found = false;
+ break;
+ }
+ }
+ if (found) {
+ return c;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the utility by the interface that it implements
+ *
+ * @param utilityType The lookup key (utility interface)
+ * @return The instance of the utility
+ *
+ * @throws IllegalArgumentException if utilityType is null
+ */
+ public <T> T getUtility(Class<T> utilityType) {
+ if (utilityType == null) {
+ throw new IllegalArgumentException("Cannot lookup Service of type null");
+ }
+
+ Object utility = utilities.get(utilityType);
+ if (utility == null) {
+
+ // Dynamically load a utility class declared under META-INF/utilities
+ try {
+ Class<?> utilityClass =
+ ServiceDiscovery.getInstance().loadFirstServiceClass(utilityType);
+ if (utilityClass != null) {
+ // Construct the utility
+ Constructor<?>[] constructors = utilityClass.getConstructors();
+ Constructor<?> constructor = getConstructor(constructors, new Class<?>[] {ExtensionPointRegistry.class});
+ if (constructor != null) {
+ utility = constructor.newInstance(extensionPoints);
+ } else {
+ constructor = getConstructor(constructors, new Class<?>[] {});
+ if (constructor != null) {
+ utility = constructor.newInstance();
+ } else {
+ throw new IllegalArgumentException(
+ "No valid constructor is found for " + utilityClass);
+ }
+ }
+
+ // Cache the loaded utility
+ addUtility(utility);
+ }
+ } catch (InvocationTargetException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ return utilityType.cast(utility);
+ }
+
+ /**
+ * Remove a utility based on the interface that it implements
+ *
+ * @param utility The utility to remove
+ *
+ * @throws IllegalArgumentException if utility is null
+ */
+ public void removeUtility(Object utility) {
+ if (utility == null) {
+ throw new IllegalArgumentException("Cannot remove null as a Service");
+ }
+
+ Set<Class<?>> interfaces = getAllInterfaces(utility.getClass());
+ for (Class<?> i : interfaces) {
+ utilities.remove(i);
+ }
+ }
+
+ /**
+ * Returns the set of interfaces implemented by the given class and its
+ * ancestors or a blank set if none
+ */
+ private 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) {
+ if (Modifier.isPublic(interfaze.getModifiers())) {
+ 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-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java
new file mode 100644
index 0000000000..f2f67b2d52
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.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.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
+ *
+ * @throws IllegalArgumentException if extensionPoint is null
+ */
+ 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
+ *
+ * @throws IllegalArgumentException if extensionPointType is null
+ */
+ <T> T getExtensionPoint(Class<T> extensionPointType);
+
+ /**
+ * Remove an extension point
+ * @param extensionPoint The extension point to remove
+ *
+ * @throws IllegalArgumentException if extensionPoint is null
+ */
+ void removeExtensionPoint(Object extensionPoint);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java
new file mode 100644
index 0000000000..dbfd0dcd90
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.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;
+
+
+/**
+ * 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.core.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 opportunity 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 {
+
+ /**
+ * This method is invoked when the module is started by the Tuscany system.
+ * It can be used by this module to register 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-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivatorExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivatorExtensionPoint.java
new file mode 100644
index 0000000000..ec0f12b8ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivatorExtensionPoint.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;
+
+import java.util.List;
+
+
+/**
+ * The extension point for the Tuscany module activator extensions.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModuleActivatorExtensionPoint {
+
+ /**
+ * Add a module activator extension to the extension point
+ * @param activator The instance of the module activator
+ *
+ * @throws IllegalArgumentException if activator is null
+ */
+ void addModuleActivator(ModuleActivator activator);
+
+ /**
+ * Returns the module activator extensions.
+ * @return The module activator extensions
+ */
+ List<ModuleActivator> getModuleActivators();
+
+ /**
+ * Remove a module activator
+ * @param activator The module activator to remove
+ *
+ * @throws IllegalArgumentException if activator is null
+ */
+ void removeModuleActivator(Object activator);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/UtilityExtensionPoint.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/UtilityExtensionPoint.java
new file mode 100644
index 0000000000..6b14b95666
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/UtilityExtensionPoint.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;
+
+
+/**
+ * The extension point for the Tuscany core utility extensions.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface UtilityExtensionPoint {
+
+ /**
+ * Add a utility to the extension point
+ * @param utility The instance of the utility
+ *
+ * @throws IllegalArgumentException if utility is null
+ */
+ void addUtility(Object utility);
+
+ /**
+ * Get the utility by the interface
+ * @param utilityType The lookup key (utility interface)
+ * @return The instance of the utility
+ *
+ * @throws IllegalArgumentException if utilityType is null
+ */
+ <T> T getUtility(Class<T> utilityType);
+
+ /**
+ * Remove a utility
+ * @param utility The utility to remove
+ *
+ * @throws IllegalArgumentException if utility is null
+ */
+ void removeUtility(Object utility);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ContextClassLoaderServiceDiscoverer.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ContextClassLoaderServiceDiscoverer.java
new file mode 100644
index 0000000000..2e11234095
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ContextClassLoaderServiceDiscoverer.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.extensibility;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.ref.WeakReference;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A ServiceDiscoverer that find META-INF/services/... using the Context ClassLoader.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class ContextClassLoaderServiceDiscoverer implements ServiceDiscoverer {
+ private static final Logger logger = Logger.getLogger(ContextClassLoaderServiceDiscoverer.class.getName());
+
+ public class ServiceDeclarationImpl implements ServiceDeclaration {
+ private URL url;
+ private String className;
+ private Class<?> javaClass;
+ private Map<String, String> attributes;
+
+ public ServiceDeclarationImpl(URL url, String className, Map<String, String> attributes) {
+ super();
+ this.url = url;
+ this.className = className;
+ this.attributes = attributes;
+ }
+
+ public Map<String, String> getAttributes() {
+ return attributes;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public URL getLocation() {
+ return url;
+ }
+
+ public Class<?> loadClass() throws ClassNotFoundException {
+ if (className == null) {
+ return null;
+ }
+ if (javaClass == null) {
+ javaClass = loadClass(className);
+ }
+ return javaClass;
+ }
+
+ public Class<?> loadClass(String className) throws ClassNotFoundException {
+ return classLoaderReference.get().loadClass(className);
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("ClassLoader: ").append(classLoaderReference.get());
+ sb.append(" Attributes: ").append(attributes);
+ return sb.toString();
+ }
+
+ public URL getResource(final String name) {
+ return AccessController.doPrivileged(new PrivilegedAction<URL>() {
+ public URL run() {
+ return classLoaderReference.get().getResource(name);
+ }
+ });
+ }
+
+ }
+
+ private WeakReference<ClassLoader> classLoaderReference;
+
+ public ContextClassLoaderServiceDiscoverer() {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ this.classLoaderReference = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ private List<URL> getResources(final String name, final boolean firstOnly) throws IOException {
+ try {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<List<URL>>() {
+ public List<URL> run() throws IOException {
+ if (firstOnly) {
+ URL url = classLoaderReference.get().getResource(name);
+ if (url != null) {
+ return Arrays.asList(url);
+ } else {
+ return Collections.emptyList();
+ }
+ } else {
+ List<URL> urls = Collections.list(classLoaderReference.get().getResources(name));
+ return urls;
+ }
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (IOException)e.getException();
+ }
+ }
+
+ /**
+ * Parse a service declaration in the form class;attr=value,attr=value and
+ * return a map of attributes
+ *
+ * @param declaration
+ * @return a map of attributes
+ */
+ private static Map<String, String> parseServiceDeclaration(String declaration) {
+ Map<String, String> attributes = new HashMap<String, String>();
+ int index = declaration.indexOf(';');
+ if (index != -1) {
+ attributes.put("class", declaration.substring(0, index).trim());
+ declaration = declaration.substring(index);
+ } else {
+ int j = declaration.indexOf('=');
+ if (j == -1) {
+ attributes.put("class", declaration.trim());
+ return attributes;
+ } else {
+ declaration = ";" + declaration;
+ }
+ }
+ StringTokenizer tokens = new StringTokenizer(declaration);
+ for (; tokens.hasMoreTokens();) {
+ String key = tokens.nextToken("=").substring(1).trim();
+ if (key == null)
+ break;
+ String value = tokens.nextToken(",").substring(1).trim();
+ if (value == null)
+ break;
+ attributes.put(key, value);
+ }
+ return attributes;
+ }
+
+ public Set<ServiceDeclaration> discover(String serviceName, boolean firstOnly) {
+ Set<ServiceDeclaration> descriptors = new HashSet<ServiceDeclaration>();
+
+ String name = "META-INF/services/" + serviceName;
+ boolean debug = logger.isLoggable(Level.FINE);
+ try {
+ for (final URL url : getResources(name, firstOnly)) {
+ if (debug) {
+ logger.fine("Reading service provider file: " + url.toExternalForm());
+ }
+
+ // Allow privileged access to open URL stream. Add FilePermission to added to security
+ // policy file.
+ InputStream is;
+ try {
+ is = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
+ public InputStream run() throws IOException {
+ URLConnection connection = url.openConnection();
+ // TUSCANY-2539
+ // Don't cache connections by default to stop Tuscany locking contribution jar files
+ // done here as this is one of the first places we open a stream and the only way to
+ // set the default is to set it on an instance of URLConnection
+ connection.setDefaultUseCaches(false);
+ connection.setUseCaches(false);
+ return url.openStream();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (IOException)e.getException();
+ }
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(is));
+ int count = 0;
+ while (true) {
+ String line = reader.readLine();
+ if (line == null)
+ break;
+ line = line.trim();
+ if (!line.startsWith("#") && !"".equals(line)) {
+ String reg = line.trim();
+ if (debug) {
+ logger.fine("Registering service provider: " + reg);
+ }
+
+ Map<String, String> attributes = parseServiceDeclaration(reg);
+ String className = attributes.get("class");
+ if (className == null) {
+ // Add a unique class name to prevent equals() from returning true
+ className = "_class_" + count;
+ count++;
+ }
+ ServiceDeclarationImpl descriptor = new ServiceDeclarationImpl(url, className, attributes);
+ descriptors.add(descriptor);
+ if (firstOnly) {
+ return descriptors;
+ }
+ }
+ }
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+ }
+ }
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return descriptors;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.java
new file mode 100644
index 0000000000..403b6aa7a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.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.extensibility;
+
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * Service declaration using J2SE Jar service provider spec Classes specified
+ * inside this declaration are loaded using the ClassLoader used to read the
+ * configuration file corresponding to this declaration.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServiceDeclaration {
+ /**
+ * Load a java class in the same context as the service definition
+ * @param className The class name
+ * @return The loaded class
+ * @throws ClassNotFoundException
+ */
+ Class<?> loadClass(String className) throws ClassNotFoundException;
+ /**
+ * Get the java class for the service impl
+ * @return The java class
+ */
+ Class<?> loadClass() throws ClassNotFoundException;
+ /**
+ * Get all attributes (name=value pairs) defined for the given entry
+ * @return All attributes keyed by name
+ */
+ Map<String, String> getAttributes();
+
+ URL getLocation();
+
+ String getClassName();
+
+ URL getResource(String name);
+
+ /**
+ * The service descriptor might be hashed
+ * @param obj Another object
+ * @return
+ */
+ boolean equals(Object obj);
+ /**
+ * The service descriptor might be hashed
+ * @return
+ */
+ int hashCode();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscoverer.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscoverer.java
new file mode 100644
index 0000000000..1722cd5f49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscoverer.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.extensibility;
+
+import java.util.Set;
+
+/**
+ * A SPI that allows different implementations of discovering service declarations
+ */
+public interface ServiceDiscoverer {
+ /**
+ * Discover the service descriptors by name
+ * @param serviceName The name of the service
+ * @param firstOnly A flag to indicate if only the first instance is to be discovered
+ *
+ * @return A set of service descriptors
+ */
+ Set<ServiceDeclaration> discover(String serviceName, boolean firstOnly);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
new file mode 100644
index 0000000000..ce41a44068
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.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.extensibility;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Service discovery for Tuscany based on J2SE Jar service provider spec.
+ * Services are described using configuration files in META-INF/services.
+ * Service description specifies a class name followed by optional properties.
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceDiscovery {
+ private static final Logger logger = Logger.getLogger(ServiceDiscovery.class.getName());
+
+ private final static ServiceDiscovery INSTANCE = new ServiceDiscovery();
+
+ private ServiceDiscoverer discoverer;
+ private Set<ClassLoader> registeredClassLoaders = new HashSet<ClassLoader>();
+
+ /**
+ * Get an instance of Service discovery, one instance is created per
+ * ClassLoader that this class is loaded from
+ *
+ * @return
+ */
+ public static ServiceDiscovery getInstance() {
+ return INSTANCE;
+ }
+
+ public ServiceDiscoverer getServiceDiscoverer() {
+ if (discoverer == null) {
+ discoverer = new ContextClassLoaderServiceDiscoverer();
+ }
+ return discoverer;
+ }
+
+ public void setServiceDiscoverer(ServiceDiscoverer sd) {
+ if (discoverer != null) {
+ throw new IllegalStateException("The ServiceDiscoverer cannot be reset");
+ }
+ discoverer = sd;
+ }
+
+ /**
+ * @deprecated
+ * Register a ClassLoader with this discovery mechanism. Tuscany extension
+ * ClassLoaders are registered here.
+ *
+ * @param classLoader
+ */
+ @Deprecated
+ public synchronized void registerClassLoader(ClassLoader classLoader) {
+ registeredClassLoaders.add(classLoader);
+ }
+
+ /**
+ * @deprecated
+ * Unregister a ClassLoader with this discovery mechanism.
+ *
+ * @param classLoader
+ */
+ @Deprecated
+ public synchronized void unregisterClassLoader(ClassLoader classLoader) {
+ registeredClassLoaders.remove(classLoader);
+ }
+
+ /**
+ * Get all service declarations for this name
+ *
+ * @param name
+ * @return set of service declarations
+ * @throws IOException
+ */
+ public Set<ServiceDeclaration> getServiceDeclarations(String name) throws IOException {
+ Set<ServiceDeclaration> services = getServiceDiscoverer().discover(name, false);
+ return services;
+ }
+
+ /**
+ * Get all service declarations for this interface
+ *
+ * @param serviceInterface
+ * @return set of service declarations
+ * @throws IOException
+ */
+ public Set<ServiceDeclaration> getServiceDeclarations(Class<?> serviceInterface) throws IOException {
+
+ return getServiceDeclarations(serviceInterface.getName());
+ }
+
+ /**
+ * Load one service implementation class for this interface
+ *
+ * @param serviceInterface
+ * @return service implementation class
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ public Class<?> loadFirstServiceClass(final Class<?> serviceInterface) throws IOException, ClassNotFoundException {
+ // Try System property first
+ String className = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty(serviceInterface.getName());
+ }
+ });
+ if (className != null) {
+ try {
+ // Try the classloader for the service interface first
+ return Class.forName(className, false, serviceInterface.getClassLoader());
+ } catch (ClassNotFoundException e) {
+ try {
+ // Try the thread context classloader
+ return Class.forName(className, false, Thread.currentThread().getContextClassLoader());
+ } catch (ClassNotFoundException ex) {
+ logger.log(Level.WARNING, ex.getMessage(), ex);
+ }
+ }
+ }
+ Set<ServiceDeclaration> services = getServiceDiscoverer().discover(serviceInterface.getName(), true);
+ if (services.isEmpty()) {
+ return null;
+ }
+ return services.iterator().next().loadClass();
+ }
+
+ /**
+ * Create a new instance of a factory service class.
+ *
+ * @param serviceInterface
+ * @return service implementation class
+ * @throws SecurityException
+ * @throws NoSuchMethodException
+ * @throws InvocationTargetException
+ * @throws IllegalAccessException
+ */
+ public Object newFactoryClassInstance(final Class<?> serviceInterface) throws SecurityException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ Method newInstanceMethod = serviceInterface.getMethod("newInstance");
+ Object factory = newInstanceMethod.invoke(null);
+ return factory;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint
new file mode 100644
index 0000000000..42bad63132
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.core.DefaultModuleActivatorExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.UtilityExtensionPoint b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.UtilityExtensionPoint
new file mode 100644
index 0000000000..d769bad283
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.UtilityExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.core.DefaultUtilityExtensionPoint
diff --git a/sca-java-1.x/branches/sca-android/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ContextClassLoaderServiceDiscovererTestCase.java b/sca-java-1.x/branches/sca-android/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ContextClassLoaderServiceDiscovererTestCase.java
new file mode 100644
index 0000000000..fd508402fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ContextClassLoaderServiceDiscovererTestCase.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.extensibility;
+
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test Case for ClasspathServiceDiscover
+ */
+public class ContextClassLoaderServiceDiscovererTestCase {
+ private static ContextClassLoaderServiceDiscoverer discover;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ discover = new ContextClassLoaderServiceDiscoverer();
+ }
+
+ @Test
+ public void testDiscovery() {
+ Set<ServiceDeclaration> discriptors =
+ discover.discover("org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint", false);
+ Assert.assertEquals(1, discriptors.size());
+ discriptors =
+ discover.discover("notthere", false);
+ Assert.assertEquals(0, discriptors.size());
+ }
+
+ @Test
+ public void testDiscoveryFirst() {
+ Set<ServiceDeclaration> discriptors =
+ discover.discover("org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint", true);
+ Assert.assertEquals(1, discriptors.size());
+ discriptors =
+ discover.discover("notthere", true);
+ Assert.assertEquals(0, discriptors.size());
+ }
+
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/LICENSE b/sca-java-1.x/branches/sca-android/modules/host-embedded/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/host-embedded/META-INF/README b/sca-java-1.x/branches/sca-android/modules/host-embedded/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/NOTICE b/sca-java-1.x/branches/sca-android/modules/host-embedded/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/host-embedded/pom.xml b/sca-java-1.x/branches/sca-android/modules/host-embedded/pom.xml
new file mode 100644
index 0000000000..92fd8cc016
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/pom.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <name>Apache Tuscany SCA Embedded Host</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-endpoint</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.host.embedded</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.host.embedded*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java
new file mode 100644
index 0000000000..a7f148cdda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java
@@ -0,0 +1,226 @@
+/*
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.reflect.Constructor;
+
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+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 {
+
+ static final String LOCAL_DOMAIN_URI = "http://localhost";
+
+ /**
+ * Static variable to hold the most recent instance of SCADomain
+ */
+ // TODO: Temporary support for SCADomain.connect() API
+ protected 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 serviceName);
+
+ /**
+ * 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();
+
+ Class<?> implClass = ServiceDiscovery.getInstance().loadFirstServiceClass(SCADomain.class);
+
+ if (implClass == 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
+ Constructor<?> constructor = null;
+ try {
+ constructor =
+ implClass.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 = implClass.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);
+ }
+ }
+
+ public ComponentManager getComponentManager() {
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java
new file mode 100644
index 0000000000..c9bfe499c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.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.host.embedded;
+
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+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() {
+ }
+
+ @Override
+ 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;
+ }
+ }
+
+ @Override
+ public ComponentManager getComponentManager() {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ return instance.getComponentManager();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java
new file mode 100644
index 0000000000..7c893a5c9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java
@@ -0,0 +1,291 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * 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 tccl = Thread.currentThread().getContextClassLoader();
+ classLoader = testClass.getClassLoader();
+ if (classLoader instanceof URLClassLoader) {
+ URL[] urls = ((URLClassLoader)classLoader).getURLs();
+ classLoader = new URLClassLoader(urls, classLoader.getParent());
+ } else if (classLoader == tccl || classLoader.getParent() == tccl) {
+ classLoader = new URLClassLoader(new URL[0], classLoader);
+ } else {
+ classLoader = tccl;
+ }
+
+ try {
+ // Thread.currentThread().setContextClassLoader(classLoader);
+ // Allow privileged access to set class loader. Requires RuntimePermission
+ // setContextClassLoader in security policy.
+ final ClassLoader finalClassLoader = classLoader;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(finalClassLoader);
+ return null;
+ }
+ });
+
+ testCaseClass = Class.forName(testClass.getName(), true, classLoader);
+ testCase = testCaseClass.newInstance();
+ ClassLoader testClassLoader = testCaseClass.getClassLoader();
+
+ junit3TestCaseClass = Class.forName("junit.framework.TestCase", true, testClassLoader);
+
+ testSuiteClass = Class.forName("junit.framework.TestSuite", true, testClassLoader);
+ Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class);
+ testSuite = testSuiteConstructor.newInstance(testCaseClass);
+
+ testResultClass = Class.forName("junit.framework.TestResult", true, testClassLoader);
+
+ try {
+ beforeAnnotation = Class.forName("org.junit.Before", true, testClassLoader);
+ afterAnnotation = Class.forName("org.junit.After", true, testClassLoader);
+ beforeClassAnnotation = Class.forName("org.junit.BeforeClass", true, testClassLoader);
+ afterClassAnnotation = Class.forName("org.junit.AfterClass", true, testClassLoader);
+ junit4AdapterClass = Class.forName("junit.framework.JUnit4TestAdapter", true, testClassLoader);
+ } catch (Exception e) {
+ // Unexpected
+ throw new AssertionError(e);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ } finally {
+ // Thread.currentThread().setContextClassLoader(tccl);
+ // Allow privileged access to set class loader. Requires RuntimePermission
+ // setContextClassLoader in security policy.
+ final ClassLoader finaltccl = tccl;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(finaltccl);
+ return null;
+ }
+ });
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Run the test case
+ */
+ public void run() {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ // Thread.currentThread().setContextClassLoader(classLoader);
+ // Allow privileged access to set class loader. Requires RuntimePermission
+ // setContextClassLoader in security policy.
+ final ClassLoader finalClassLoader = classLoader;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(finalClassLoader);
+ return null;
+ }
+ });
+
+ 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);
+ // Allow privileged access to set class loader. Requires RuntimePermission
+ // setContextClassLoader in security policy.
+ final ClassLoader finaltccl = tccl;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(finaltccl);
+ return null;
+ }
+ });
+ }
+ }
+
+ /**
+ * 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);
+ // Allow privileged access to set class loader. Requires RuntimePermission
+ // setContextClassLoader in security policy.
+ final ClassLoader finalClassLoader = classLoader;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(finalClassLoader);
+ return null;
+ }
+ });
+
+ 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);
+ // Allow privileged access to set class loader. Requires RuntimePermission
+ // setContextClassLoader in security policy.
+ final ClassLoader finaltccl = tccl;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(finaltccl);
+ return null;
+ }
+ });
+ }
+ }
+
+ /**
+ * Invoke the specified method
+ */
+ private void execute(String methodName) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ // Thread.currentThread().setContextClassLoader(classLoader);
+ // Allow privileged access to set class loader. Requires RuntimePermission
+ // setContextClassLoader in security policy.
+ final ClassLoader finalClassLoader = classLoader;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(finalClassLoader);
+ return null;
+ }
+ });
+ Method setUpMethod = testCaseClass.getDeclaredMethod(methodName);
+ setUpMethod.setAccessible(true);
+ setUpMethod.invoke(testCase);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ // Thread.currentThread().setContextClassLoader(tccl);
+ // Allow privileged access to set class loader. Requires RuntimePermission
+ // setContextClassLoader in security policy.
+ final ClassLoader finaltccl = tccl;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(finaltccl);
+ return null;
+ }
+ });
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java
new file mode 100644
index 0000000000..187f32f405
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.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.host.embedded.impl;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
+import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+
+/**
+ * Implementation of the ComponentManager.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentManagerImpl implements ComponentManager {
+
+ protected List<ComponentListener> listeners = new CopyOnWriteArrayList<ComponentListener>();
+ protected EmbeddedSCADomain domain;
+
+ public ComponentManagerImpl(EmbeddedSCADomain domain) {
+ this.domain = domain;
+ }
+
+ public void addComponentListener(ComponentListener listener) {
+ this.listeners.add(listener);
+ }
+
+ public void removeComponentListener(ComponentListener listener) {
+ this.listeners.remove(listener);
+ }
+
+ public Set<String> getComponentNames() {
+ Set<String> names = new HashSet<String>();
+ for (Composite composite: domain.getDomainComposite().getIncludes()) {
+ for (Component component: composite.getComponents()) {
+ names.add(component.getName());
+ }
+ }
+ return names;
+ }
+
+ public Component getComponent(String componentName) {
+ for (Composite composite: domain.getDomainComposite().getIncludes()) {
+ for (Component component: composite.getComponents()) {
+ if (component.getName().equals(componentName)) {
+ return component;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void startComponent(String componentName) throws ActivationException {
+ Component component = getComponent(componentName);
+ if (component == null) {
+ throw new IllegalArgumentException("no component: " + componentName);
+ }
+ domain.getCompositeActivator().start(component);
+ notifyComponentStarted(componentName);
+ }
+
+ public void stopComponent(String componentName) throws ActivationException {
+ Component component = getComponent(componentName);
+ if (component == null) {
+ throw new IllegalArgumentException("no component: " + componentName);
+ }
+ domain.getCompositeActivator().stop(component);
+ notifyComponentStopped(componentName);
+ }
+
+ public void notifyComponentStarted(String componentName) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStarted(componentName);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public void notifyComponentStopped(String componentName) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStopped(componentName);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public boolean isComponentStarted(String componentName) {
+ RuntimeComponentImpl runtimeComponent = (RuntimeComponentImpl)getComponent(componentName);
+ return runtimeComponent.isStarted();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
new file mode 100644
index 0000000000..1bca290c27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
@@ -0,0 +1,339 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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 java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * A default SCA domain facade implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultSCADomain extends SCADomain {
+
+ private String uri;
+ private String[] composites;
+ // private Composite domainComposite;
+ // private List<Contribution> contributions;
+ private Map<String, Component> components;
+ private ComponentManager componentManager;
+ // private ClassLoader runtimeClassLoader;
+ private ClassLoader applicationClassLoader;
+ private String domainURI;
+ private List<String> contributionURLs;
+
+ private CompositeActivator compositeActivator;
+ private SCANode node;
+ private SCAClient client;
+
+ /**
+ * 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.composites = composites;
+ // this.runtimeClassLoader = runtimeClassLoader;
+ this.applicationClassLoader = applicationClassLoader;
+ this.domainURI = domainURI;
+ this.contributionURLs = new ArrayList<String>();
+ if (contributionLocation != null && !"/".equals(contributionLocation)) {
+ this.contributionURLs.add(contributionLocation);
+ }
+ this.composites = composites;
+
+ init();
+
+ this.componentManager = new DefaultSCADomainComponentManager(this);
+
+ }
+
+ /**
+ * A hack to create an aggregated composite
+ * @param classLoader
+ * @param composites
+ * @return
+ */
+ private String createDeploymentComposite(ClassLoader classLoader, String composites[]) {
+ try {
+ StringBuffer xml =
+ new StringBuffer("<sca:composite xmlns:sca=\"http://www.osoa.org/xmlns/sca/1.0\"")
+ .append(" targetNamespace=\"http://tempuri.org\" name=\"aggregated\">\n");
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ for (int i = 0; i < composites.length; i++) {
+ URL url = classLoader.getResource(composites[i]);
+ if (url == null) {
+ continue;
+ }
+ String location = NodeImpl.getContributionURL(url, composites[i]).toString();
+ if (!contributionURLs.contains(location)) {
+ contributionURLs.add(location);
+ }
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ XMLStreamReader reader = factory.createXMLStreamReader(connection.getInputStream());
+ reader.nextTag();
+
+ assert Constants.COMPOSITE_QNAME.equals(reader.getName());
+ String ns = reader.getAttributeValue(null, "targetNamespace");
+ if (ns == null) {
+ ns = XMLConstants.NULL_NS_URI;
+ }
+ String name = reader.getAttributeValue(null, "name");
+ reader.close();
+ if (XMLConstants.NULL_NS_URI.equals(ns)) {
+ xml.append("<sca:include name=\"").append(name).append("\"/>\n");
+ } else {
+ xml.append("<sca:include xmlns:ns").append(i).append("=\"").append(ns).append("\"");
+ xml.append(" name=\"").append("ns").append(i).append(":").append(name).append("\"/>\n");
+ }
+ }
+ xml.append("</sca:composite>");
+ // System.out.println(xml.toString());
+ return xml.toString();
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public void init() {
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+
+ List<SCAContribution> contributions = new ArrayList<SCAContribution>();
+
+ if (composites != null && composites.length > 1) {
+ // Create an aggregated composite that includes all the composites as Node API only takes one composite
+ String content = createDeploymentComposite(applicationClassLoader, composites);
+ // Create SCA contributions
+ for (String location : contributionURLs) {
+ contributions.add(new SCAContribution(location, location));
+ }
+ node =
+ factory.createSCANode("http://tempuri.org/aggregated", content, contributions
+ .toArray(new SCAContribution[contributions.size()]));
+ } else {
+ for (String location : contributionURLs) {
+ contributions.add(new SCAContribution(location, location));
+ }
+ String composite = (composites != null && composites.length >= 1) ? composites[0] : null;
+ if (!contributions.isEmpty()) {
+ node =
+ factory.createSCANode(composite, contributions.toArray(new SCAContribution[contributions.size()]));
+ } else {
+ node = factory.createSCANodeFromClassLoader(composite, applicationClassLoader);
+ }
+ }
+ client = (SCAClient)node;
+ compositeActivator = ((NodeImpl)node).getCompositeActivator();
+ components = new HashMap<String, Component>();
+
+ node.start();
+
+ getComponents(compositeActivator.getDomainComposite());
+ }
+
+ private void getComponents(Composite composite) {
+ for (Component c : composite.getComponents()) {
+ components.put(c.getName(), c);
+ }
+ for (Composite cp : composite.getIncludes()) {
+ getComponents(cp);
+ }
+ }
+
+ @Override
+ public void close() {
+ super.close();
+ node.stop();
+
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)client.cast(target);
+ }
+
+ @Override
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return client.getService(businessInterface, serviceName);
+ }
+
+ @Override
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+ return client.getServiceReference(businessInterface, name);
+ }
+
+ @Override
+ public String getURI() {
+ return uri;
+ }
+
+ @Override
+ public ComponentManager getComponentManager() {
+ return componentManager;
+ }
+
+ public Set<String> getComponentNames() {
+ return components.keySet();
+ /*
+ Set<String> componentNames = new HashSet<String>();
+ for (Contribution contribution : contributions) {
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ for (Component component : ((Composite)artifact.getModel()).getComponents()) {
+ componentNames.add(component.getName());
+ }
+ }
+ }
+ }
+ return componentNames;
+ */
+ }
+
+ public Component getComponent(String componentName) {
+ return components.get(componentName);
+ /*
+ for (Contribution contribution : contributions) {
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ for (Component component : ((Composite)artifact.getModel()).getComponents()) {
+ if (component.getName().equals(componentName)) {
+ return component;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ */
+ }
+
+ public void startComponent(String componentName) throws ActivationException {
+ Component component = getComponent(componentName);
+ if (component == null) {
+ throw new IllegalArgumentException("no component: " + componentName);
+ }
+ compositeActivator.start(component);
+ }
+
+ public void stopComponent(String componentName) throws ActivationException {
+ Component component = getComponent(componentName);
+ if (component == null) {
+ throw new IllegalArgumentException("no component: " + componentName);
+ }
+ compositeActivator.stop(component);
+ }
+}
+
+class DefaultSCADomainComponentManager implements ComponentManager {
+
+ protected DefaultSCADomain scaDomain;
+ protected List<ComponentListener> listeners = new CopyOnWriteArrayList<ComponentListener>();
+
+ public DefaultSCADomainComponentManager(DefaultSCADomain scaDomain) {
+ this.scaDomain = scaDomain;
+ }
+
+ public void addComponentListener(ComponentListener listener) {
+ this.listeners.add(listener);
+ }
+
+ public void removeComponentListener(ComponentListener listener) {
+ this.listeners.remove(listener);
+ }
+
+ public Set<String> getComponentNames() {
+ return scaDomain.getComponentNames();
+ }
+
+ public Component getComponent(String componentName) {
+ return scaDomain.getComponent(componentName);
+ }
+
+ public void startComponent(String componentName) throws ActivationException {
+ scaDomain.startComponent(componentName);
+ }
+
+ public void stopComponent(String componentName) throws ActivationException {
+ scaDomain.stopComponent(componentName);
+ }
+
+ public void notifyComponentStarted(String componentName) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStarted(componentName);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public void notifyComponentStopped(String componentName) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStopped(componentName);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public boolean isComponentStarted(String componentName) {
+ RuntimeComponentImpl runtimeComponent = (RuntimeComponentImpl)getComponent(componentName);
+ return runtimeComponent.isStarted();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
new file mode 100644
index 0000000000..519e76d0ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.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.sca.host.embedded.impl;
+
+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.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.node.impl.RuntimeBootStrapper;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.CallableReference;
+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 RuntimeBootStrapper runtime;
+ private ComponentManagerImpl componentManager = new ComponentManagerImpl(this);
+
+ /**
+ * Constructs a new domain facade.
+ *
+ * @param runtimeClassLoader
+ * @param domainURI
+ */
+ public EmbeddedSCADomain(ClassLoader runtimeClassLoader,
+ String domainURI) {
+ this.uri = domainURI;
+
+ // Create a runtime
+ runtime = new RuntimeBootStrapper(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.SCA10_NS, "domain"));
+ domainComposite.setURI(uri);
+
+ getCompositeActivator().setDomainComposite(domainComposite);
+
+ }
+
+ public void stop() throws ActivationException {
+
+ // Stop the runtime
+ runtime.stop();
+
+ // Cleanup
+ domainComposite = null;
+ }
+
+ public void buildComposite(Composite composite) throws CompositeBuilderException {
+ runtime.buildComposite(composite);
+ }
+
+ public ContributionService getContributionService() {
+ return runtime.getContributionService();
+ }
+
+ public CompositeBuilder getCompositeBuilder() {
+ return runtime.getCompositeBuilder();
+ }
+
+ public CompositeActivator getCompositeActivator() {
+ return runtime.getCompositeActivator();
+ }
+
+ public Composite getDomainComposite() {
+ return domainComposite;
+ }
+
+ @Override
+ public ComponentManager getComponentManager() {
+ return componentManager;
+ }
+
+ @Override
+ public void close() {
+ super.close();
+ }
+
+ @Override
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)runtime.getProxyFactory().cast(target);
+ }
+
+ @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();
+ }
+
+ private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
+ try {
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default"));
+ RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
+ component.setName("default");
+ component.setURI("default");
+ runtime.getCompositeActivator().configureComponentContext(component);
+ composite.getComponents().add(component);
+ RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
+ reference.setName("default");
+ ModelFactoryExtensionPoint factories =
+ runtime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+ InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+ reference.setInterfaceContract(interfaceContract);
+ component.getReferences().add(reference);
+ reference.setComponent(component);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ SCABinding binding = scaBindingFactory.createSCABinding();
+ binding.setURI(targetURI);
+ reference.getBindings().add(binding);
+ return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, runtime
+ .getProxyFactory(), runtime.getCompositeActivator());
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+ @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 = componentManager.getComponent(componentName);
+ if (component == null) {
+ // The component is not local in the partition, try to create a remote service ref
+ return createServiceReference(businessInterface, name);
+ }
+ RuntimeComponentContext 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) {
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ if (serviceName != null) {
+ serviceName = "$promoted$" + component.getName() + "$slash$" + serviceName;
+ }
+ componentContext =
+ ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
+ return componentContext.createSelfReference(businessInterface, compositeService
+ .getPromotedService());
+ }
+ break;
+ }
+ }
+ // No matching service is found
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ } else {
+ componentContext = ((RuntimeComponent)component).getComponentContext();
+ if (serviceName != null) {
+ return componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ return componentContext.createSelfReference(businessInterface);
+ }
+ }
+
+ }
+
+ @Override
+ public String getURI() {
+ return uri;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java
new file mode 100644
index 0000000000..d59f1544e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java
@@ -0,0 +1,389 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * An SCADomain that starts a Tuscany runtime supporting multiple
+ * SCA contribution jars. All contribution jars found in a repository
+ * directory will be contributed to the SCA domain. Any changes to the
+ * contributions in that repository will be automatically detected and
+ * the SCADomain updated accordingly.
+ *
+ * TODO: find how to properly add/remove contributions and start/activate the SCADomain
+ * TODO: support contributions that are folders as well as jar's
+ * TODO: needs to restart the entire SCADomain when a contribution changes
+ * as the domain classpath includes all the contribution jar's, would
+ * be nice to find a way to avoid this
+ * TODO: hot update requires copying contribution jars to a temp location
+ * to avoid the classpath lock preventing updating the contribution
+ * jars, would be nice to find a way to avoid that
+ *
+ * @version $Rev$ $Date$
+ */
+public class HotUpdatableSCADomain extends SCADomain {
+ private static final Logger logger = Logger.getLogger(HotUpdatableSCADomain.class.getName());
+ protected String domainURI;
+ protected File contributionRepository;
+
+ protected EmbeddedSCADomain scaDomain;
+
+ protected boolean hotUpdateActive;
+ protected Thread hotUpdateThread;
+ protected int hotUpdateInterval; // milliseconds, 0 = hotupdate disabled
+
+ protected HashMap<URL, Long> existingContributions; // value is last modified time
+ protected ClassLoader originalCCL;
+
+ protected static final String REPOSITORY_FOLDER = "sca-contributions";
+
+ public HotUpdatableSCADomain(String domainURI, File contributionRepository, int hotupdateInterval) {
+ this.domainURI = domainURI;
+ this.contributionRepository = contributionRepository;
+ this.hotUpdateInterval = hotupdateInterval;
+ this.originalCCL = Thread.currentThread().getContextClassLoader();
+ start();
+ }
+
+ protected void start() {
+ try {
+ initEmbeddedSCADomain();
+ activateHotUpdate();
+ for (URL url : existingContributions.keySet()) {
+ File f = new File(url.toURI());
+ logger.info("added contribution: " + f.getName());
+ }
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ } catch (URISyntaxException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Override
+ public void close() {
+ try {
+ hotUpdateActive = false;
+ scaDomain.stop();
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ Thread.currentThread().setContextClassLoader(originalCCL);
+ super.close();
+ }
+
+
+ protected SCADomain initEmbeddedSCADomain() throws ActivationException {
+
+ URL[] contributionJars = getContributionJarURLs(contributionRepository);
+
+ this.existingContributions = getLastModified(contributionJars);
+
+ if (hotUpdateInterval > 0) {
+ contributionJars = copyContributionsToTemp(contributionJars);
+ }
+
+ // Using the CCL as the parent exposes Tuscany to the contributions, want to do this?
+ URLClassLoader cl = new URLClassLoader(contributionJars, originalCCL);
+ Thread.currentThread().setContextClassLoader(cl);
+
+ scaDomain = new EmbeddedSCADomain(cl, domainURI);
+
+ scaDomain.start();
+
+ initContributions(scaDomain, cl, contributionJars);
+
+ return scaDomain;
+ }
+
+ protected URL[] getContributionJarURLs(File repositoryDir) {
+
+ String[] jars = repositoryDir.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }});
+
+ List<URL> contributionJars = new ArrayList<URL>();
+ if (jars != null) {
+ for (String jar : jars) {
+ try {
+ contributionJars.add(new File(repositoryDir, jar).toURL());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ return contributionJars.toArray(new URL[contributionJars.size()]);
+ }
+
+ /**
+ * TODO: No idea what the 'correct' way to add/contribute and activate/start things to an scaDomain is
+ * but this seems to work. Doesn't seem to start <service>s or <reference>s which are outside of
+ * a <component> so something is missing/wrong. Also this doesn't seem to be picking up composites
+ * located in META-INF/deployables or specified in the sca-deployables.xml. Maybe the EmbeddedSCADomain
+ * and ContributionService APIs should make all this easier?
+ */
+ protected void initContributions(EmbeddedSCADomain scaDomain, ClassLoader cl, URL[] contributionJars) {
+ Contribution contribution = null;
+ ContributionService contributionService = scaDomain.getContributionService();
+ for (URL jar : contributionJars) {
+ InputStream is = null;
+ try {
+ is = jar.openStream();
+ contribution = contributionService.contribute(jar.toString(), jar, is);
+ } catch (Exception e) {
+ System.err.println("exception adding contribution: " + jar);
+ e.printStackTrace();
+ }
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ if (contribution != null ) {
+ try {
+
+ for (Composite composite : contribution.getDeployables()) {
+ scaDomain.getDomainComposite().getIncludes().add(composite);
+ scaDomain.getCompositeBuilder().build(composite);
+ scaDomain.getCompositeActivator().activate(composite);
+ }
+
+ for (Composite composite : contribution.getDeployables()) {
+ scaDomain.getCompositeActivator().start(composite);
+ }
+
+ } catch (ActivationException e) {
+ throw new RuntimeException(e);
+ } catch (CompositeBuilderException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+ /**
+ * Copies Files to a temp location returning the URLs of the new temp files.
+ * For hot update to work need to be able to delete/update the contribution jar's
+ * but as they're in the classpath the URLClassLoader has an open lock on the jar's
+ * so you can't update them. This solution copies each contribution to a temp
+ * location for use on the classpath, nicer would be a ClassLoder impl that doesn't
+ * lock the jar's.
+ */
+ protected URL[] copyContributionsToTemp(URL[] contributionJars) {
+ try {
+
+ URL[] newURLs = new URL[contributionJars.length];
+ File tempDir = new File(System.getProperty("java.io.tmpdir"));
+ for (int i=0; i<contributionJars.length; i++) {
+ File fin = new File(contributionJars[i].toURI());
+ File fout = File.createTempFile("tuscany", fin.getName(), tempDir);
+ fout.deleteOnExit();
+ FileHelper.copyFile(fin, fout);
+ fout.setLastModified(System.currentTimeMillis());
+ newURLs[i] = fout.toURL();
+ }
+ return newURLs;
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns the last modified times of the files pointed to by the URLs
+ */
+ protected HashMap<URL, Long> getLastModified(URL[] contrabutions) {
+ try {
+
+ HashMap<URL, Long> contributionLastUpdates = new HashMap<URL, Long>();
+ for (URL url: contrabutions) {
+ File f = new File(url.toURI());
+ contributionLastUpdates.put(url, new Long(f.lastModified()));
+ }
+ return contributionLastUpdates;
+
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void activateHotUpdate() {
+ if (hotUpdateInterval == 0) {
+ return; // hotUpdateInterval of 0 disables hotupdate
+ }
+
+ Runnable runable = new Runnable() {
+ public void run() {
+ logger.info("Tuscany contribution hotupdate running");
+ while (hotUpdateActive) {
+ try {
+ Thread.sleep(hotUpdateInterval);
+ } catch (InterruptedException e) {
+ }
+ if (hotUpdateActive) {
+ checkForUpdates();
+ }
+ }
+ logger.info("Tuscany contribution hotupdate stopped");
+ }
+ };
+ hotUpdateThread = new Thread(runable, "TuscanyHotUpdate");
+ hotUpdateActive = true;
+ hotUpdateThread.start();
+ }
+
+
+ /**
+ * Checks if any of the contributions have been updated and if so restarts the SCADomain
+ * TODO: Ideally just the altered contribution would be restarted but thats not possible
+ * as the ClassLoader used by the SCADomain includes the old contribution so need
+ * to restart the entire domain to use a new ClassLoader. Should there be separate
+ * ClassLoader per contribution? But then have all the issues with sharing classes
+ * across contributions.
+ */
+ protected void checkForUpdates() {
+ URL[] currentContributions = getContributionJarURLs(contributionRepository);
+
+ if (areContributionsAltered(currentContributions)) {
+ try {
+ scaDomain.stop();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ try {
+ initEmbeddedSCADomain();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected boolean areContributionsAltered(URL[] currentContrabutions) {
+ try {
+
+ List addedContributions = getAddedContributions(currentContrabutions);
+ List removedContributions = getRemovedContributions(currentContrabutions);
+ List updatedContributions = getUpdatedContributions(currentContrabutions);
+
+ return (addedContributions.size() > 0 || removedContributions.size() > 0 || updatedContributions.size() > 0);
+
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected List<URL> getUpdatedContributions(URL[] currentContrabutions) throws URISyntaxException {
+ List<URL> urls = new ArrayList<URL>();
+ for (URL url : currentContrabutions) {
+ if (existingContributions.containsKey(url)) {
+ File curentFile = new File(url.toURI());
+ if (curentFile.lastModified() != existingContributions.get(url)) {
+ urls.add(url);
+ logger.info("updated contribution: " + curentFile.getName());
+ }
+ }
+ }
+ return urls;
+ }
+
+ protected List getRemovedContributions(URL[] currentContrabutions) throws URISyntaxException {
+ List<URL> currentUrls = Arrays.asList(currentContrabutions);
+ List<URL> urls = new ArrayList<URL>();
+ for (URL url : existingContributions.keySet()) {
+ if (!currentUrls.contains(url)) {
+ urls.add(url);
+ }
+ }
+ for (URL url : urls) {
+ logger.info("removed contributions: " + new File(url.toURI()).getName());
+ }
+ return urls;
+ }
+
+ protected List getAddedContributions(URL[] currentContrabutions) throws URISyntaxException {
+ List<URL> urls = new ArrayList<URL>();
+ for (URL url : currentContrabutions) {
+ if (!existingContributions.containsKey(url)) {
+ urls.add(url);
+ logger.info("added contribution: " + new File(url.toURI()).getName());
+ }
+ }
+ return urls;
+ }
+
+ @Override
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ throw new UnsupportedOperationException("not implemented");
+ }
+
+ @Override
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return scaDomain.getService(businessInterface, serviceName);
+ }
+
+ @Override
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ return scaDomain.getServiceReference(businessInterface, referenceName);
+ }
+
+ @Override
+ public String getURI() {
+ return domainURI;
+ }
+
+ @Override
+ public ComponentManager getComponentManager(){
+ return scaDomain.getComponentManager();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
new file mode 100644
index 0000000000..55b6afb6f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
@@ -0,0 +1,385 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
+import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
+import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
+import org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReallySmallRuntime {
+ private static final Logger logger = Logger.getLogger(ReallySmallRuntime.class.getName());
+ private List<ModuleActivator> modules;
+ private ExtensionPointRegistry registry;
+
+ private ClassLoader classLoader;
+ private AssemblyFactory assemblyFactory;
+ private ContributionService contributionService;
+ private CompositeActivator compositeActivator;
+ private CompositeBuilder compositeBuilder;
+ // private DomainBuilder domainBuilder;
+ private WorkScheduler workScheduler;
+ private ScopeRegistry scopeRegistry;
+ private ProxyFactory proxyFactory;
+ private List<SCADefinitions> policyDefinitions;
+ private ModelResolver policyDefinitionsResolver;
+ private Monitor monitor;
+
+ public ReallySmallRuntime(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ public void start() throws ActivationException {
+ long start = System.currentTimeMillis();
+
+ // Create our extension point registry
+ registry = new DefaultExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+
+ // Get work scheduler
+ workScheduler = utilities.getUtility(WorkScheduler.class);
+
+ // Create an interface contract mapper
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+
+ // Get factory extension point
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ // Get Message factory
+ MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
+
+ // Get proxy factory
+ ProxyFactoryExtensionPoint proxyFactories = registry.getExtensionPoint(ProxyFactoryExtensionPoint.class);
+ proxyFactory = new ExtensibleProxyFactory(proxyFactories);
+
+ // Create model factories
+ assemblyFactory = new RuntimeAssemblyFactory();
+ factories.addFactory(assemblyFactory);
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+
+ // Load the runtime modules
+ modules = loadModules(registry);
+
+ // Start the runtime modules
+ startModules(registry, modules);
+
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory = new DefaultIntentAttachPointTypeFactory();
+ factories.addFactory(intentAttachPointTypeFactory);
+ ContributionFactory contributionFactory = factories.getFactory(ContributionFactory.class);
+
+ // Create a monitor
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+
+ if (monitorFactory != null){
+ monitor = monitorFactory.createMonitor();
+ } else {
+ monitorFactory = new DefaultMonitorFactoryImpl();
+ monitor = monitorFactory.createMonitor();
+ utilities.addUtility(monitorFactory);
+ //logger.fine("No MonitorFactory is found on the classpath.");
+ }
+
+ // Create a contribution service
+ policyDefinitions = new ArrayList<SCADefinitions>();
+ policyDefinitionsResolver = new DefaultModelResolver();
+ contributionService = ReallySmallRuntimeBuilder.createContributionService(classLoader,
+ registry,
+ contributionFactory,
+ assemblyFactory,
+ policyFactory,
+ mapper,
+ policyDefinitions,
+ policyDefinitionsResolver,
+ monitor);
+
+ // Create the ScopeRegistry
+ scopeRegistry = ReallySmallRuntimeBuilder.createScopeRegistry(registry);
+
+ // Create a composite activator
+ compositeActivator = ReallySmallRuntimeBuilder.createCompositeActivator(registry,
+ assemblyFactory,
+ messageFactory,
+ scaBindingFactory,
+ mapper,
+ proxyFactory,
+ scopeRegistry,
+ workScheduler);
+
+ // Load the definitions.xml
+ loadSCADefinitions();
+
+ if (logger.isLoggable(Level.FINE)) {
+ long end = System.currentTimeMillis();
+ logger.fine("The tuscany runtime is started in " + (end - start) + " ms.");
+ }
+ }
+
+ public void stop() throws ActivationException {
+ long start = System.currentTimeMillis();
+
+ // Stop the runtime modules
+ stopModules(registry, modules);
+
+ // Stop and destroy the work manager
+ workScheduler.destroy();
+
+ // Cleanup
+ modules = null;
+ registry = null;
+ assemblyFactory = null;
+ contributionService = null;
+ compositeActivator = null;
+ workScheduler = null;
+ scopeRegistry = null;
+
+ if (logger.isLoggable(Level.FINE)) {
+ long end = System.currentTimeMillis();
+ logger.fine("The tuscany runtime is stopped in " + (end - start) + " ms.");
+ }
+ }
+
+ public void buildComposite(Composite composite) throws CompositeBuilderException {
+ //Get factory extension point
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory = factories.getFactory(IntentAttachPointTypeFactory.class);
+ EndpointFactory endpointFactory = factories.getFactory(EndpointFactory.class);
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+ DocumentBuilderFactory documentBuilderFactory = factories.getFactory(DocumentBuilderFactory.class);
+ TransformerFactory transformerFactory = factories.getFactory(TransformerFactory.class);
+
+ //Create a composite builder
+ SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
+ for ( SCADefinitions definition : ((List<SCADefinitions>)policyDefinitions) ) {
+ SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
+ }
+ compositeBuilder = ReallySmallRuntimeBuilder.createCompositeBuilder(monitor,
+ assemblyFactory,
+ scaBindingFactory,
+ endpointFactory,
+ intentAttachPointTypeFactory,
+ documentBuilderFactory,
+ transformerFactory,
+ mapper,
+ aggregatedDefinitions);
+ compositeBuilder.build(composite);
+
+ }
+
+ public ContributionService getContributionService() {
+ return contributionService;
+ }
+
+ public CompositeActivator getCompositeActivator() {
+ return compositeActivator;
+ }
+
+ public CompositeBuilder getCompositeBuilder() {
+ return compositeBuilder;
+ }
+
+ public AssemblyFactory getAssemblyFactory() {
+ return assemblyFactory;
+ }
+
+ private void loadSCADefinitions() throws ActivationException {
+ try {
+ URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ URLArtifactProcessor<SCADefinitions> definitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
+ SCADefinitionsProviderExtensionPoint scaDefnProviders = registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);
+
+ SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
+ SCADefinitions aSCADefn = null;
+ for ( SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders() ) {
+ aSCADefn = aProvider.getSCADefinition();
+ SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
+ }
+
+ policyDefinitions.add(systemSCADefinitions);
+
+ //we cannot expect that providers will add the intents and policysets into the resolver
+ //so we do this here explicitly
+ for ( Intent intent : systemSCADefinitions.getPolicyIntents() ) {
+ policyDefinitionsResolver.addModel(intent);
+ }
+
+ for ( PolicySet policySet : systemSCADefinitions.getPolicySets() ) {
+ policyDefinitionsResolver.addModel(policySet);
+ }
+
+ for ( IntentAttachPointType attachPoinType : systemSCADefinitions.getBindingTypes() ) {
+ policyDefinitionsResolver.addModel(attachPoinType);
+ }
+
+ for ( IntentAttachPointType attachPoinType : systemSCADefinitions.getImplementationTypes() ) {
+ policyDefinitionsResolver.addModel(attachPoinType);
+ }
+
+ //now that all system sca definitions have been read, lets resolve them right away
+ definitionsProcessor.resolve(systemSCADefinitions,
+ policyDefinitionsResolver);
+ } catch ( Exception e ) {
+ throw new ActivationException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<ModuleActivator> loadModules(ExtensionPointRegistry registry) throws ActivationException {
+
+ // Load and instantiate the modules found on the classpath (or any registered ClassLoaders)
+ modules = new ArrayList<ModuleActivator>();
+ try {
+ Set<ServiceDeclaration> moduleActivators =
+ ServiceDiscovery.getInstance().getServiceDeclarations(ModuleActivator.class);
+ Set<String> moduleClasses = new HashSet<String>();
+ for (ServiceDeclaration moduleDeclarator : moduleActivators) {
+ if (moduleClasses.contains(moduleDeclarator.getClassName())) {
+ continue;
+ }
+ moduleClasses.add(moduleDeclarator.getClassName());
+ Class<?> moduleClass = moduleDeclarator.loadClass();
+ ModuleActivator module = (ModuleActivator)moduleClass.newInstance();
+ modules.add(module);
+ }
+ } catch (IOException e) {
+ throw new ActivationException(e);
+ } catch (ClassNotFoundException e) {
+ throw new ActivationException(e);
+ } catch (InstantiationException e) {
+ throw new ActivationException(e);
+ } catch (IllegalAccessException e) {
+ throw new ActivationException(e);
+ }
+
+ return modules;
+ }
+
+ private void startModules(ExtensionPointRegistry registry, List<ModuleActivator> modules)
+ throws ActivationException {
+ boolean debug = logger.isLoggable(Level.FINE);
+ // Start all the extension modules
+ for (ModuleActivator module : modules) {
+ long start = 0L;
+ if (debug) {
+ logger.fine(module.getClass().getName() + " is starting.");
+ start = System.currentTimeMillis();
+ }
+ try {
+ module.start(registry);
+ if (debug) {
+ long end = System.currentTimeMillis();
+ logger.fine(module.getClass().getName() + " is started in " + (end - start) + " ms.");
+ }
+ } catch (Throwable e) {
+ logger.log(Level.WARNING, "Exception starting module " + module.getClass().getName() + " :" + e.getMessage());
+ logger.log(Level.FINE, "Exception starting module " + module.getClass().getName(), e);
+ }
+ }
+ }
+
+ private void stopModules(final ExtensionPointRegistry registry, List<ModuleActivator> modules) {
+ boolean debug = logger.isLoggable(Level.FINE);
+ for (ModuleActivator module : modules) {
+ long start = 0L;
+ if (debug) {
+ logger.fine(module.getClass().getName() + " is stopping.");
+ start = System.currentTimeMillis();
+ }
+ module.stop(registry);
+ if (debug) {
+ long end = System.currentTimeMillis();
+ logger.fine(module.getClass().getName() + " is stopped in " + (end - start) + " ms.");
+ }
+ }
+ }
+
+ /**
+ * @return the proxyFactory
+ */
+ public ProxyFactory getProxyFactory() {
+ return proxyFactory;
+ }
+
+ /**
+ * @return the registry
+ */
+ public ExtensionPointRegistry getExtensionPointRegistry() {
+ return registry;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
new file mode 100644
index 0000000000..738e5e6248
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
+import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultValidationSchemaExtensionPoint;
+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.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+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.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.CompositeScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ConversationalScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.RequestScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.core.scope.ScopeRegistryImpl;
+import org.apache.tuscany.sca.core.scope.StatelessScopeContainerFactory;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReallySmallRuntimeBuilder {
+
+ // private static final Logger logger = Logger.getLogger(ReallySmallRuntimeBuilder.class.getName());
+
+ public static CompositeActivator createCompositeActivator(ExtensionPointRegistry registry,
+ AssemblyFactory assemblyFactory,
+ MessageFactory messageFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper mapper,
+ ProxyFactory proxyFactory,
+ ScopeRegistry scopeRegistry,
+ WorkScheduler workScheduler) {
+
+ // Create a wire post processor extension point
+ RuntimeWireProcessorExtensionPoint wireProcessors =
+ registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+ RuntimeWireProcessor wireProcessor = new ExtensibleWireProcessor(wireProcessors);
+
+ // Retrieve the processors extension point
+ StAXArtifactProcessorExtensionPoint processors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ // Create a provider factory extension point
+ ProviderFactoryExtensionPoint providerFactories =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+
+ // Create a endpoint resolver factory extension point
+ EndpointResolverFactoryExtensionPoint endpointResolverFactories =
+ registry.getExtensionPoint(EndpointResolverFactoryExtensionPoint.class);
+
+ JavaInterfaceFactory javaInterfaceFactory =
+ registry.getExtensionPoint(ModelFactoryExtensionPoint.class).getFactory(JavaInterfaceFactory.class);
+ RequestContextFactory requestContextFactory =
+ registry.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class);
+
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ ConversationManager conversationManager = utilities.getUtility(ConversationManager.class);
+
+ // Create the composite activator
+ CompositeActivator compositeActivator =
+ new CompositeActivatorImpl(assemblyFactory, messageFactory, javaInterfaceFactory, scaBindingFactory,
+ mapper, scopeRegistry, workScheduler, wireProcessor, requestContextFactory,
+ proxyFactory, providerFactories, endpointResolverFactories, processors, conversationManager);
+
+ return compositeActivator;
+ }
+
+ public static CompositeBuilder createCompositeBuilder(Monitor monitor,
+ AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ EndpointFactory endpointFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions) {
+
+
+ return new CompositeBuilderImpl(assemblyFactory,
+ endpointFactory,
+ scaBindingFactory,
+ intentAttachPointTypeFactory,
+ documentBuilderFactory,
+ transformerFactory,
+ interfaceContractMapper,
+ policyDefinitions,
+ monitor);
+ }
+
+
+ /**
+ * Create the contribution service used by this domain.
+ *
+ * @throws ActivationException
+ */
+ public static ContributionService createContributionService(ClassLoader classLoader,
+ ExtensionPointRegistry registry,
+ ContributionFactory contributionFactory,
+ AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ InterfaceContractMapper mapper,
+ List<SCADefinitions> policyDefinitions,
+ ModelResolver policyDefinitionResolver,
+ Monitor monitor)
+ throws ActivationException {
+
+ // Get the model factory extension point
+ ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ // Create a new XML input factory
+ // Allow privileged access to factory. Requires RuntimePermission in security policy file.
+ XMLInputFactory inputFactory = AccessController.doPrivileged(new PrivilegedAction<XMLInputFactory>() {
+ public XMLInputFactory run() {
+ return XMLInputFactory.newInstance();
+ }
+ });
+ modelFactories.addFactory(inputFactory);
+
+ // Create a validation XML schema extension point
+ ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
+
+ // Create a validating XML input factory
+ XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, monitor);
+ modelFactories.addFactory(validatingInputFactory);
+
+ // Create StAX artifact processor extension point
+ StAXArtifactProcessorExtensionPoint staxProcessors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ // Create and register StAX processors for SCA assembly XML
+ // Allow privileged access to factory. Requires RuntimePermission in security policy file.
+ XMLOutputFactory outputFactory = AccessController.doPrivileged(new PrivilegedAction<XMLOutputFactory>() {
+ public XMLOutputFactory run() {
+ return XMLOutputFactory.newInstance();
+ }
+ });
+ ExtensibleStAXArtifactProcessor staxProcessor =
+ new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
+
+ // Create URL artifact processor extension point
+ URLArtifactProcessorExtensionPoint documentProcessors =
+ registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+
+ // Create and register document processors for SCA assembly XML
+ documentProcessors.getProcessor(Composite.class);
+ DocumentBuilderFactory documentBuilderFactory = AccessController.doPrivileged(new PrivilegedAction<DocumentBuilderFactory>() {
+ public DocumentBuilderFactory run() {
+ return DocumentBuilderFactory.newInstance();
+ }
+ });
+ documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, documentBuilderFactory, policyDefinitions, monitor));
+
+ // Create Model Resolver extension point
+ ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
+
+ // Create contribution package processor extension point
+ TypeDescriber describer = new PackageTypeDescriberImpl();
+ PackageProcessor packageProcessor =
+ new ExtensiblePackageProcessor(registry.getExtensionPoint(PackageProcessorExtensionPoint.class), describer, monitor);
+
+ // Create contribution listener
+ ExtensibleContributionListener contributionListener =
+ new ExtensibleContributionListener(registry.getExtensionPoint(ContributionListenerExtensionPoint.class));
+
+ // Create a contribution repository
+ ContributionRepository repository;
+ try {
+ repository = new ContributionRepositoryImpl("target", inputFactory, monitor);
+ } catch (IOException e) {
+ throw new ActivationException(e);
+ }
+
+ ExtensibleURLArtifactProcessor documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, monitor);
+
+ // Create the contribution service
+ ContributionService contributionService =
+ new ContributionServiceImpl(repository, packageProcessor, documentProcessor, staxProcessor,
+ contributionListener, policyDefinitionResolver, modelResolvers, modelFactories,
+ assemblyFactory, contributionFactory, inputFactory, policyDefinitions, monitor);
+ return contributionService;
+ }
+
+ public static ScopeRegistry createScopeRegistry(ExtensionPointRegistry registry) {
+ ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
+ ScopeContainerFactory[] factories =
+ new ScopeContainerFactory[] {new CompositeScopeContainerFactory(), new StatelessScopeContainerFactory(),
+ new RequestScopeContainerFactory(),
+ new ConversationalScopeContainerFactory(null),
+ // new HttpSessionScopeContainer(monitor)
+ };
+ for (ScopeContainerFactory f : factories) {
+ scopeRegistry.register(f);
+ }
+
+ //FIXME Pass the scope container differently as it's not an extension point
+ registry.addExtensionPoint(scopeRegistry);
+
+ return scopeRegistry;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java
new file mode 100644
index 0000000000..5f38c0c063
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.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.host.embedded.management;
+
+import java.util.EventListener;
+
+/**
+ * Component Listener interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentListener extends EventListener {
+
+ void componentStarted(String componentName);
+ void componentStopped(String componentName);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java
new file mode 100644
index 0000000000..4acb270810
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.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.host.embedded.management;
+
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+
+/**
+ * Component Manager interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentManager {
+
+ Set<String> getComponentNames();
+
+ Component getComponent(String componentName);
+
+ boolean isComponentStarted(String componentName);
+
+ void startComponent(String componentName) throws ActivationException;
+
+ void stopComponent(String componentName) throws ActivationException;
+
+ void addComponentListener(ComponentListener listener);
+
+ void removeComponentListener(ComponentListener listener);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java
new file mode 100644
index 0000000000..9252b114a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.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.host.embedded;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+import org.osoa.sca.ServiceReference;
+
+
+
+/**
+ * Test creation of an SCADomainBean and invocation of a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADomainBeanTestCase extends TestCase {
+
+ private SCADomainBean domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = new SCADomainBean();
+ domain.setDeployableComposites("test.composite");
+ }
+
+ public void testInvoke() throws Exception {
+ ServiceReference<TestService> serviceReference = domain.getServiceReference(TestService.class, "TestServiceComponent");
+ assertNotNull(serviceReference);
+ TestService service = serviceReference.getService();
+ String result = service.ping("Bob");
+ assertEquals("Hello Bob", result);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java
new file mode 100644
index 0000000000..c52c16d8e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.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.host.embedded;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+import org.osoa.sca.ServiceReference;
+
+
+
+/**
+ * Test SCADomain.newInstance and invocation of a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADomainTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("test.composite");
+ }
+
+ public void testInvoke() throws Exception {
+ ServiceReference<TestService> serviceReference = domain.getServiceReference(TestService.class, "TestServiceComponent");
+ assertNotNull(serviceReference);
+ TestService service = serviceReference.getService();
+ String result = service.ping("Bob");
+ assertEquals("Hello Bob", result);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java
new file mode 100644
index 0000000000..fd5398c8e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.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.host.embedded.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+
+
+/**
+ * Test creation of DefaultSCADomain.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultSCADomainTestCase extends TestCase {
+ private DefaultSCADomain domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = new DefaultSCADomain(getClass().getClassLoader(), getClass().getClassLoader(),
+ "http://localhost", "./target/test-classes", "test.composite");
+ }
+
+ public void testStart() throws Exception {
+ TestService service = domain.getService(TestService.class, "TestServiceComponent");
+ assertNotNull(service);
+ }
+
+ public void testComponentManager() throws Exception {
+ ComponentManager componentManager = domain.getComponentManager();
+ assertEquals(1, componentManager.getComponentNames().size());
+ assertEquals("TestServiceComponent", componentManager.getComponentNames().iterator().next());
+ assertNotNull(componentManager.getComponent("TestServiceComponent"));
+
+ assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
+ componentManager.stopComponent("TestServiceComponent");
+ assertFalse(componentManager.isComponentStarted("TestServiceComponent"));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java
new file mode 100644
index 0000000000..2a59635a19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.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.host.embedded.impl;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+
+/**
+ * Test creation of an EmbeddedSCADomain and invocation of a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EmbeddedSCADomainTestCase extends TestCase {
+ private EmbeddedSCADomain domain;
+
+ @Override
+ 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://test", "test"));
+
+ // Add the deployable composite to the domain
+ domain.getDomainComposite().getIncludes().add(myComposite);
+
+
+ domain.buildComposite(myComposite);
+
+ // Start the composite
+ domain.getCompositeActivator().activate(myComposite);
+ domain.getCompositeActivator().start(myComposite);
+
+ // At this point the domain contains my contribution, my composite and
+ // it's started, my application code can start using it
+
+ // Get the TestServiceComponent service
+ TestService service = domain.getService(TestService.class, "TestServiceComponent");
+
+ // Invoke the service
+ String result = service.ping("Bob");
+ assertEquals("Hello Bob", result);
+
+ // Stop my composite
+ domain.getCompositeActivator().stop(myComposite);
+ domain.getCompositeActivator().deactivate(myComposite);
+
+ // Remove my composite
+ domain.getDomainComposite().getIncludes().remove(myComposite);
+
+ // Remove my contribution
+ contributionService.remove("http://test/contribution");
+
+ // Stop the domain
+ domain.stop();
+ }
+
+ public void testComponentManager() 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://test", "test"));
+
+ // Add the deployable composite to the domain
+ domain.getDomainComposite().getIncludes().add(myComposite);
+
+ domain.buildComposite(myComposite);
+
+ // Start the composite
+ domain.getCompositeActivator().activate(myComposite);
+ domain.getCompositeActivator().start(myComposite);
+
+ // At this point the domain contains my contribution, my composite and
+ // it's started, my application code can start using it
+
+ ComponentManager componentManager = domain.getComponentManager();
+ assertEquals(1, componentManager.getComponentNames().size());
+ assertEquals("TestServiceComponent", componentManager.getComponentNames().iterator().next());
+
+ Component component = componentManager.getComponent("TestServiceComponent");
+ assertNotNull(component);
+ assertEquals("TestServiceComponent", component.getName());
+
+ MyComponentListener cl = new MyComponentListener();
+ componentManager.addComponentListener(cl);
+
+ assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
+
+ assertFalse(cl.stopCalled);
+ componentManager.stopComponent("TestServiceComponent");
+ assertTrue(cl.stopCalled);
+ assertFalse(componentManager.isComponentStarted("TestServiceComponent"));
+
+ assertFalse(cl.startCalled);
+ componentManager.startComponent("TestServiceComponent");
+ assertTrue(cl.startCalled);
+ assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
+
+ // Stop my composite
+ domain.getCompositeActivator().stop(myComposite);
+ domain.getCompositeActivator().deactivate(myComposite);
+
+ // Remove my composite
+ domain.getDomainComposite().getIncludes().remove(myComposite);
+
+ // Remove my contribution
+ contributionService.remove("http://test/contribution");
+
+ // Stop the domain
+ domain.stop();
+ }
+
+ class MyComponentListener implements ComponentListener {
+ boolean startCalled;
+ boolean stopCalled;
+
+ public void componentStarted(String componentName) {
+ startCalled = true;
+ }
+
+ public void componentStopped(String componentName) {
+ stopCalled = true;
+ }
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java
new file mode 100644
index 0000000000..1cfe5ed5d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 wrapping 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-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java
new file mode 100644
index 0000000000..86e0cb6a8a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.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.host.embedded.test.extension;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.impl.TestImplementationImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+
+/**
+ * Default factory for the test implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultTestImplementationFactory implements TestImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ public DefaultTestImplementationFactory(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ }
+
+ public TestImplementation createTestImplementation() {
+ return new TestImplementationImpl(assemblyFactory, javaFactory);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java
new file mode 100644
index 0000000000..d9f1228307
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.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.host.embedded.test.extension;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing a test implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TestImplementation extends Implementation {
+
+ /**
+ * Returns the greeting string that can be configured on test implementations.
+ *
+ * @return the greeting string that can be configured on test implementations
+ */
+ String getGreeting();
+
+ /**
+ * Sets the greeting string that can be configured on test implementations.
+ *
+ * @param greeting the greeting string that can be configured on test implementations
+ */
+ void setGreeting(String greeting);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java
new file mode 100644
index 0000000000..9200d850bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.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.host.embedded.test.extension;
+
+
+/**
+ * A factory for the test implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TestImplementationFactory {
+
+ /**
+ * Creates a new test implementation.
+ *
+ * @return
+ */
+ TestImplementation createTestImplementation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java
new file mode 100644
index 0000000000..4adec91151
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.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.host.embedded.test.extension;
+
+/**
+ * Service interface for test component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TestService {
+
+ String ping(String name);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java
new file mode 100644
index 0000000000..083b01167f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.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.host.embedded.test.extension.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.host.embedded.test.extension.TestService;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+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;
+
+
+/**
+ * The model representing a test implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestImplementationImpl implements TestImplementation {
+
+ private Service testService;
+ private String greeting;
+
+ /**
+ * Constructs a new test implementation.
+ */
+ public TestImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+
+ // Test implementations always provide a single service exposing
+ // the TestService interface, and have no references and properties
+ testService = assemblyFactory.createService();
+ testService.setName("Test");
+ JavaInterface javaInterface;
+ try {
+ javaInterface = javaFactory.createJavaInterface(TestService.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ testService.setInterfaceContract(interfaceContract);
+ }
+
+ public String getGreeting() {
+ return greeting;
+ }
+
+ public void setGreeting(String greeting) {
+ this.greeting = greeting;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The test implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The test implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The test implementation provides a single fixed Test service
+ return Collections.singletonList(testService);
+ }
+
+ public List<Reference> getReferences() {
+ // The test implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ // The test implementation does not have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The test implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // The test implementation does not have a URI
+ }
+
+ public boolean isUnresolved() {
+ // The test implementation is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The test implementation is always resolved
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java
new file mode 100644
index 0000000000..73feffad50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.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.host.embedded.test.extension.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 org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
+
+
+
+/**
+ * Implements a StAX artifact processor for test implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestImplementationProcessor implements StAXArtifactProcessor<TestImplementation> {
+ private static final QName IMPLEMENTATION_TEST = new QName("http://test/extension", "implementation.test");
+
+ private TestImplementationFactory testFactory;
+
+ public TestImplementationProcessor(TestImplementationFactory testFactory) {
+ this.testFactory = testFactory;
+ }
+
+ public QName getArtifactType() {
+ // Returns the QName of the XML element processed by this processor
+ return IMPLEMENTATION_TEST;
+ }
+
+ public Class<TestImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return TestImplementation.class;
+ }
+
+ public TestImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.test> element
+
+ // Read the message attribute.
+ String message = reader.getAttributeValue(null, "greeting");
+
+ // Create and initialize the test implementation model
+ TestImplementation implementation = testFactory.createTestImplementation();
+ implementation.setGreeting(message);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_TEST.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(TestImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(TestImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ writer.writeStartElement(IMPLEMENTATION_TEST.getNamespaceURI(), IMPLEMENTATION_TEST.getLocalPart());
+
+ if (implementation.getGreeting() != null) {
+ writer.writeAttribute("greeting", implementation.getGreeting());
+ }
+
+ writer.writeEndElement();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java
new file mode 100644
index 0000000000..f6f077e99b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.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.host.embedded.test.extension.module;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.host.embedded.test.extension.DefaultTestImplementationFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.impl.TestImplementationProcessor;
+import org.apache.tuscany.sca.host.embedded.test.extension.provider.TestImplementationProviderFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+
+
+/**
+ * Implements a module activator for the test implementation extension module.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+
+ // Create the test implementation factory
+ ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ TestImplementationFactory testFactory = new DefaultTestImplementationFactory(assemblyFactory, javaFactory);
+ modelFactories.addFactory(testFactory);
+
+ // Add the test implementation extension to the StAXArtifactProcessor
+ // extension point
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ TestImplementationProcessor implementationArtifactProcessor = new TestImplementationProcessor(testFactory);
+ processors.addArtifactProcessor(implementationArtifactProcessor);
+
+ // Add the test provider factory to the ProviderFactory extension point
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new TestImplementationProviderFactory());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java
new file mode 100644
index 0000000000..1d27e08fee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.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.host.embedded.test.extension.provider;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+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;
+
+
+/**
+ * Implementation provider for test implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private TestImplementation implementation;
+
+ /**
+ * Constructs a new test implementation provider.
+ */
+ public TestImplementationProvider(RuntimeComponent component, TestImplementation implementation) {
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ TestInvoker invoker = new TestInvoker(operation, implementation.getGreeting());
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ 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-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java
new file mode 100644
index 0000000000..15d3618fdd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.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.host.embedded.test.extension.provider;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ * The model representing a test implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestImplementationProviderFactory implements ImplementationProviderFactory<TestImplementation> {
+
+ /**
+ * Constructs a new test implementation provider factory.
+ */
+ public TestImplementationProviderFactory() {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, TestImplementation implementation) {
+ return new TestImplementationProvider(component, implementation);
+ }
+
+ public Class<TestImplementation> getModelType() {
+ return TestImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java
new file mode 100644
index 0000000000..d49179dec0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.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.host.embedded.test.extension.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+
+/**
+ * Implements an invoker for test component implementations.
+ *
+ * The target invoker is responsible for handling operation invocations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestInvoker implements Invoker {
+ private Operation operation;
+ private String greeting;
+
+ public TestInvoker(Operation operation, String greeting) {
+ this.operation = operation;
+ this.greeting = greeting;
+ }
+
+ public Message invoke(Message msg) {
+ Object[] args = msg.getBody();
+ if (operation.getName().equals("ping")) {
+ msg.setBody(greeting + " " + args[0]);
+ } else {
+ msg.setFaultBody(new Exception("Operation " + operation.getName() + " is not supported"));
+ }
+ return msg;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..7e2e11e4cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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
+org.apache.tuscany.sca.host.embedded.test.extension.module.TestModuleActivator
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/test.composite b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/test.composite
new file mode 100644
index 0000000000..bd7c5fab79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/test.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://test"
+ xmlns:se="http://test"
+ xmlns:e="http://test/extension"
+ name="test">
+
+ <component name="TestServiceComponent">
+ <e:implementation.test greeting="Hello" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/test.txt b/sca-java-1.x/branches/sca-android/modules/host-embedded/src/test/resources/test.txt
new file mode 100644
index 0000000000..287f9b1f65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-runtime/LICENSE b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-runtime/META-INF/README b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/NOTICE b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/implementation-java-runtime/pom.xml b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/pom.xml
new file mode 100644
index 0000000000..96510ea576
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <name>Apache Tuscany SCA Java Implementation Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.java.runtime</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.implementation.java*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java
new file mode 100644
index 0000000000..ac8af3ed64
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.context.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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java
new file mode 100644
index 0000000000..a93710d266
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
new file mode 100644
index 0000000000..b5d3254fa0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.Injector;
+import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
+
+/**
+ * @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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java
new file mode 100644
index 0000000000..5285caa481
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetInitializationException;
+import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
+
+/**
+ * @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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java
new file mode 100644
index 0000000000..2513c63e38
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java
new file mode 100644
index 0000000000..d8eef18c74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
new file mode 100644
index 0000000000..ffce7ce467
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.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.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+
+/**
+ * Object Factory that is used to retrieve the ConversationID from the
+ * Message on the ThreadMessageContext.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationIDObjectFactory implements ObjectFactory {
+
+ public ConversationIDObjectFactory() {
+ }
+
+ public Object getInstance() {
+ return ThreadMessageContext.getMessageContext().getFrom().getReferenceParameters().getConversationID();
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java
new file mode 100644
index 0000000000..dd454be7c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.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.java.injection;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * Injects a value created by an {@link org.apache.tuscany.sca.core.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 pField, ObjectFactory<?> objectFactory) {
+ field = pField;
+ // Allow privileged access to set accessibility. Requires ReflectPermission
+ // in security policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ field.setAccessible(true); // ignore Java accessibility
+ return null;
+ }
+ });
+
+ this.objectFactory = objectFactory;
+ }
+
+ /**
+ * Inject a new value on the given instance
+ */
+ public void inject(T instance) throws ObjectCreationException {
+ try {
+ field.set(instance, objectFactory.getInstance());
+ } catch (IllegalAccessException e) {
+ throw new ObjectCreationException("Field is not accessible [" + field + "]", e);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java
new file mode 100644
index 0000000000..4d062859b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java
new file mode 100644
index 0000000000..5aeebcca36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.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 InvalidAccessorException extends InjectionRuntimeException {
+ private static final long serialVersionUID = 9196299279363310978L;
+
+ 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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java
new file mode 100644
index 0000000000..695dea3343
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+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;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaPropertyValueObjectFactory implements PropertyValueFactory {
+ private Mediator mediator = null;
+ private boolean isSimpleType;
+
+ public JavaPropertyValueObjectFactory(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ public ObjectFactory createValueFactory(Property property, Object propertyValue, JavaElementImpl javaElement) {
+ isSimpleType = isSimpleType(property);
+ Document doc = (Document)propertyValue;
+ Class javaType = JavaIntrospectionHelper.getBaseType(javaElement.getType(), javaElement.getGenericType());
+ 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);
+ if ( javaElement.getType().isArray() ) {
+ return new ArrayObjectFactoryImpl(property, values, isSimpleType, javaType);
+ } else {
+ return new ListObjectFactoryImpl(property, values, isSimpleType, javaType);
+ }
+ } else {
+ if ( javaElement.getType().isArray() ) {
+ return new ArrayObjectFactoryImpl(property, getComplexPropertyValues(doc), 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);
+ }
+
+ }
+ }
+
+ 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>();
+ NodeList nodes = rootElement.getChildNodes();
+ for (int count = 0; count < nodes.getLength(); ++count) {
+ if (nodes.item(count).getNodeType() == Document.ELEMENT_NODE) {
+ propValues.add(DOMHelper.promote(nodes.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) {
+ try {
+ return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
+ } catch (NumberFormatException ex) {
+ throw new ObjectCreationException("Failed to create instance for property "
+ + property.getName() + " with value " + propertyValue, ex);
+ } catch (IllegalArgumentException ex) {
+ throw new ObjectCreationException("Failed to create instance for property "
+ + property.getName() + " with value " + propertyValue, ex);
+ }
+ } 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) {
+ try {
+ values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
+ } catch (NumberFormatException ex) {
+ throw new ObjectCreationException("Failed to create instance for property "
+ + property.getName() + " with value " + aValue
+ + " from value list of " + propertyValue, ex);
+ } catch (IllegalArgumentException ex) {
+ throw new ObjectCreationException("Failed to create instance for property "
+ + property.getName() + " with value " + aValue
+ + " from value list of " + propertyValue, ex);
+ }
+ }
+ return values;
+ } else {
+ List instances = new ArrayList();
+ for (Node aValue : (List<Node>)propertyValue) {
+ instances.add(mediator.mediate(aValue, sourceDataType, targetDataType, null));
+ }
+ return instances;
+ }
+ }
+ }
+
+ public class ArrayObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ArrayObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class javaType) {
+ super(property, propertyValues, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ int count = 0;
+ Object values = Array.newInstance(javaType, ((List<Object>)propertyValue).size());
+ for (String aValue : (List<String>)propertyValue) {
+ try {
+ Array.set(values, count++, simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
+ } catch (NumberFormatException ex) {
+ throw new ObjectCreationException("Failed to create instance for property "
+ + property.getName() + " with value " + aValue
+ + " from value list of " + propertyValue, ex);
+ } catch (IllegalArgumentException ex) {
+ throw new ObjectCreationException("Failed to create instance for property "
+ + property.getName() + " with value " + aValue
+ + " from value list of " + propertyValue, ex);
+ }
+ }
+ return values;
+ } else {
+ Object instances = Array.newInstance(javaType, ((List<Object>)propertyValue).size());
+ int count = 0;
+ for (Node aValue : (List<Node>)propertyValue) {
+ Array.set(instances, count++, mediator.mediate(aValue, sourceDataType, targetDataType, null));
+ }
+ return instances;
+ }
+ }
+ }
+
+ /**
+ * This method will create an instance of the value for the specified Property.
+ *
+ * @param property The Property from which to retrieve the property value
+ * @param type The type of the property value being retrieved from the Property
+ * @param <B> Type type of the property value being looked up
+ *
+ * @return the value for the Property
+ */
+ public <B> B createPropertyValue(ComponentProperty property, Class<B> type)
+ {
+ ObjectFactory<B> factory = this.createValueFactory(property, property.getValue(), type);
+ return factory.getInstance();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java
new file mode 100644
index 0000000000..9f587f58de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java
new file mode 100644
index 0000000000..baf9eb9cc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.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.injection;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * Injects a value created by an {@link org.apache.tuscany.sca.core.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 aMethod, ObjectFactory<?> objectFactory) {
+ assert aMethod != null;
+ assert objectFactory != null;
+ this.method = aMethod;
+ // Allow privileged access to set accessibility. Requires ReflectPermission in security
+ // policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ method.setAccessible(true);
+ return null;
+ }
+ });
+ this.objectFactory = objectFactory;
+ }
+
+ public void inject(T instance) throws ObjectCreationException {
+ try {
+ method.invoke(instance, objectFactory.getInstance());
+ } catch (IllegalAccessException e) {
+ throw new ObjectCreationException("Method is not accessible [" + method + "]", e);
+ } 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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java
new file mode 100644
index 0000000000..ca9c08fe63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.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 org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.context.RequestContextImpl;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.osoa.sca.RequestContext;
+
+/**
+ * Creates instances of
+ * {@link org.apache.tuscany.sca.core.context.RequestContextImpl} for
+ * injection on component implementation instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequestContextObjectFactory implements ObjectFactory<RequestContext> {
+ private RequestContextFactory factory;
+ private ProxyFactory proxyFactory;
+
+ public RequestContextObjectFactory(RequestContextFactory factory) {
+ this(factory, null);
+ }
+
+ public RequestContextObjectFactory(RequestContextFactory factory, ProxyFactory proxyFactory) {
+ this.factory = factory;
+ this.proxyFactory = proxyFactory;
+ }
+
+ public RequestContext getInstance() throws ObjectCreationException {
+ if (factory != null) {
+ return factory.createRequestContext();
+ } else {
+ return new RequestContextImpl(proxyFactory);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java
new file mode 100644
index 0000000000..17450f43cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.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.injection;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+
+/**
+ * Denotes an exception thrown when a runtime resource is not found
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceNotFoundException extends ObjectCreationException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ 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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java
new file mode 100644
index 0000000000..5d4d999453
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * Resolves a runtime resource to be injected on a field or method of a Java component type marked with {@link
+ * javax.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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java
new file mode 100644
index 0000000000..25c09231c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.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.invocation;
+
+import org.apache.tuscany.sca.implementation.java.injection.InjectionRuntimeException;
+
+/**
+ * Denotes an error when invoking an event on an object
+ *
+ * @version $Rev$ $Date$
+ */
+public class EventInvocationException extends InjectionRuntimeException {
+ private static final long serialVersionUID = 1480018831708211581L;
+
+ public EventInvocationException() {
+ super();
+ }
+
+ public EventInvocationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public EventInvocationException(String message) {
+ super(message);
+ }
+
+ public EventInvocationException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java
new file mode 100644
index 0000000000..e6ebb5abc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/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.invocation;
+
+/**
+ * Performs an invocation on an instance
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EventInvoker<T> {
+
+ /**
+ * Performs the invocation on a given instance
+ *
+ * @throws EventInvocationException
+ */
+ void invokeEvent(T instance) throws EventInvocationException;
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java
new file mode 100644
index 0000000000..135fde09ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.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.invocation;
+
+import org.apache.tuscany.sca.core.invocation.TargetInvocationException;
+
+/**
+ * Denotes an unknown operation sequence in a conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConversationSequenceException extends TargetInvocationException {
+ private static final long serialVersionUID = -5744028391493899147L;
+
+ 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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java
new file mode 100644
index 0000000000..ef4e67d79a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.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.implementation.java.invocation;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Phase;
+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.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaCallbackRuntimeWireProcessor implements RuntimeWireProcessor {
+ private static final Logger logger = Logger.getLogger(JavaCallbackRuntimeWireProcessor.class.getName());
+ private InterfaceContractMapper interfaceContractMapper;
+ private JavaInterfaceFactory javaInterfaceFactory;
+
+ /**
+ * @param interfaceContractMapper
+ * @param javaInterfaceFactory
+ */
+ public JavaCallbackRuntimeWireProcessor(InterfaceContractMapper interfaceContractMapper,
+ JavaInterfaceFactory javaInterfaceFactory) {
+ super();
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ }
+
+ public void process(RuntimeWire wire) {
+ addCallbackInterfaceInterceptors(wire);
+ }
+
+ private void addCallbackInterfaceInterceptors(RuntimeWire wire) {
+ Contract contract = wire.getSource().getContract();
+ if (!(contract instanceof RuntimeComponentReference)) {
+ return;
+ }
+ RuntimeComponent component = wire.getSource().getComponent();
+ Implementation implementation = component.getImplementation();
+ if (!(implementation instanceof JavaImplementation)) {
+ return;
+ }
+ JavaImplementation javaImpl = (JavaImplementation)implementation;
+ EndpointReference callbackEndpoint = wire.getSource().getCallbackEndpoint();
+ if (callbackEndpoint != null) {
+ Interface iface = callbackEndpoint.getContract().getInterfaceContract().getInterface();
+ if (!supportsCallbackInterface(iface, javaImpl)) {
+ // callback to this impl is not possible, so ensure a callback object is set
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ chain.addInterceptor(Phase.REFERENCE, new CallbackInterfaceInterceptor());
+ }
+ }
+ }
+ }
+
+ private boolean supportsCallbackInterface(Interface iface, JavaImplementation impl) {
+ if (iface instanceof JavaInterface) {
+ Class<?> ifaceClass = ((JavaInterface)iface).getJavaClass();
+ if (ifaceClass.isAssignableFrom(impl.getJavaClass())) {
+ return true;
+ }
+ }
+ try {
+ Interface implType = javaInterfaceFactory.createJavaInterface(impl.getJavaClass());
+ // Ignore the remotable/conversational testing
+ implType.setRemotable(iface.isRemotable());
+ implType.setConversational(iface.isConversational());
+ return interfaceContractMapper.isCompatible(iface, implType);
+ } catch (InvalidInterfaceException e) {
+ logger.log(Level.WARNING, e.getMessage(), e);
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.java
new file mode 100644
index 0000000000..2903cc6fc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.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.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentContextFactory implements ObjectFactory<ComponentContext> {
+ private final JavaComponentContextProvider component;
+
+
+ public JavaComponentContextFactory(JavaComponentContextProvider component) {
+ this.component = component;
+ }
+
+
+ public ComponentContext getInstance() throws ObjectCreationException {
+ return component.getComponent().getComponentContext();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
new file mode 100644
index 0000000000..e585b3d46f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
@@ -0,0 +1,404 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+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.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.context.ComponentContextImpl;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.CallableReferenceObjectFactory;
+import org.apache.tuscany.sca.core.invocation.CallbackReferenceObjectFactory;
+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.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.TargetResolutionException;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+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.injection.ConversationIDObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+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.invocation.Invoker;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.ConversationID;
+
+/**
+ * The runtime instantiation of Java component implementations
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentContextProvider {
+ private JavaPropertyValueObjectFactory propertyValueFactory;
+ private DataBindingExtensionPoint dataBindingRegistry;
+ private RuntimeComponent component;
+ private JavaInstanceFactoryProvider<?> instanceFactoryProvider;
+ private ProxyFactory proxyFactory;
+
+ public JavaComponentContextProvider(RuntimeComponent component,
+ JavaInstanceFactoryProvider configuration,
+ DataBindingExtensionPoint dataBindingExtensionPoint,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory,
+ ComponentContextFactory componentContextFactory,
+ RequestContextFactory requestContextFactory) {
+ super();
+ this.instanceFactoryProvider = configuration;
+ this.proxyFactory = configuration.getProxyFactory();
+ // if (componentContextFactory != null) {
+ // this.componentContext = componentContextFactory.createComponentContext(component, requestContextFactory);
+ // } else {
+ // this.componentContext = new ComponentContextImpl(this, requestContextFactory, this.proxyService);
+ // }
+ this.component = component;
+ this.dataBindingRegistry = dataBindingExtensionPoint;
+ this.propertyValueFactory = propertyValueObjectFactory;
+ }
+
+ InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
+ return instanceFactoryProvider.createFactory().newInstance();
+ }
+
+ void configureProperties(List<ComponentProperty> definedProperties) {
+ for (ComponentProperty p : definedProperties) {
+ configureProperty(p);
+ }
+ }
+
+ private void configureProperty(ComponentProperty configuredProperty) {
+ JavaElementImpl element =
+ instanceFactoryProvider.getImplementation().getPropertyMembers().get(configuredProperty.getName());
+
+ if (element != null && configuredProperty.getValue() != null) {
+ if (!(element.getAnchor() instanceof Constructor)) {
+ if(element.getElementType() == ElementType.FIELD) {
+ // Field field = (Field)element.getAnchor();
+ instanceFactoryProvider.getInjectionSites().add(element);
+ /*
+ if(Modifier.isPublic(field.getModifiers())) {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ } else if(field.getAnnotation(org.osoa.sca.annotations.Property.class) != null) {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ }
+ */
+ } else {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ }
+ }
+
+ //Class propertyJavaType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ ObjectFactory<?> propertyObjectFactory =
+ createPropertyValueFactory(configuredProperty, configuredProperty.getValue(), element);
+ instanceFactoryProvider.setObjectFactory(element, propertyObjectFactory);
+
+ JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
+ for(JavaElementImpl p: constructor.getParameters()){
+ if(element.getName().equals(p.getName())) {
+ instanceFactoryProvider.setObjectFactory(p, propertyObjectFactory);
+ }
+ }
+ }
+ }
+
+ void start() {
+ if (!instanceFactoryProvider.getImplementation().getCallbackMembers().isEmpty()) {
+ Map<String, List<RuntimeWire>> callbackWires = new HashMap<String, List<RuntimeWire>>();
+ for (ComponentService service : component.getServices()) {
+
+ RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
+ if (callbackReference != null) {
+ List<RuntimeWire> wires = callbackReference.getRuntimeWires();
+ if (!wires.isEmpty()) {
+ callbackWires.put(wires.get(0).getSource().getInterfaceContract().getInterface().toString(),
+ wires);
+ }
+ }
+ }
+
+ for (Map.Entry<String, Collection<JavaElementImpl>> entry : instanceFactoryProvider.getImplementation()
+ .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;
+ }
+ for(JavaElementImpl element : entry.getValue()) {
+ Class<?> businessInterface = element.getType();
+ ObjectFactory<?> factory = null;
+ if (CallableReference.class.isAssignableFrom(element.getType())) {
+ businessInterface =
+ JavaIntrospectionHelper.getBusinessInterface(element.getType(), element.getGenericType());
+ factory =
+ new CallbackReferenceObjectFactory(businessInterface, proxyFactory, wires);
+ } else {
+ factory = new CallbackWireObjectFactory(businessInterface, proxyFactory, wires);
+ }
+ if (!(element.getAnchor() instanceof Constructor)) {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ }
+ instanceFactoryProvider.setObjectFactory(element, factory);
+ }
+ }
+ }
+ for (Reference ref : instanceFactoryProvider.getImplementation().getReferences()) {
+ JavaElementImpl element =
+ instanceFactoryProvider.getImplementation().getReferenceMembers().get(ref.getName());
+ if (element != null) {
+ if (!(element.getAnchor() instanceof Constructor)) {
+ if(element.getElementType() == ElementType.FIELD) {
+ Field field = (Field)element.getAnchor();
+ if(Modifier.isPublic(field.getModifiers())) {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ } else if(field.getAnnotation(org.osoa.sca.annotations.Reference.class) != null) {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ }
+ } else {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ }
+ }
+ ComponentReference componentReference = null;
+ List<RuntimeWire> wireList = null;
+ for (ComponentReference reference : component.getReferences()) {
+ if (reference.getName().equals(ref.getName())) {
+ wireList = ((RuntimeComponentReference)reference).getRuntimeWires();
+ componentReference = reference;
+ break;
+ }
+ }
+ if (ref.getMultiplicity() == Multiplicity.ONE_N || ref.getMultiplicity() == Multiplicity.ZERO_N) {
+ List<ObjectFactory<?>> factories = new ArrayList<ObjectFactory<?>>();
+ Class<?> baseType =
+ JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ for (int i = 0; i < wireList.size(); i++) {
+ ObjectFactory<?> factory = null;
+ if (CallableReference.class.isAssignableFrom(baseType)) {
+ Type callableRefType = JavaIntrospectionHelper.getParameterType(element.getGenericType());
+ // Type businessType = JavaIntrospectionHelper.getParameterType(callableRefType);
+ Class<?> businessInterface =
+ JavaIntrospectionHelper.getBusinessInterface(baseType, callableRefType);
+ factory =
+ new CallableReferenceObjectFactory(businessInterface, component,
+ (RuntimeComponentReference)wireList.get(i)
+ .getSource().getContract(), wireList.get(i)
+ .getSource().getBinding());
+ } else {
+ factory = createObjectFactory(baseType, wireList.get(i));
+ }
+ factories.add(factory);
+ }
+ instanceFactoryProvider.setObjectFactories(element, factories);
+ JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
+ for(JavaElementImpl p: constructor.getParameters()){
+ if(element.getName().equals(p.getName())) {
+ instanceFactoryProvider.setObjectFactories(p, 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 = null;
+ if (CallableReference.class.isAssignableFrom(element.getType())) {
+ Class<?> businessInterface =
+ JavaIntrospectionHelper.getBusinessInterface(element.getType(), element
+ .getGenericType());
+ factory =
+ new CallableReferenceObjectFactory(businessInterface, component,
+ (RuntimeComponentReference)componentReference, null);
+ } else {
+ factory = createObjectFactory(element.getType(), wireList.get(0));
+ }
+ instanceFactoryProvider.setObjectFactory(element, factory);
+ JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
+ for(JavaElementImpl p: constructor.getParameters()){
+ if(element.getName().equals(p.getName())) {
+ instanceFactoryProvider.setObjectFactory(p, factory);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // We need to set the PropertyValueFactory on the ComponentContextImpl
+ // so the ComponentContext can "de-marshal" the property type to a value
+ // when the getProperty() method is called
+ ComponentContextImpl ccImpl = (ComponentContextImpl)component.getComponentContext();
+ ccImpl.setPropertyValueFactory(propertyValueFactory);
+
+ //setUpPolicyHandlers();
+ }
+
+ void addResourceFactory(String name, ObjectFactory<?> factory) {
+ JavaResourceImpl resource = instanceFactoryProvider.getImplementation().getResources().get(name);
+
+ if (resource != null && !(resource.getElement().getAnchor() instanceof Constructor)) {
+ instanceFactoryProvider.getInjectionSites().add(resource.getElement());
+ }
+
+ instanceFactoryProvider.setObjectFactory(resource.getElement(), factory);
+ }
+
+ void addConversationIDFactories(List<Member> names) {
+ ObjectFactory<String> factory = new ConversationIDObjectFactory();
+ for (Member name : names) {
+ if (name instanceof Field) {
+ JavaElementImpl element = new JavaElementImpl((Field)name);
+ element.setClassifer(ConversationID.class);
+ instanceFactoryProvider.setObjectFactory(element, factory);
+ } else if (name instanceof Method) {
+ JavaElementImpl element = new JavaElementImpl((Method)name, 0);
+ element.setName(JavaIntrospectionHelper.toPropertyName(name.getName()));
+ element.setClassifer(ConversationID.class);
+ instanceFactoryProvider.setObjectFactory(element, factory);
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method: " + name.getName());
+ }
+ }
+ }
+
+ Object createInstance() throws ObjectCreationException {
+ return createInstanceWrapper().getInstance();
+ }
+
+ JavaInstanceFactoryProvider<?> getInstanceFactoryProvider() {
+ return instanceFactoryProvider;
+ }
+
+ void stop() {
+ //cleanUpPolicyHandlers();
+ }
+
+ Invoker createInvoker(Operation operation) throws NoSuchMethodException {
+ Class<?> implClass = instanceFactoryProvider.getImplementationClass();
+
+ Method method = JavaInterfaceUtil.findMethod(implClass, operation);
+ return new JavaImplementationInvoker(operation, method, component);
+ }
+
+ private static class OptimizedObjectFactory<T> implements ObjectFactory<T> {
+ private ScopeContainer scopeContainer;
+
+ public OptimizedObjectFactory(ScopeContainer scopeContainer) {
+ super();
+ this.scopeContainer = scopeContainer;
+ }
+
+ public T getInstance() throws ObjectCreationException {
+ try {
+ return (T)scopeContainer.getWrapper(null).getInstance();
+ } catch (TargetResolutionException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+ }
+
+ private <B> ObjectFactory<B> createObjectFactory(Class<B> interfaze, RuntimeWire wire) {
+ // FIXME: [rfeng] Disable the optimization for new as it needs more discussions
+ /*
+ boolean conversational = wire.getSource().getInterfaceContract().getInterface().isConversational();
+ Binding binding = wire.getSource().getBinding();
+ // Check if it's wireable binding for optimization
+ if (!conversational && binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
+ Component component = optimizableBinding.getTargetComponent();
+ if (component != null) {
+ Implementation implementation = component.getImplementation();
+ // Check if the target component is java component
+ if (implementation instanceof JavaImplementation) {
+ JavaImplementation javaImplementation = (JavaImplementation)implementation;
+ if (interfaze.isAssignableFrom(javaImplementation.getJavaClass())) {
+ ScopedRuntimeComponent scopedComponent = (ScopedRuntimeComponent)component;
+ ScopeContainer scopeContainer = scopedComponent.getScopeContainer();
+ Scope scope = scopeContainer.getScope();
+ if (scope == Scope.COMPOSITE || scope == Scope.STATELESS || scope == Scope.SYSTEM) {
+ boolean optimizable = true;
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ if (chain.getHeadInvoker() != chain.getTailInvoker()) {
+ optimizable = false;
+ break;
+ }
+ }
+ if (optimizable) {
+ return new OptimizedObjectFactory<B>(scopeContainer);
+ }
+ }
+ }
+ }
+ }
+ }
+ */
+ return new WireObjectFactory<B>(interfaze, wire, proxyFactory);
+ }
+
+ private ObjectFactory<?> createPropertyValueFactory(ComponentProperty property,
+ Object propertyValue,
+ JavaElementImpl javaElement) {
+ return propertyValueFactory.createValueFactory(property, propertyValue, javaElement);
+ }
+
+ /**
+ * @return the component
+ */
+ RuntimeComponent getComponent() {
+ return component;
+ }
+
+ /*private void setUpPolicyHandlers() {
+ for (PolicyHandler policyHandler : policyHandlers.values()) {
+ policyHandler.setUp(component.getImplementation());
+ }
+ }
+
+ private void cleanUpPolicyHandlers() {
+ for (PolicyHandler policyHandler : policyHandlers.values() ) {
+ policyHandler.cleanUp(this);
+ }
+ }*/
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.java
new file mode 100644
index 0000000000..4a5ad98e5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.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.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentNameFactory implements ObjectFactory<String> {
+ private final JavaComponentContextProvider componentContextProvider;
+
+
+ public JavaComponentNameFactory(JavaComponentContextProvider component) {
+ this.componentContextProvider = component;
+ }
+
+
+ public String getInstance() throws ObjectCreationException {
+ String uri = componentContextProvider.getComponent().getURI();
+ return uri.substring(uri.lastIndexOf('/')+1);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
new file mode 100644
index 0000000000..25d538cff4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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 org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+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.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Responsible for synchronously dispatching an invocation to a Java component
+ * implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics {
+ protected Operation operation;
+ protected Method method;
+ protected boolean allowsPBR;
+
+ @SuppressWarnings("unchecked")
+ protected final ScopeContainer scopeContainer;
+
+ public JavaImplementationInvoker(Operation operation, Method method, RuntimeComponent component) {
+ assert method != null : "Operation method cannot be null";
+ this.method = method;
+ this.operation = operation;
+ this.scopeContainer = ((ScopedRuntimeComponent)component).getScopeContainer();
+ this.allowsPBR = ((JavaImplementation)component.getImplementation()).isAllowsPassByReference(method);
+ }
+
+ public JavaImplementationInvoker(Operation operation, RuntimeComponent component) {
+ // used if the method can't be computed statically in advance
+ this.operation = operation;
+ this.scopeContainer = ((ScopedRuntimeComponent)component).getScopeContainer();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Message invoke(Message msg) {
+ Operation op = msg.getOperation();
+ if (op == null) {
+ op = this.operation;
+ }
+ ConversationSequence sequence = op.getConversationSequence();
+ Object payload = msg.getBody();
+
+ Object contextId = null;
+
+ EndpointReference from = msg.getFrom();
+ ReferenceParameters parameters = null;
+ if (from != null) {
+ parameters = from.getReferenceParameters();
+ }
+ // check what sort of context is required
+ if (scopeContainer != null) {
+ Scope scope = scopeContainer.getScope();
+ if (scope == Scope.REQUEST) {
+ contextId = Thread.currentThread();
+ } else if (scope == Scope.CONVERSATION && parameters != null) {
+ contextId = parameters.getConversationID();
+ }
+ }
+
+ try {
+ // The following call might create a new conversation, as a result, the msg.getConversationID() might
+ // return a new value
+ InstanceWrapper wrapper = scopeContainer.getWrapper(contextId);
+
+ // detects whether the scope container has created a conversation Id. This will
+ // happen in the case that the component has conversational scope but only the
+ // callback interface is conversational. Or in the callback case if the service interface
+ // is conversational and the callback interface isn't. If we are in this situation we need
+ // to get the contextId of this component and remove it after we have invoked the method on
+ // it. It is possible that the component instance will not go away when it is removed below
+ // because a callback conversation will still be holding a reference to it
+ boolean removeTemporaryConversationalComponentAfterCall = false;
+ if (parameters != null && (contextId == null) && (parameters.getConversationID() != null)) {
+ contextId = parameters.getConversationID();
+ removeTemporaryConversationalComponentAfterCall = true;
+ }
+
+ Object instance = wrapper.getInstance();
+
+ // If the method couldn't be computed statically, or the instance being
+ // invoked is a user-specified callback object that doesn't implement
+ // the service interface from which the reflective method was obtained,
+ // compute the method object dynamically for this invocation.
+ Method imethod = method;
+ if (imethod == null || !imethod.getDeclaringClass().isInstance(instance)) {
+ try {
+ imethod = JavaInterfaceUtil.findMethod(instance.getClass(), operation);
+ } catch (NoSuchMethodException e) {
+ throw new IllegalArgumentException("Callback object does not provide method " + e.getMessage());
+ }
+ }
+
+ Object ret;
+ if (payload != null && !payload.getClass().isArray()) {
+ ret = imethod.invoke(instance, payload);
+ } else {
+ ret = imethod.invoke(instance, (Object[])payload);
+ }
+
+ scopeContainer.returnWrapper(wrapper, contextId);
+
+ if ((sequence == ConversationSequence.CONVERSATION_END) || (removeTemporaryConversationalComponentAfterCall)) {
+ // if end conversation, or we have the special case where a conversational
+ // object was created to service the stateless half of a stateful component
+ scopeContainer.remove(contextId);
+ parameters.setConversationID(null);
+ }
+ msg.setBody(ret);
+ } catch (InvocationTargetException e) {
+ Throwable cause = e.getTargetException();
+ boolean isChecked = false;
+ for (DataType<?> d : operation.getFaultTypes()) {
+ if (d.getPhysical().isInstance(cause)) {
+ isChecked = true;
+ msg.setFaultBody(cause);
+ break;
+ }
+ }
+
+
+ if (sequence != ConversationSequence.CONVERSATION_NONE ){
+ try {
+// // If the exception is not a business exception then end the conversation
+// boolean businessException = false;
+//
+// for (DataType dataType : operation.getFaultTypes()){
+// if ((dataType.getPhysical() == e.getCause().getClass()) &&
+// (contextId != null) ){
+// businessException = true;
+// break;
+// }
+// }
+
+ if (!isChecked && contextId != null) {
+ scopeContainer.remove(contextId);
+ parameters.setConversationID(null);
+ }
+ } catch (Exception ex){
+ // TODO - sure what the best course of action is here. We have
+ // a system exception in the middle of a business exception
+ }
+ }
+ if (!isChecked) {
+ if (cause instanceof RuntimeException) {
+ throw (RuntimeException)cause;
+ }
+ if (cause instanceof Error) {
+ throw (Error)cause;
+ } else {
+ throw new ServiceRuntimeException(cause.getMessage(), cause);
+ }
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ public boolean allowsPassByReference() {
+ return allowsPBR;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
new file mode 100644
index 0000000000..e9eea607c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.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.invocation;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.RequestContextObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.ResourceHost;
+import org.apache.tuscany.sca.implementation.java.injection.ResourceObjectFactory;
+import org.apache.tuscany.sca.interfacedef.Interface;
+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.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationProvider implements ScopedImplementationProvider {
+ private JavaImplementation implementation;
+ private JavaComponentContextProvider componentContextProvider;
+ private RequestContextFactory requestContextFactory;
+
+ public JavaImplementationProvider(RuntimeComponent component,
+ JavaImplementation implementation,
+ ProxyFactory proxyService,
+ DataBindingExtensionPoint dataBindingRegistry,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory,
+ ComponentContextFactory componentContextFactory,
+ RequestContextFactory requestContextFactory,
+ List<PolicyHandlerTuple> policyHandlerClassNames) {
+ super();
+ this.implementation = implementation;
+ this.requestContextFactory = requestContextFactory;
+ this.implementation.setPolicyHandlerClassNames(policyHandlerClassNames);
+
+ try {
+ JavaInstanceFactoryProvider configuration = new JavaInstanceFactoryProvider(implementation);
+ configuration.setProxyFactory(proxyService);
+ componentContextProvider =
+ new JavaComponentContextProvider(component,
+ configuration,
+ dataBindingRegistry,
+ propertyValueObjectFactory,
+ componentContextFactory,
+ requestContextFactory);
+
+ 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.getConversationIDMembers().size() > 0) {
+ componentContextProvider.addConversationIDFactories(implementation.getConversationIDMembers());
+ }
+
+ componentContextProvider.configureProperties(component.getProperties());
+ handleResources(implementation, proxyService);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ }
+
+ private void handleResources(JavaImplementation componentType, ProxyFactory proxyService) {
+ for (JavaResourceImpl resource : componentType.getResources().values()) {
+ String name = resource.getName();
+
+ ObjectFactory<?> objectFactory =
+ (ObjectFactory<?>)componentContextProvider.getInstanceFactoryProvider().getFactories().get(resource.getElement());
+ if (objectFactory == null) {
+ Class<?> type = resource.getElement().getType();
+ if (ComponentContext.class.equals(type)) {
+ objectFactory = new JavaComponentContextFactory(componentContextProvider);
+ } else if (RequestContext.class.equals(type)) {
+ objectFactory = new RequestContextObjectFactory(requestContextFactory, proxyService);
+ } else if (String.class.equals(type)) {
+ objectFactory = new JavaComponentNameFactory(componentContextProvider);
+ } else {
+ boolean optional = resource.isOptional();
+ String mappedName = resource.getMappedName();
+ objectFactory = createResourceObjectFactory(type, mappedName, optional, null);
+ }
+ }
+ componentContextProvider.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 Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ try {
+ return componentContextProvider.createInvoker(operation);
+ } catch (NoSuchMethodException e) {
+ // It's possible that the instance being invoked is a user-specified
+ // callback object that isn't an instance of the component implementation
+ // class. As an attempt to deal with this, look up a method object from
+ // the service interface. This isn't foolproof, as it's possible that
+ // the service interface isn't a Java interface, or that the callback
+ // object has the right method signature without implementing the
+ // callback interface. There is code in JavaImplementationInvoker
+ // to deal with these possibilities.
+ Interface iface = service.getInterfaceContract().getInterface();
+ if (iface instanceof JavaInterface) {
+ try {
+ Method method = JavaInterfaceUtil.findMethod(((JavaInterface)iface).getJavaClass(), operation);
+ return new JavaImplementationInvoker(operation, method, componentContextProvider.getComponent());
+ } catch (NoSuchMethodException e1) {
+ throw new IllegalArgumentException(e1);
+ }
+ } else {
+ return new JavaImplementationInvoker(operation, componentContextProvider.getComponent());
+ }
+ }
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public Scope getScope() {
+ return new Scope(implementation.getJavaScope().getScope());
+ }
+
+ public void start() {
+ componentContextProvider.start();
+ }
+
+ public void stop() {
+ componentContextProvider.stop();
+ }
+
+ public InstanceWrapper createInstanceWrapper() {
+ return componentContextProvider.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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java
new file mode 100644
index 0000000000..9b78439012
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.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.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+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.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+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;
+ private ComponentContextFactory componentContextFactory;
+ private RequestContextFactory requestContextFactory;
+ private List<PolicyHandlerTuple> policyHandlerClassNames = null;
+
+ public JavaImplementationProviderFactory(ProxyFactory proxyService,
+ DataBindingExtensionPoint dataBindingRegistry,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory,
+ ComponentContextFactory componentContextFactory,
+ RequestContextFactory requestContextFactory,
+ List<PolicyHandlerTuple> policyHandlerClassNames) {
+ super();
+ this.proxyService = proxyService;
+ this.dataBindingRegistry = dataBindingRegistry;
+ this.propertyValueObjectFactory = propertyValueObjectFactory;
+ this.componentContextFactory = componentContextFactory;
+ this.requestContextFactory = requestContextFactory;
+ this.policyHandlerClassNames = policyHandlerClassNames;
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ JavaImplementation implementation) {
+ return new JavaImplementationProvider(component,
+ implementation,
+ proxyService,
+ dataBindingRegistry,
+ propertyValueObjectFactory,
+ componentContextFactory,
+ requestContextFactory,
+ policyHandlerClassNames);
+ }
+
+ public Class<JavaImplementation> getModelType() {
+ return JavaImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java
new file mode 100644
index 0000000000..95a9f63688
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+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.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.introspect.impl.JavaIntrospectionHelper;
+
+/**
+ * Encapsulates configuration for a Java-based atomic component
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInstanceFactoryProvider<T> implements InstanceFactoryProvider<T> {
+ private JavaImplementation definition;
+ private ProxyFactory proxyService;
+
+ 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 JavaInstanceFactoryProvider(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>();
+ }
+
+ ProxyFactory getProxyFactory() {
+ return proxyService;
+ }
+
+ void setProxyFactory(ProxyFactory proxyService) {
+ this.proxyService = proxyService;
+ }
+
+ /**
+ * @return the definition
+ */
+ JavaImplementation getImplementation() {
+ 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);
+ }
+
+ private 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;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Injector<T>[] getInjectors() {
+ // work around JDK1.5 issue with allocating generic arrays
+ @SuppressWarnings("unchecked")
+ Injector<T>[] injectors = 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;
+ }
+
+ private 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
+ */
+ List<JavaElementImpl> getInjectionSites() {
+ return injectionSites;
+ }
+
+ /**
+ * @return the factories
+ */
+ Map<JavaElementImpl, Object> getFactories() {
+ return factories;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java
new file mode 100644
index 0000000000..ee3507ef80
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.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.invocation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+
+/**
+ * Processor to inject policy handling interceptor whenever PolicySets are specified in a Java Implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaPolicyHandlingRuntimeWireProcessor implements RuntimeWireProcessor {
+ private static final Logger logger = Logger.getLogger(JavaPolicyHandlingRuntimeWireProcessor.class.getName());
+
+ public JavaPolicyHandlingRuntimeWireProcessor() {
+ super();
+ }
+
+ public void process(RuntimeWire wire) {
+ /*Contract contract = wire.getSource().getContract();
+ if (!(contract instanceof RuntimeComponentReference)) {
+ return;
+ }*/
+
+ RuntimeComponent component = wire.getTarget().getComponent();
+ if (component != null && component.getImplementation() instanceof JavaImplementation) {
+ JavaImplementation javaImpl = (JavaImplementation)component.getImplementation();
+ if (javaImpl instanceof PolicySetAttachPoint) {
+ PolicyHandler policyHandler = null;
+ List<PolicyHandler> implPolicyHandlers = new ArrayList<PolicyHandler>();
+ PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)javaImpl;
+
+ try {
+ //for ( PolicySet policySet : policiedImpl.getPolicySets() ) {
+ for (PolicySet policySet : component.getPolicySets()) {
+ policyHandler =
+ PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl.getPolicyHandlerClassNames());
+ if (policyHandler != null) {
+ policyHandler.setUp(javaImpl);
+ implPolicyHandlers.add(policyHandler);
+ } else {
+ //FIXME: to be removed after the PolicyHandler story has crystalized..
+ //maybe replace with exception then...
+ logger.warning("No PolicyHandler registered for PolicySet - " + policySet.getName());
+ }
+ }
+
+ List<PolicyHandler> applicablePolicyHandlers = null;
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ applicablePolicyHandlers = new ArrayList<PolicyHandler>();
+ if (javaImpl instanceof OperationsConfigurator) {
+ String operationName = chain.getTargetOperation().getName();
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
+ for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
+ if (confOp.getName().equals(operationName)) {
+ for (PolicySet policySet : confOp.getPolicySets()) {
+ policyHandler =
+ PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl
+ .getPolicyHandlerClassNames());
+ if (policyHandler != null) {
+ policyHandler.setUp(javaImpl);
+ applicablePolicyHandlers.add(policyHandler);
+ } else {
+ logger.warning("No PolicyHandler registered for " + policySet);
+ }
+ }
+ break;
+ }
+ }
+
+ //if no policies have been specified at the operation level then simply
+ //apply whatever is specified for the implementation level
+ if (applicablePolicyHandlers.isEmpty()) {
+ applicablePolicyHandlers = implPolicyHandlers;
+ }
+ }
+
+ if (!applicablePolicyHandlers.isEmpty()) {
+ String phase =
+ (wire.getSource().getContract() instanceof ComponentReference) ? Phase.REFERENCE_POLICY
+ : Phase.SERVICE_POLICY;
+
+ chain.addInterceptor(Phase.IMPLEMENTATION_POLICY, new PolicyHandlingInterceptor(chain.getTargetOperation(),
+ applicablePolicyHandlers));
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.java
new file mode 100644
index 0000000000..515a7c8a43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.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 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;
+
+ /**
+ * Instantiates an invoker for the given method
+ */
+ public MethodEventInvoker(Method method) {
+ assert method != null;
+ this.method = method;
+ }
+
+ public void invokeEvent(T instance) throws EventInvocationException {
+ try {
+ method.invoke(instance, (Object[]) null);
+ } catch (IllegalArgumentException e) {
+ String name = method.getName();
+ throw new EventInvocationException("Exception thrown by event method [" + name + "]", e.getCause());
+ } catch (IllegalAccessException e) {
+ String name = method.getName();
+ throw new EventInvocationException("Method is not accessible [" + name + "]");
+ } catch (InvocationTargetException e) {
+ String name = method.getName();
+ throw new EventInvocationException("Exception thrown by event method [" + name + "]", e.getCause());
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java
new file mode 100644
index 0000000000..8c85b46c65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.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.implementation.java.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+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.policy.util.PolicyHandler;
+
+/**
+ * An interceptor to invoke policy handlers before and after the invocation of operations on
+ * an implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyHandlingInterceptor implements Interceptor {
+ private Invoker next;
+ private List<PolicyHandler> policyHandlers = null;
+ private Operation targetOperation = null;
+
+ public PolicyHandlingInterceptor(Operation targetOperation, List<PolicyHandler> policyHandlers) {
+ this.policyHandlers = policyHandlers;
+ this.targetOperation = targetOperation;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ applyPreInvocationPolicies(targetOperation, msg);
+ msg = next.invoke(msg);
+ } finally {
+ applyPostInvocationPolices(targetOperation, msg);
+ }
+ return msg;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ private void applyPreInvocationPolicies(Object... context) {
+ for (PolicyHandler policyHandler : policyHandlers) {
+ policyHandler.beforeInvoke(context);
+ }
+ }
+
+ private void applyPostInvocationPolices(Object... context) {
+ for ( int count = policyHandlers.size() - 1 ; count >= 0 ; --count) {
+ policyHandlers.get(count).afterInvoke(context);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
new file mode 100644
index 0000000000..111b008b96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.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.implementation.java.module;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.invocation.CglibProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
+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.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.invocation.JavaCallbackRuntimeWireProcessor;
+import org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProviderFactory;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaRuntimeModuleActivator implements ModuleActivator {
+
+ public JavaRuntimeModuleActivator() {
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
+
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
+
+ ProxyFactoryExtensionPoint proxyFactories = registry.getExtensionPoint(ProxyFactoryExtensionPoint.class);
+ proxyFactories.setClassProxyFactory(new CglibProxyFactory(messageFactory, interfaceContractMapper));
+
+ JavaInterfaceFactory javaFactory = factories.getFactory(JavaInterfaceFactory.class);
+
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ JavaPropertyValueObjectFactory factory = new JavaPropertyValueObjectFactory(mediator);
+
+ ContextFactoryExtensionPoint contextFactories = registry.getExtensionPoint(ContextFactoryExtensionPoint.class);
+ ComponentContextFactory componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class);
+ RequestContextFactory requestContextFactory = contextFactories.getFactory(RequestContextFactory.class);
+
+ List<PolicyHandlerTuple> policyHandlerClassNames = null;
+ policyHandlerClassNames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
+
+ ProxyFactory proxyFactory = new ExtensibleProxyFactory(proxyFactories);
+
+ JavaImplementationProviderFactory javaImplementationProviderFactory =
+ new JavaImplementationProviderFactory(proxyFactory, dataBindings, factory, componentContextFactory,
+ requestContextFactory, policyHandlerClassNames);
+
+ ProviderFactoryExtensionPoint providerFactories =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(javaImplementationProviderFactory);
+
+ RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
+ registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+ if (wireProcessorExtensionPoint != null) {
+ wireProcessorExtensionPoint.addWireProcessor(new JavaCallbackRuntimeWireProcessor(interfaceContractMapper,
+ javaFactory));
+ //wireProcessorExtensionPoint.addWireProcessor(new JavaPolicyHandlingRuntimeWireProcessor());
+ }
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java
new file mode 100644
index 0000000000..628a308c86
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.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.context;
+
+import static org.easymock.EasyMock.createMock;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetInitializationException;
+import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
+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);
+ }
+
+ @Override
+ @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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java
new file mode 100644
index 0000000000..cc852cc677
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.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.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);
+ }
+
+
+ @Override
+ 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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java
new file mode 100644
index 0000000000..d502462688
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java
@@ -0,0 +1,449 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * This test case will test the JavaPropertyValueObjectFactory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaPropertyValueObjectFactoryTestCase {
+
+ /**
+ * The factory we should use for testing.
+ */
+ private static JavaPropertyValueObjectFactory factory;
+
+ /**
+ * The assembly factory used to create Properties.
+ */
+ private static AssemblyFactory assemblyFactory;
+
+ /**
+ * Test Setup.
+ */
+ @BeforeClass
+ public static void setup() {
+ // Create the factory
+ Mediator mediator = EasyMock.createNiceMock(Mediator.class);
+ DataBindingExtensionPoint dpep = new DefaultDataBindingExtensionPoint();
+ EasyMock.expect(mediator.getDataBindings()).andReturn(dpep).anyTimes();
+ EasyMock.replay(mediator);
+ factory = new JavaPropertyValueObjectFactory(mediator);
+
+ // Create the AssemblyFactory we should use
+ assemblyFactory = new DefaultAssemblyFactory();
+ }
+
+ /**
+ * A test that will attempt to inject positive, negative and zero into an
+ * int property.
+ */
+ @Test
+ public void testIntegerInjectionValid() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.expectedType = Integer.TYPE;
+
+ for (int i = -5; i <= 5; i++) {
+ params.propertyValue = Integer.toString(i);
+ params.expectedValueFromFactory = i;
+ doInjection(params);
+ }
+ }
+
+ /**
+ * A test that will attempt to inject positive, negative and zero into an
+ * int property using a JavaElement.
+ */
+ @Test
+ public void testIntegerInjectionValidWithJavaElement() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.expectedJavaElement = new JavaElementImpl(int.class);
+
+ for (int i = -5; i <= 5; i++) {
+ params.propertyValue = Integer.toString(i);
+ params.expectedValueFromFactory = i;
+ doInjection(params);
+ }
+ }
+
+ /**
+ * A test that will attempt to inject multiple int values into an
+ * int property.
+ */
+ @Test
+ public void testIntegerArrayInjectionValid() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.isMany = true;
+ params.expectedType = int.class;
+ params.propertyValue = "1 2 3 4 5";
+ params.expectedValueFromFactory = Arrays.asList(1, 2, 3, 4, 5);
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject multiple int values into an
+ * int property using a JavaElement.
+ */
+ @Test
+ public void testIntegerArrayInjectionValidWithJavaElement() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.isMany = true;
+ params.expectedJavaElement = new JavaElementImpl(int[].class);
+ params.propertyValue = "1 2 3 4 5";
+ int[] expected = { 1, 2, 3, 4, 5 };
+ params.expectedValueFromFactory = expected;
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject a non-number into an
+ * int property.
+ */
+ @Test
+ public void testIntegerInjectionBadNumberInvalid() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.expectedType = Integer.TYPE;
+ params.propertyValue = "a";
+ params.exceptionExpected = true;
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject a non-number into an
+ * int property using a JavaElement.
+ */
+ @Test
+ public void testIntegerInjectionBadNumberInvalidWithJavaElement() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.expectedJavaElement = new JavaElementImpl(Integer.TYPE);
+ params.propertyValue = "a";
+ params.exceptionExpected = true;
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject multiple int values into an
+ * int property where one of the property values is not a number.
+ * The injection should throw ObjectCreationException
+ */
+ @Test
+ public void testIntegerArrayInjectionBadNumberInvalid() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.isMany = true;
+ params.expectedType = int.class;
+ params.propertyValue = "1 2 aa 4 5";
+ params.exceptionExpected = true;
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject multiple int values into an
+ * int property using a JavaElement where one of the property
+ * values is not a number.
+ * The injection should throw ObjectCreationException
+ */
+ @Test
+ public void testIntegerArrayInjectionBadNumberInvalidWithJavaElement() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.isMany = true;
+ params.expectedJavaElement = new JavaElementImpl(int[].class);
+ params.propertyValue = "1 2 aa 4 5";
+ params.exceptionExpected = true;
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject an empty string into an int property.
+ * The injection should throw ObjectCreationException
+ */
+ @Test
+ public void testIntegerInjectionEmptyStringInvalid() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.expectedType = Integer.TYPE;
+ params.propertyValue = "";
+ params.exceptionExpected = true;
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject an empty string into an int property
+ * using a JavaElement.
+ * The injection should throw ObjectCreationException
+ */
+ @Test
+ public void testIntegerInjectionEmptyStringInvalidWithJavaElement() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "intField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_INT;
+ params.expectedJavaElement = new JavaElementImpl(Integer.TYPE);
+ params.propertyValue = "";
+ params.exceptionExpected = true;
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject a String into a String
+ * property.
+ */
+ @Test
+ public void testStringInjectionValid() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "StringField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_STRING;
+ params.expectedType = String.class;
+
+ params.propertyValue = "Some Test String";
+ params.expectedValueFromFactory = "Some Test String";
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject a String into a String
+ * property using a JavaElement.
+ */
+ @Test
+ public void testStringInjectionValidWithJavaElement() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "StringField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_STRING;
+ params.expectedJavaElement = new JavaElementImpl(String.class);
+
+ params.propertyValue = "Some Test String";
+ params.expectedValueFromFactory = "Some Test String";
+ doInjection(params);
+ }
+
+ /**
+ * This class defines all the parameters for the Property Injection test.
+ */
+ private class InjectionTestParams {
+ // Input parameters for the test
+ public boolean isMany = false;
+ public String propertyName;
+ public String propertyValue;
+ public QName xsdType;
+
+ // Expected result for test
+ public Object expectedValueFromFactory;
+ public Class<?> expectedType;
+ public JavaElementImpl expectedJavaElement;
+ public boolean exceptionExpected = false;
+ }
+
+ /**
+ * A test that will attempt to inject multiple String values into an
+ * String property.
+ */
+ @Test
+ public void testStringArrayInjectionValid() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "StringField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_STRING;
+ params.isMany = true;
+ params.expectedType = String.class;
+ params.propertyValue = "\"String1\" \"String2\" \"String3\" \"String4\" \"String5\"";
+ params.expectedValueFromFactory = Arrays.asList(
+ "String1", "String2", "String3", "String4", "String5");
+ doInjection(params);
+ }
+
+ /**
+ * A test that will attempt to inject multiple String values into an
+ * String property using a JavaElement.
+ */
+ @Test
+ public void testStringArrayInjectionValidWithJavaElement() {
+ InjectionTestParams params = new InjectionTestParams();
+ params.propertyName = "StringField";
+ params.xsdType = SimpleTypeMapperImpl.XSD_STRING;
+ params.isMany = true;
+ params.expectedJavaElement = new JavaElementImpl(String.class);
+ params.propertyValue = "\"String1\" \"String2\" \"String3\" \"String4\" \"String5\"";
+ params.expectedValueFromFactory = Arrays.asList(
+ "String1", "String2", "String3", "String4", "String5");
+ doInjection(params);
+ }
+
+ /**
+ * Utility method for testing creating properties with the
+ * JavaPropertyValueObjectFactory.
+ *
+ * @param testParams The parameters for the test
+ */
+ private void doInjection(final InjectionTestParams testParams) {
+ // Create the property
+ Property prop = assemblyFactory.createProperty();
+ prop.setMany(testParams.isMany);
+ prop.setName(testParams.propertyName);
+ prop.setXSDType(testParams.xsdType);
+
+ // Mock up the XML that will contain the Property details
+ Document doc = EasyMock.createNiceMock(Document.class);
+ Element rootElement = EasyMock.createMock(Element.class);
+ EasyMock.expect(doc.getDocumentElement()).andReturn(rootElement);
+ NodeList nodeList = EasyMock.createMock(NodeList.class);
+ EasyMock.expect(rootElement.getChildNodes()).andReturn(nodeList).anyTimes();
+ EasyMock.expect(nodeList.getLength()).andReturn(1);
+ Node node = EasyMock.createMock(Node.class);
+ EasyMock.expect(nodeList.item(0)).andReturn(node);
+ EasyMock.expect(node.getTextContent()).andReturn(testParams.propertyValue);
+ EasyMock.replay(doc, rootElement, nodeList, node);
+
+ // Create a factory either using the Class or JavaElementImpl constructor
+ ObjectFactory<?> objectFactory;
+ if (testParams.expectedJavaElement != null) {
+ objectFactory = factory.createValueFactory(prop, doc, testParams.expectedJavaElement);
+ } else {
+ objectFactory = factory.createValueFactory(prop, doc, testParams.expectedType);
+ }
+ Assert.assertNotNull(objectFactory);
+
+ // Lets test the factory
+ try {
+ // Create a new instance with the factory
+ Object value = objectFactory.getInstance();
+
+ // Did we expect an exception to be thrown?
+ if (testParams.exceptionExpected) {
+ Assert.fail("Test should have thrown ObjectCreationException");
+ }
+
+ // Make sure the result is of the correct type
+ if (testParams.expectedValueFromFactory instanceof Collection<?>) {
+ // Make sure the Collections contain the same type
+ Assert.assertTrue(value instanceof Collection<?>);
+ Iterator<?> iter1 = ((Collection<?>) testParams.expectedValueFromFactory).iterator();
+ Iterator<?> iter2 = ((Collection<?>) value).iterator();
+ Assert.assertEquals(iter1.next().getClass(), iter2.next().getClass());
+ } else {
+ Assert.assertEquals(testParams.expectedValueFromFactory.getClass(), value.getClass());
+ }
+
+ // Validate the result
+ Assert.assertNotNull(value);
+ if (testParams.expectedValueFromFactory.getClass().isArray()) {
+ Assert.assertTrue(compareArrays(testParams.expectedValueFromFactory, value));
+ } else {
+ Assert.assertEquals(testParams.expectedValueFromFactory, value);
+ }
+ } catch (ObjectCreationException ex) {
+ // Is this an expected exception?
+ if (testParams.exceptionExpected) {
+ // Make sure the exception error message contains the property name
+ Assert.assertTrue(ex.toString().indexOf(testParams.propertyName) != -1);
+
+ // Make sure the exception error message contains the property value
+ if (testParams.propertyValue != null) {
+ if (testParams.isMany) {
+ // FIXME: No simple way to do this for multi-value properties
+ } else {
+ Assert.assertTrue(ex.toString().indexOf(testParams.propertyValue) != -1);
+ }
+ }
+ } else {
+ // Test failure. We were not expecting an exception
+ ex.printStackTrace();
+ Assert.fail("Unexpected exception " + ex);
+ }
+ }
+ }
+
+ /**
+ * Compares two Objects that are actually arrays to make sure that they are
+ * equal.
+ *
+ * @param array1 The first array
+ * @param array2 The second array
+ * @return True if they are equal. False if they are not
+ */
+ private boolean compareArrays(final Object array1, final Object array2) {
+ // Check for primitive array types
+ if (array1 instanceof boolean[]) {
+ return Arrays.equals((boolean[]) array1, (boolean[]) array2);
+ }
+ if (array1 instanceof byte[]) {
+ return Arrays.equals((byte[]) array1, (byte[]) array2);
+ }
+ if (array1 instanceof char[]) {
+ return Arrays.equals((char[]) array1, (char[]) array2);
+ }
+ if (array1 instanceof double[]) {
+ return Arrays.equals((double[]) array1, (double[]) array2);
+ }
+ if (array1 instanceof float[]) {
+ return Arrays.equals((float[]) array1, (float[]) array2);
+ }
+ if (array1 instanceof int[]) {
+ return Arrays.equals((int[]) array1, (int[]) array2);
+ }
+ if (array1 instanceof long[]) {
+ return Arrays.equals((long[]) array1, (long[]) array2);
+ }
+ if (array1 instanceof short[]) {
+ return Arrays.equals((short[]) array1, (short[]) array2);
+ }
+
+ // Not a primitive so must be an Object[]
+ return Arrays.equals((Object[]) array1, (Object[]) array2);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java
new file mode 100644
index 0000000000..4de0a4e8c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.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.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.implementation.java.invocation.EventInvocationException;
+import org.apache.tuscany.sca.implementation.java.invocation.MethodEventInvoker;
+
+/**
+ * @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 (EventInvocationException 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
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ privateMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("hidden");
+ exceptionMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("exception");
+
+ }
+
+ public class Foo {
+
+ public void foo() {
+ }
+
+ private void hidden() {
+ }
+
+ public void exception() {
+ throw new RuntimeException();
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java
new file mode 100644
index 0000000000..214779ed3f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.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.injection;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.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
+ }
+ }
+
+ @Override
+ 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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java
new file mode 100644
index 0000000000..c470b8cf3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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(null);
+ assertNotNull(factory.getInstance());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java
new file mode 100644
index 0000000000..c1650c3a83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/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.core.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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java
new file mode 100644
index 0000000000..de371e09bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.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.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * Creates new instances of a Java class
+ *
+ * @version $Rev$ $Date$
+ * @see org.apache.tuscany.sca.implementation.java.injection.Injector
+ */
+public class TestObjectFactory<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 TestObjectFactory(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 TestObjectFactory(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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.java
new file mode 100644
index 0000000000..1fb7abb917
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.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.injection;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestObjectFactoryTestCase extends TestCase {
+
+ private Constructor<Foo> ctor;
+
+ public void testConstructorInjection() throws Exception {
+ List<ObjectFactory> initializers = new ArrayList<ObjectFactory>();
+ initializers.add(new SingletonObjectFactory<String>("foo"));
+ TestObjectFactory<Foo> factory = new TestObjectFactory<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);
+ TestObjectFactory<Foo> factory = new TestObjectFactory<Foo>(ctor, initializers);
+ Foo foo = factory.getInstance();
+ assertNull(foo.foo);
+ }
+
+ public void testConstructorInitializerInjection() throws Exception {
+ TestObjectFactory<Foo> factory = new TestObjectFactory<Foo>(ctor);
+ factory.setInitializerFactory(0, new SingletonObjectFactory<String>("foo"));
+ Foo foo = factory.getInstance();
+ assertEquals("foo", foo.foo);
+ }
+
+ @Override
+ 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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java
new file mode 100644
index 0000000000..e993cdd382
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.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.util;
+
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+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) {
+ }
+
+ @Override
+ public void override(String param) throws Exception {
+ }
+
+
+ public void noOverride(String param) throws Exception {
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java
new file mode 100644
index 0000000000..82264c77c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.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.util;
+
+import java.util.List;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java
new file mode 100644
index 0000000000..a5e12d181c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.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.util;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Entry {
+
+ String getString();
+
+ void setString(String val);
+}
+
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java
new file mode 100644
index 0000000000..ed6bf7ddc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.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.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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaIntrospectionHelperTestCase extends TestCase {
+
+ private List testNoGenericsList;
+ private List<String> testList;
+ private Map<String, Bean1> testMap;
+ private Entry[] 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, true);
+ assertEquals(4, beanFields.size()); //Bean1.ALL_BEAN1_PUBLIC_PROTECTED_FIELDS
+ }
+
+ public void testGetSuperAllMethods() throws Exception {
+ Set<Method> superBeanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(SuperBean.class, true);
+ assertEquals(SuperBean.ALL_SUPER_METHODS, superBeanMethods.size());
+ }
+
+ public void testGetBean1AllMethods() throws Exception {
+ Set<Method> beanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class, true);
+ assertEquals(Bean1.ALL_BEAN1_METHODS, beanMethods.size());
+ }
+
+ public void testOverrideMethod() throws Exception {
+ Set<Method> beanFields = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class, true);
+ 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, true);
+ 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(Entry[] 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-android/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java-xml/LICENSE b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/implementation-java-xml/META-INF/README b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/NOTICE b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/implementation-java-xml/pom.xml b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/pom.xml
new file mode 100644
index 0000000000..d89d7fd406
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/pom.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <name>Apache Tuscany SCA Java Implementation XML Model</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.4-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-contribution-impl</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml-ws</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.java.xml</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.implementation.java.xml*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java
new file mode 100644
index 0000000000..ecbf0c4c78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.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.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+/**
+ * Constants for the Java Implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
new file mode 100644
index 0000000000..11934ec6bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.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.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+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.ComponentType;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+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.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.assembly.xml.ConfiguredOperationProcessor;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.IntrospectionException;
+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.impl.JavaIntrospectionHelper;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaImplementation>,
+ JavaImplementationConstants {
+
+ private JavaImplementationFactory javaFactory;
+ private AssemblyFactory assemblyFactory;
+ private PolicyFactory policyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+ private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
+ private ConfiguredOperationProcessor configuredOperationProcessor;
+ private Monitor monitor;
+
+ public JavaImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.javaFactory = modelFactories.getFactory(JavaImplementationFactory.class);
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ this.monitor = monitor;
+ this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor);
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "impl-javaxml-validation-messages", Severity.ERROR, model, message,(Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "impl-javaxml-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ public JavaImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.java>
+ JavaImplementation javaImplementation = javaFactory.createJavaImplementation();
+
+ /*if ( javaImplementation instanceof PolicySetAttachPoint ) {
+ IntentAttachPointType implType = intentAttachPointTypeFactory.createImplementationType();
+ implType.setName(getArtifactType());
+ implType.setUnresolved(true);
+ ((PolicySetAttachPoint)javaImplementation).setType(implType);
+ }*/
+
+ javaImplementation.setUnresolved(true);
+ javaImplementation.setName(reader.getAttributeValue(null, CLASS));
+
+ // Read policies
+ policyProcessor.readPolicies(javaImplementation, reader);
+
+ // read operation elements if exists or skip unto end element
+ int event;
+ ConfiguredOperation confOp = null;
+ while (reader.hasNext()) {
+ event = reader.next();
+ switch ( event ) {
+ case START_ELEMENT : {
+ if ( Constants.OPERATION_QNAME.equals(reader.getName()) ) {
+ confOp = configuredOperationProcessor.read(reader);
+ if ( confOp != null ) {
+ ((OperationsConfigurator)javaImplementation).getConfiguredOperations().add(confOp);
+ }
+ }
+ }
+ break;
+ }
+
+ if (event == END_ELEMENT && IMPLEMENTATION_JAVA_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return javaImplementation;
+ }
+
+ public void write(JavaImplementation javaImplementation, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+
+ // Write an <implementation.java>
+ policyProcessor.writePolicyPrefixes(javaImplementation, writer);
+ writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_JAVA);
+ policyProcessor.writePolicyAttributes(javaImplementation, writer);
+
+ if (javaImplementation.getName() != null) {
+ writer.writeAttribute(CLASS, javaImplementation.getName());
+ }
+
+ writer.writeEndElement();
+ }
+
+ 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) {
+ error("ClassNotFoundException", resolver, javaImplementation.getName());
+ //throw new ContributionResolveException(new ClassNotFoundException(javaImplementation.getName()));
+ return;
+ }
+
+ javaImplementation.setJavaClass(javaClass);
+
+ try {
+ javaFactory.createJavaImplementation(javaImplementation, javaImplementation.getJavaClass());
+ } catch (IntrospectionException e) {
+ ContributionResolveException ce = new ContributionResolveException(e);
+ error("ContributionResolveException", javaFactory, ce);
+ //throw ce;
+ return;
+ }
+
+ javaImplementation.setUnresolved(false);
+ mergeComponentType(resolver, javaImplementation);
+
+ // FIXME the introspector should always create at least one service
+ if (javaImplementation.getServices().isEmpty()) {
+ javaImplementation.getServices().add(assemblyFactory.createService());
+ }
+ }
+
+ private JavaElementImpl getMemeber(JavaImplementation impl, String name, Class<?> type) {
+ String setter = JavaIntrospectionHelper.toSetter(name);
+ try {
+ Method method = impl.getJavaClass().getDeclaredMethod(setter, type);
+ int mod = method.getModifiers();
+ if ((Modifier.isPublic(mod) || Modifier.isProtected(mod)) && (!Modifier.isStatic(mod))) {
+ return new JavaElementImpl(method, 0);
+ }
+ } catch (NoSuchMethodException e) {
+ Field field;
+ try {
+ field = impl.getJavaClass().getDeclaredField(name);
+ int mod = field.getModifiers();
+ if ((Modifier.isPublic(mod) || Modifier.isProtected(mod)) && (!Modifier.isStatic(mod))) {
+ return new JavaElementImpl(field);
+ }
+ } catch (NoSuchFieldException e1) {
+ // Ignore
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Merge the componentType from introspection and external file
+ * @param resolver
+ * @param impl
+ */
+ private void mergeComponentType(ModelResolver resolver, JavaImplementation impl) {
+ // FIXME: Need to clarify how to merge
+ ComponentType componentType = getComponentType(resolver, impl);
+ if (componentType != null && !componentType.isUnresolved()) {
+ Map<String, Reference> refMap = new HashMap<String, Reference>();
+ for (Reference ref : impl.getReferences()) {
+ refMap.put(ref.getName(), ref);
+ }
+ for (Reference reference : componentType.getReferences()) {
+ refMap.put(reference.getName(), reference);
+ }
+ impl.getReferences().clear();
+ impl.getReferences().addAll(refMap.values());
+
+ // Try to match references by type
+ Map<String, JavaElementImpl> refMembers = impl.getReferenceMembers();
+ for (Reference ref : impl.getReferences()) {
+ if (ref.getInterfaceContract() != null) {
+ Interface i = ref.getInterfaceContract().getInterface();
+ if (i instanceof JavaInterface) {
+ Class<?> type = ((JavaInterface)i).getJavaClass();
+ if (!refMembers.containsKey(ref.getName())) {
+ JavaElementImpl e = getMemeber(impl, ref.getName(), type);
+ if (e != null) {
+ refMembers.put(ref.getName(), e);
+ }
+ }
+ }
+ }
+ }
+
+ Map<String, Service> serviceMap = new HashMap<String, Service>();
+ for (Service svc : impl.getServices()) {
+ serviceMap.put(svc.getName(), svc);
+ }
+ for (Service service : componentType.getServices()) {
+ serviceMap.put(service.getName(), service);
+ }
+ impl.getServices().clear();
+ impl.getServices().addAll(serviceMap.values());
+
+ Map<String, Property> propMap = new HashMap<String, Property>();
+ for (Property prop : impl.getProperties()) {
+ propMap.put(prop.getName(), prop);
+ }
+ for (Property property : componentType.getProperties()) {
+ propMap.put(property.getName(), property);
+ }
+ impl.getProperties().clear();
+ impl.getProperties().addAll(propMap.values());
+
+ if (componentType.getConstrainingType() != null) {
+ impl.setConstrainingType(componentType.getConstrainingType());
+ }
+ }
+ }
+
+ private ComponentType getComponentType(ModelResolver resolver, JavaImplementation impl) {
+ String className = impl.getJavaClass().getName();
+ String componentTypeURI = className.replace('.', '/') + ".componentType";
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ componentType.setURI(componentTypeURI);
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (!componentType.isUnresolved()) {
+ return componentType;
+ }
+ return null;
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_JAVA_QNAME;
+ }
+
+ public Class<JavaImplementation> getModelType() {
+ return JavaImplementation.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..ff43eebcfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+org.apache.tuscany.sca.implementation.java.xml.JavaImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.java,model=org.apache.tuscany.sca.implementation.java.JavaImplementation
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/resources/impl-javaxml-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/resources/impl-javaxml-validation-messages.properties
new file mode 100644
index 0000000000..210b715da8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/main/resources/impl-javaxml-validation-messages.properties
@@ -0,0 +1,23 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+ClassNotFoundException = Class Not Found Exception: {0}
+ContributionResolveException = Contribution Resolve Exception occured due to:
+
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/AddService.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..9c22177684
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/AddService.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;
+
+/**
+ * Interface for the Add Service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..3f28d740a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Add service.
+ *
+ * @version $Rev$ $Date$
+ */
+@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-android/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..e0cf23dc17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/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;
+
+/**
+ * The Calculator service interface.
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..c1fceb575d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Calculator service.
+ *
+ * @version $Rev$ $Date$
+ */
+@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-android/modules/implementation-java-xml/src/test/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..9599c86292
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/DivideService.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;
+
+/**
+ * Interface for the Divide Service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..e1f35f99b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.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.Scope;
+
+/**
+ * An implementation of the Divide service.
+ *
+ * @version $Rev$ $Date$
+ */
+@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-android/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..7a3d06c15e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.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;
+
+/**
+ * Interface for the Multiply Service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..d621407908
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.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.Scope;
+
+/**
+ * An implementation of the Multiply service.
+ *
+ * @version $Rev$ $Date$
+ */
+@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-android/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..21af91f392
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/SubtractService.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;
+
+/**
+ * Interface for the Subtract Service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..4fed0a8c6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.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.Scope;
+
+/**
+ * An implementation of the subtract service.
+ *
+ * @version $Rev$ $Date$
+ */
+@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-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
new file mode 100644
index 0000000000..e5912906f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.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.xml;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+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.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Test reading Java implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
+ private CompositeBuilder compositeBuilder;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+
+ URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+ assertNotNull(composite);
+
+ compositeBuilder.build(composite);
+
+ }
+
+ public void fixmeTestPolicyIntents() throws Exception {
+ ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
+
+ URL url = getClass().getResource("definitions.xml");
+ URI uri = URI.create("definitions.xml");
+ SCADefinitions scaDefns = policyDefinitionsProcessor.read(null, uri, url);
+
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+ assertNotNull(composite);
+
+ staxProcessor.resolve(scaDefns, resolver);
+ staxProcessor.resolve(composite, resolver);
+
+ compositeBuilder.build(composite);
+
+ //intents are computed and aggregate intents from ancestor elements
+ assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getRequiredIntents().size(), 3);
+ assertEquals(((PolicySetAttachPoint)composite.getComponents().get(5)).getRequiredIntents().size(), 3);
+
+ //assertEquals(((OperationsConfigurator)composite.getComponents().get(0)).getConfiguredOperations().isEmpty(), true);
+ //assertEquals(((OperationsConfigurator)composite.getComponents().get(5)).getConfiguredOperations().isEmpty(), false);
+
+
+ //test for proper aggregation of policy intents on implementation elements
+ for ( Intent intent : ((PolicySetAttachPoint)composite.getComponents().get(0).getImplementation()).getRequiredIntents() ) {
+ String intentName = intent.getName().getLocalPart();
+ if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_2") ||
+ intentName.equals("tuscanyIntent_3")) ) {
+ fail();
+ }
+ }
+
+ for ( Intent intent : ((PolicySetAttachPoint)composite.getComponents().get(5)).getRequiredIntents() ) {
+ String intentName = intent.getName().getLocalPart();
+ if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
+ intentName.equals("tuscanyIntent_5")) ) {
+ fail();
+ }
+ }
+
+ //test for proper aggregation of policy intents and policysets on operations of implementation
+ OperationsConfigurator opConf = (OperationsConfigurator)composite.getComponents().get(5);
+ assertEquals(opConf.getConfiguredOperations().get(0).getRequiredIntents().size(), 4);
+ for ( Intent intent : opConf.getConfiguredOperations().get(0).getRequiredIntents()) {
+ String intentName = intent.getName().getLocalPart();
+ if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
+ intentName.equals("tuscanyIntent_5") || intentName.equals("tuscanyIntent_6") ) ) {
+ fail();
+ }
+ }
+
+ opConf = (OperationsConfigurator)composite.getComponents().get(6);
+ assertEquals(opConf.getConfiguredOperations().get(0).getRequiredIntents().size(), 3);
+ for ( Intent intent : opConf.getConfiguredOperations().get(0).getRequiredIntents()) {
+ String intentName = intent.getName().getLocalPart();
+ if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
+ intentName.equals("tuscanyIntent_6.qualified2") ) ) {
+ fail();
+ }
+ }
+ }
+
+ public void testPolicySets() throws Exception {
+ ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
+
+ URL url = getClass().getResource("definitions_with_policysets.xml");
+ URI uri = URI.create("definitions_with_policysets.xml");
+ SCADefinitions policyDefinitions = policyDefinitionsProcessor.read(null, uri, url);
+
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+ assertNotNull(composite);
+
+ for ( Component component : composite.getComponents() ) {
+ for ( PolicySet policySet : policyDefinitions.getPolicySets() ) {
+ component.getApplicablePolicySets().add(policySet);
+ }
+ }
+
+ staxProcessor.resolve(policyDefinitions, resolver);
+ staxProcessor.resolve(composite, resolver);
+
+ compositeBuilder.build(composite);
+
+ //test for determination of policysets for implementation
+ assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getPolicySets().size(), 1);
+ for ( PolicySet policySet : ((PolicySetAttachPoint)composite.getComponents().get(0).getImplementation()).getPolicySets() ) {
+ String policySetName = policySet.getName().getLocalPart();
+ if ( !(policySetName.equals("tuscanyPolicySet_1")) ) {
+ fail();
+ }
+ }
+
+ assertEquals(((PolicySetAttachPoint)composite.getComponents().get(5)).getPolicySets().size(), 2);
+ for ( PolicySet policySet : ((PolicySetAttachPoint)composite.getComponents().get(5).getImplementation()).getPolicySets() ) {
+ String policySetName = policySet.getName().getLocalPart();
+ if ( !(policySetName.equals("tuscanyPolicySet_1") || policySetName.equals("tuscanyPolicySet_2")) ) {
+ fail();
+ }
+ }
+
+ //test for computation of policysets on operations of implementation
+ OperationsConfigurator opConf = (OperationsConfigurator)composite.getComponents().get(5);
+ assertEquals(opConf.getConfiguredOperations().get(0).getPolicySets().size(), 3);
+ for ( PolicySet policySet : opConf.getConfiguredOperations().get(0).getPolicySets() ) {
+ String policySetName = policySet.getName().getLocalPart();
+ if ( !(policySetName.equals("tuscanyPolicySet_1") || policySetName.equals("tuscanyPolicySet_2")
+ || policySetName.equals("tuscanyPolicySet_3")) ) {
+ fail();
+ }
+ }
+
+ opConf = (OperationsConfigurator)composite.getComponents().get(6);
+ assertEquals(opConf.getConfiguredOperations().get(0).getPolicySets().size(), 4);
+ for ( PolicySet policySet : opConf.getConfiguredOperations().get(0).getPolicySets() ) {
+ String policySetName = policySet.getName().getLocalPart();
+ if ( !(policySetName.equals("tuscanyPolicySet_1") || policySetName.equals("tuscanyPolicySet_2")
+ || policySetName.equals("tuscanyPolicySet_3")
+ || policySetName.equals("tuscanyPolicySet_4")) ) {
+ fail();
+ }
+ }
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java
new file mode 100644
index 0000000000..27e3579c35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 wrapping 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-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
new file mode 100644
index 0000000000..646b5db617
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.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.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.Composite;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+
+/**
+ * Test writing Java implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ outputFactory = XMLOutputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
new file mode 100644
index 0000000000..a58fa0c072
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://sample.calculator"
+ requires="cns:tuscanyIntent_1"
+ targetNamespace="http://sample.calculator"
+ xmlns:cns="http://test"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent" requires="cns:tuscanyIntent_2">
+ <implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_3" />
+ <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>
+
+ <component name="AnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
+ <implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_5">
+ <operation name="add" requires="cns:tuscanyIntent_6"/>
+ </implementation.java>
+ </component>
+
+ <component name="YetAnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
+ <implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_6.qualified1">
+ <operation name="add" requires="cns:tuscanyIntent_6.qualified2" policySets="cns:tuscanyPolicySet_4"/>
+ </implementation.java>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml
new file mode 100644
index 0000000000..cddc134c2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml
@@ -0,0 +1,100 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- simple intent -->
+ <sca:intent name="tuscanyIntent_1"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_2"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_3"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_4"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+<sca:intent name="tuscanyIntent_5"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_6"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_7"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_8"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <!-- qualified intents -->
+ <sca:intent name="tuscanyIntent_1.qualified" />
+ <sca:intent name="tuscanyIntent_2.qualified" />
+ <sca:intent name="tuscanyIntent_6.qualified1" />
+ <sca:intent name="tuscanyIntent_6.qualified2" />
+
+ <sca:policySet name="tuscanyPolicySet_4"
+ provides="tuscanyIntent_6"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="tuscanyIntent_6" default="qualified2">
+ <sca:qualifier name="qualified2">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "qualified2" alternative" -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:policySet>
+</sca:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml
new file mode 100644
index 0000000000..9147133d5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml
@@ -0,0 +1,133 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- simple intent -->
+ <sca:intent name="tuscanyIntent_1"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_2"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_3"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_4"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+<sca:intent name="tuscanyIntent_5"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_6"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_7"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_8"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:policySet name="tuscanyPolicySet_1"
+ provides="tuscanyIntent_1 tuscanyIntent_2 tuscanyIntent_3"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ </sca:policySet>
+
+ <sca:policySet name="tuscanyPolicySet_2"
+ provides="tuscanyIntent_4 tuscanyIntent_5"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ </sca:policySet>
+
+ <sca:policySet name="tuscanyPolicySet_3"
+ provides="tuscanyIntent_6"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="tuscanyIntent_6" default="qualified1">
+ <sca:qualifier name="qualified1">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "qualified1" alternative -->
+ </wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="qualifed2">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "qualified2" alternative" -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:policySet>
+
+ <sca:policySet name="tuscanyPolicySet_4"
+ provides="tuscanyIntent_6"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="tuscanyIntent_6" default="qualified2">
+ <sca:qualifier name="qualified2">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "qualified2" alternative" -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:policySet>
+
+ <!-- qualified intents -->
+ <sca:intent name="tuscanyIntent_1.qualified" />
+ <sca:intent name="tuscanyIntent_2.qualified" />
+ <sca:intent name="tuscanyIntent_6.qualified1" />
+ <sca:intent name="tuscanyIntent_6.qualified2" />
+</sca:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/LICENSE b/sca-java-1.x/branches/sca-android/modules/implementation-java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/implementation-java/META-INF/README b/sca-java-1.x/branches/sca-android/modules/implementation-java/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/NOTICE b/sca-java-1.x/branches/sca-android/modules/implementation-java/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/implementation-java/pom.xml b/sca-java-1.x/branches/sca-android/modules/implementation-java/pom.xml
new file mode 100644
index 0000000000..19adeeaf46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <name>Apache Tuscany SCA Java Implementation Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.java</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.implementation.java*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java
new file mode 100644
index 0000000000..c8b7c072ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.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;
+
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BaseJavaImplementation extends Implementation, Extensible {
+
+ /**
+ * 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java
new file mode 100644
index 0000000000..e44ebd7c91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.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;
+
+/**
+ * A factory for the Java model.
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java
new file mode 100644
index 0000000000..2198a632c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/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;
+
+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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
new file mode 100644
index 0000000000..2ad7edbd6f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.Collection;
+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;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+
+/**
+ * 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
+ */
+ JavaConstructorImpl<?> getConstructor();
+
+ /**
+ * Sets the constructor used to instantiate implementation instances
+ *
+ * @param definition the constructor used to instantiate implementation instances
+ */
+ void setConstructor(JavaConstructorImpl<?> definition);
+
+ /**
+ * Returns the component initializer method.
+ *
+ * @return the component initializer method
+ */
+ Method getInitMethod();
+
+ /**
+ * Sets the component initializer method.
+ *
+ * @param initMethod the component initializer method
+ */
+ void setInitMethod(Method initMethod);
+
+ /**
+ * Returns the component destructor method.
+ *
+ * @return the component destructor method
+ */
+ Method getDestroyMethod();
+
+ /**
+ * Sets the component destructor method.
+ *
+ * @param destroyMethod the component destructor method
+ */
+ void setDestroyMethod(Method destroyMethod);
+
+ /**
+ * Returns the resources injected into this implementation.
+ *
+ * @return
+ */
+ Map<String, JavaResourceImpl> getResources();
+
+ /**
+ * Returns the Java member used to inject a conversation ID.
+ *
+ * @return
+ */
+ List<Member> getConversationIDMembers();
+
+ /**
+ * Sets the Java member used to inject a conversation ID.
+ *
+ * @param conversationIDMember
+ */
+ void addConversationIDMember(Member conversationIDMember);
+
+ /**
+ * Returns true if AllowsPassReference is set.
+ *
+ * @return true if AllowsPassByReference is set
+ */
+ boolean isAllowsPassByReference();
+
+ /**
+ * @param allowsPassByReference the allowsPassByReference to set
+ */
+ void setAllowsPassByReference(boolean allowsPassByReference);
+
+ /**
+ * @return the allowsPassByReferenceMethods
+ */
+ List<Method> getAllowsPassByReferenceMethods();
+
+ /**
+ * @param method
+ * @return
+ */
+ boolean isAllowsPassByReference(Method method);
+
+ /**
+ * @return the constructors
+ */
+ Map<Constructor, JavaConstructorImpl> getConstructors();
+
+ /**
+ * @return the eagerInit
+ */
+ boolean isEagerInit();
+
+ /**
+ * @param eagerInit the eagerInit to set
+ */
+ void setEagerInit(boolean eagerInit);
+
+ /**
+ * @return the callbacks
+ */
+ Map<String, Collection<JavaElementImpl>> getCallbackMembers();
+
+ /**
+ * @return the properties
+ */
+ Map<String, JavaElementImpl> getPropertyMembers();
+
+ /**
+ * @return the references
+ */
+ Map<String, JavaElementImpl> getReferenceMembers();
+
+ /**
+ * @return the scope
+ */
+ JavaScopeImpl getJavaScope();
+
+ /**
+ * @param scope the scope to set
+ */
+ void setJavaScope(JavaScopeImpl scope);
+
+ /**
+ * @return the maxAge
+ */
+ long getMaxAge();
+
+ /**
+ * @param maxAge the maxAge to set
+ */
+ void setMaxAge(long maxAge);
+
+ /**
+ * @return the maxIdleTime
+ */
+ long getMaxIdleTime();
+
+ /**
+ * @param maxIdleTime the maxIdleTime to set
+ */
+ void setMaxIdleTime(long maxIdleTime);
+
+ /**
+ * @return the map of a policy handler class names
+ */
+ List<PolicyHandlerTuple> getPolicyHandlerClassNames();
+
+ /**
+ * @param policyHandlerClassNames Map of policyhandler class names
+ */
+ void setPolicyHandlerClassNames(List<PolicyHandlerTuple> policyHandlerClassNames);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java
new file mode 100644
index 0000000000..8228c80372
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.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;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+
+
+/**
+ * Factory for the Java model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImplementationFactory {
+
+ /**
+ * Creates a new Java implementation model.
+ *
+ * @return
+ */
+ JavaImplementation createJavaImplementation();
+
+ /**
+ * Creates a new Java implementation model from an implementation class.
+ *
+ * @param implementationClass The implementation class to introspect.
+ * @return
+ */
+ JavaImplementation createJavaImplementation(Class<?> implementationClass) throws IntrospectionException;
+
+ /**
+ * Creates the contents of a Java implementation model from an implementation class.
+ *
+ * @param implementationClass The implementation class to introspect.
+ * @return
+ */
+ void createJavaImplementation(JavaImplementation javaImplementation, Class<?> implementationClass) throws IntrospectionException;
+
+ /**
+ * 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java
new file mode 100644
index 0000000000..97773879fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.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.impl;
+
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.implementation.java.BaseJavaImplementation;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class BaseJavaImplementationImpl extends ImplementationImpl 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 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 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java
new file mode 100644
index 0000000000..0bcec3c78f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.java.impl;
+
+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.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+
+/**
+ * An extensible Java class introspector implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaClassIntrospectorImpl {
+
+ private List<JavaClassVisitor> visitors;
+
+ public JavaClassIntrospectorImpl(List<JavaClassVisitor> visitors) {
+ this.visitors = visitors;
+ }
+
+ /**
+ * 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 void introspectClass(JavaImplementation type, Class<?> clazz)
+ 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<Field> fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(clazz, true);
+ for (Field field : fields) {
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitField(field, type);
+ }
+ }
+
+ // Check if any private fields have illegal annotations that should be raised as errors
+ Set<Field> privateFields = JavaIntrospectionHelper.getPrivateFields(clazz);
+ for (Field field : privateFields) {
+ for (JavaClassVisitor processor : visitors) {
+ processor.visitField(field, type);
+ }
+ }
+
+ Set<Method> methods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(clazz, true);
+ for (Method method : methods) {
+ for (JavaClassVisitor processor : visitors) {
+ processor.visitMethod(method, type);
+ }
+ }
+
+ // Check if any private methods have illegal annotations that should be raised as errors
+ Set<Method> privateMethods = JavaIntrospectionHelper.getPrivateMethods(clazz);
+ for (Method method : privateMethods) {
+ for (JavaClassVisitor processor : visitors) {
+ processor.visitMethod(method, type);
+ }
+ }
+
+ Class superClass = clazz.getSuperclass();
+ if (superClass != null) {
+ visitSuperClass(superClass, type);
+ }
+
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitEnd(clazz, 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java
new file mode 100644
index 0000000000..2365298f71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.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.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 annotations
+ 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;
+ }
+
+ @Override
+ 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 classifier
+ */
+ public Class<? extends Annotation> getClassifer() {
+ return classifer;
+ }
+
+ /**
+ * @param classifer the classifier to set
+ */
+ public void setClassifer(Class<? extends Annotation> classifer) {
+ this.classifer = classifer;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java
new file mode 100644
index 0000000000..46594e0f50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.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.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+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.ComponentNameProcessor;
+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.ConversationIDProcessor;
+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.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * A module activator for the Java implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+ ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
+
+ BaseJavaClassVisitor[] extensions =
+ new BaseJavaClassVisitor[] {new ConstructorProcessor(assemblyFactory),
+ new AllowsPassByReferenceProcessor(assemblyFactory),
+ new ComponentNameProcessor(assemblyFactory),
+ new ContextProcessor(assemblyFactory),
+ new ConversationIDProcessor(assemblyFactory),
+ new ConversationProcessor(assemblyFactory),
+ new DestroyProcessor(assemblyFactory), new EagerInitProcessor(assemblyFactory),
+ new InitProcessor(assemblyFactory), new PropertyProcessor(assemblyFactory),
+ new ReferenceProcessor(assemblyFactory, javaFactory),
+ new ResourceProcessor(assemblyFactory), new ScopeProcessor(assemblyFactory),
+ new ServiceProcessor(assemblyFactory, javaFactory),
+ new HeuristicPojoProcessor(assemblyFactory, javaFactory),
+ new PolicyProcessor(assemblyFactory, policyFactory)};
+
+ JavaImplementationFactory javaImplementationFactory = modelFactories.getFactory(JavaImplementationFactory.class);
+ for (JavaClassVisitor extension : extensions) {
+ javaImplementationFactory.addClassVisitor(extension);
+ }
+
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java
new file mode 100644
index 0000000000..0cc78498e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.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.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+
+/**
+ * A factory for the Java model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class JavaImplementationFactoryImpl implements JavaImplementationFactory {
+
+ private List<JavaClassVisitor> visitors = new ArrayList<JavaClassVisitor>();
+ private JavaClassIntrospectorImpl introspector;
+
+ public JavaImplementationFactoryImpl() {
+ introspector = new JavaClassIntrospectorImpl(visitors);
+ }
+
+ public JavaImplementation createJavaImplementation() {
+ JavaImplementation javaImplementation = new JavaImplementationImpl();
+ return javaImplementation;
+ }
+
+ public JavaImplementation createJavaImplementation(Class<?> implementationClass) throws IntrospectionException {
+ JavaImplementation javaImplementation = createJavaImplementation();
+ introspector.introspectClass(javaImplementation, implementationClass);
+ return javaImplementation;
+ }
+
+ public void createJavaImplementation(JavaImplementation javaImplementation, Class<?> implementationClass) throws IntrospectionException {
+ introspector.introspectClass(javaImplementation, implementationClass);
+ }
+
+ 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java
new file mode 100644
index 0000000000..375896cf26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.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.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+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.policy.util.PolicyHandlerTuple;
+
+/**
+ * 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, Collection<JavaElementImpl>> callbackMembers = new HashMap<String, Collection<JavaElementImpl>>();
+ private List<Member> conversationIDMember = new ArrayList<Member>();
+ 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;
+ private List<PolicyHandlerTuple> policyHandlerClassNames = null;
+
+ 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 List<Member> getConversationIDMembers() {
+ return this.conversationIDMember;
+ }
+
+ public void addConversationIDMember(Member conversationIDMember) {
+ this.conversationIDMember.add(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, Collection<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;
+ }
+
+ public List<PolicyHandlerTuple> getPolicyHandlerClassNames() {
+ return policyHandlerClassNames;
+ }
+
+ public void setPolicyHandlerClassNames(List<PolicyHandlerTuple> policyHandlerClassNames) {
+ this.policyHandlerClassNames = policyHandlerClassNames;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java
new file mode 100644
index 0000000000..85c2f73f75
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.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.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;
+ }
+
+ @Override
+ 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);
+ }
+
+ @Override
+ public int hashCode() {
+ return scope != null ? scope.hashCode() : 0;
+ }
+
+ @Override
+ public String toString() {
+ return scope;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java
new file mode 100644
index 0000000000..4fa40dee4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.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 org.apache.tuscany.sca.implementation.java.IntrospectionException;
+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 evaluating 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java
new file mode 100644
index 0000000000..9596fe0808
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.List;
+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.IntrospectionException;
+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.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;
+ }
+
+ private boolean removeProperty(JavaElementImpl prop, JavaImplementation type) {
+ if(prop==null) {
+ return false;
+ }
+ List<Property> props = type.getProperties();
+ for(int i=0;i<props.size();i++) {
+ if(props.get(i).getName().equals(prop.getName())) {
+ props.remove(i);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ A annotation = method.getAnnotation(annotationClass);
+ if (annotation == null) {
+ return;
+ }
+
+ if (!JavaIntrospectionHelper.isSetter(method)) {
+ throw new IllegalPropertyException("Annotated method is not a setter: " + method, 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();
+ JavaElementImpl prop = properties.get(name);
+ // Setter override field
+ if (prop != null && prop.getElementType() != ElementType.FIELD) {
+ throw new DuplicatePropertyException(name);
+ }
+
+ removeProperty(prop, type);
+
+ 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);
+ }
+
+ @Override
+ 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();
+ JavaElementImpl prop = properties.get(name);
+ // Setter override field
+ if (prop != null && prop.getElementType() == ElementType.FIELD) {
+ throw new DuplicatePropertyException(name);
+ }
+
+ if (prop == null) {
+ JavaElementImpl element = new JavaElementImpl(field);
+ Property property = createProperty(name, element);
+ initProperty(property, annotation);
+ type.getProperties().add(property);
+ properties.put(name, element);
+ }
+ }
+
+ @Override
+ 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();
+ }
+
+ JavaElementImpl prop = properties.get(name);
+ // Setter override field
+ if (prop != null && prop.getElementType() != ElementType.FIELD) {
+ throw new DuplicatePropertyException(name);
+ }
+ removeProperty(prop, type);
+
+ 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java
new file mode 100644
index 0000000000..4a3ce0c343
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.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.introspect.impl;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+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);
+ }
+
+ @Override
+ 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java
new file mode 100644
index 0000000000..c6e6b6e4d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java
new file mode 100644
index 0000000000..bc6551d45d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.IntrospectionException;
+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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java
new file mode 100644
index 0000000000..556f0b77e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.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.IntrospectionException;
+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.osoa.sca.annotations.ComponentName;
+
+/**
+ * Processes {@link @ComponentName} annotations on a component implementation and adds
+ * a {@link JavaMappedProperty} to the component type which will be used to
+ * inject the appropriate component name.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentNameProcessor extends BaseJavaClassVisitor {
+
+ public ComponentNameProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ if (method.getAnnotation(ComponentName.class) == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalContextException("ComponentName setter must have one parameter", method);
+ }
+ Class<?> paramType = method.getParameterTypes()[0];
+ String name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ if (String.class.equals(paramType)) {
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ element.setName(name);
+ element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ } else {
+ throw new IllegalContextException(paramType.getName());
+ }
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ if (field.getAnnotation(ComponentName.class) == null) {
+ return;
+ }
+ Class<?> paramType = field.getType();
+ if (String.class.equals(paramType)) {
+ JavaElementImpl element = new JavaElementImpl(field);
+ element.setClassifer(Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ } else {
+ throw new IllegalContextException(paramType.getName());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java
new file mode 100644
index 0000000000..17e28479d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.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.introspect.impl;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+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;
+
+/**
+ * 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);
+ }
+
+ @Override
+ 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);
+ }
+ }
+ }
+
+ @Override
+ 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 Number 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java
new file mode 100644
index 0000000000..177ceaa57c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.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.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.IntrospectionException;
+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.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);
+ }
+
+ @Override
+ 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.sca.implementation.java.introspect.impl.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ } else {
+ throw new UnknownContextTypeException(paramType.getName());
+ }
+ }
+
+ @Override
+ 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(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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java
new file mode 100644
index 0000000000..985f8baa82
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.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.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+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.osoa.sca.annotations.ConversationID;
+
+/**
+ * Processes {@link @ConversationID} annotations on a component implementation and adds
+ * a {@link JavaMappedProperty} to the component type which will be used to
+ * inject the appropriate conversationId
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationIDProcessor extends BaseJavaClassVisitor {
+
+ public ConversationIDProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ if (method.getAnnotation(ConversationID.class) == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalContextException("ConversationID setter must have one parameter", method);
+ }
+ String name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ element.setName(name);
+ element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ if (field.getAnnotation(ConversationID.class) == null) {
+ return;
+ }
+ JavaElementImpl element = new JavaElementImpl(field);
+ element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java
new file mode 100644
index 0000000000..efd04262dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.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.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.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+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);
+ }
+
+ @Override
+ 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 (conversation != null) {
+ long maxAge;
+ long maxIdleTime;
+ String maxAgeVal = conversation.maxAge();
+ String maxIdleTimeVal = conversation.maxIdleTime();
+ 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);
+ }
+ }
+
+ }
+
+ @Override
+ public void visitMethod(Method method,
+ JavaImplementation type) throws IntrospectionException {
+ ConversationID conversationID = method.getAnnotation(ConversationID.class);
+ if (conversationID == null) {
+ return;
+ }
+ type.addConversationIDMember(method);
+ }
+
+ @Override
+ public void visitField(Field field,
+ JavaImplementation type) throws IntrospectionException {
+ ConversationID conversationID = field.getAnnotation(ConversationID.class);
+ if (conversationID == null) {
+ return;
+ }
+ type.addConversationIDMember(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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java
new file mode 100644
index 0000000000..50e4d46e97
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.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.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.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+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);
+ }
+
+ @Override
+ 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(!method.getReturnType().equals(void.class)) {
+ throw new IllegalDestructorException("Destructor must return void.", method);
+ }
+ if (type.getDestroyMethod() != null) {
+ throw new DuplicateDestructorException("More than one destructor found on implementation");
+ }
+ if (!Modifier.isPublic(method.getModifiers())) {
+ throw new IllegalDestructorException("Destructor must be a public method. Invalid annotation @Destroy found on "+method);
+ }
+ type.setDestroyMethod(method);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java
new file mode 100644
index 0000000000..88a245cbf3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java
new file mode 100644
index 0000000000..9b834e7e87
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java
new file mode 100644
index 0000000000..4325faef26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java
new file mode 100644
index 0000000000..b9e1923e73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.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.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java
new file mode 100644
index 0000000000..300ad6817e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java
new file mode 100644
index 0000000000..2d177b3f76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java
new file mode 100644
index 0000000000..5619275b82
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.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 org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+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);
+ }
+
+ @Override
+ 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
new file mode 100644
index 0000000000..b7f6748ed2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
@@ -0,0 +1,615 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jws.WebService;
+
+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.IntrospectionException;
+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.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.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;
+
+/**
+ * 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 interface 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;
+
+ public HeuristicPojoProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+ super(assemblyFactory);
+ this.javaFactory = javaFactory;
+ }
+
+ @Override
+ 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
+ /**
+ * The following is quoted from Java Specification 1.2.1.3. Introspecting services offered by a Java implementation
+ * In the cases described below, the services offered by a Java implementation class may be determined
+ * through introspection, eliding the need to specify them using @Service. The following algorithm is used
+ * to determine how services are introspected from an implementation class:
+ *
+ * If the interfaces of the SCA services are not specified with the @Service annotation on the
+ * implementation class, it is assumed that all implemented interfaces that have been annotated
+ * as @Remotable are the service interfaces provided by the component. If none of the implemented
+ * interfaces is remotable, then by default the implementation offers a single service whose type
+ * is the implementation class.
+ */
+ Set<Class> interfaces = getAllInterfaces(clazz);
+ for (Class<?> i : interfaces) {
+ if (i.isAnnotationPresent(Remotable.class) || i.isAnnotationPresent(WebService.class)) {
+ addService(type, i);
+ }
+ }
+ if (services.isEmpty()) {
+ // class is the interface
+ addService(type, clazz);
+ }
+ }
+ Set<Method> methods = getAllUniquePublicProtectedMethods(clazz, false);
+ 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>();
+ Set<String> others = new HashSet<String>();
+ for (Method method : methods) {
+ if (!isPublicSetter(method)) {
+ continue;
+ }
+ if (method.isAnnotationPresent(Callback.class) || method.isAnnotationPresent(Context.class)) {
+ // Add the property name as others
+ others.add(toPropertyName(method.getName()));
+ 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)) {
+ // Add the property name as others
+ others.add(toPropertyName(method.getName()));
+ continue;
+ }
+ Class<?> param = method.getParameterTypes()[0];
+ String name = toPropertyName(method.getName());
+ setters.add(name);
+ // avoid duplicate property or ref names
+ if (isReferenceType(param, method.getGenericParameterTypes()[0])) {
+ if (!type.getReferenceMembers().containsKey(name)) {
+ type.getReferences().add(createReference(name, param));
+ type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
+ }
+ } else {
+ if (!type.getPropertyMembers().containsKey(name)) {
+ 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, false);
+ for (Field field : fields) {
+ if (field.isAnnotationPresent(Callback.class) || field.isAnnotationPresent(Context.class)) {
+ continue;
+ }
+ if (setters.contains(field.getName()) || others.contains(field.getName())) {
+ continue;
+ }
+ String name = field.getName();
+ Class<?> paramType = field.getType();
+ if (isReferenceType(paramType, field.getGenericType())) {
+ if (!type.getReferenceMembers().containsKey(name)) {
+ type.getReferences().add(createReference(name, paramType));
+ type.getReferenceMembers().put(name, new JavaElementImpl(field));
+ }
+ } else {
+ if (!type.getPropertyMembers().containsKey(name)) {
+ 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 member is 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);
+ }
+
+ /**
+ * 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 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;
+ }
+
+ 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 = javaFactory.createJavaInterface(paramType);
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ } catch (InvalidInterfaceException e1) {
+ throw new IntrospectionException(e1);
+ }
+
+ // FIXME: This part seems to have already been taken care above!!
+ 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 = javaFactory.createJavaInterface(interfaze);
+ service.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(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;
+ try {
+ javaInterface = javaFactory.createJavaInterface(callbackClass);
+ contract.getInterfaceContract().setCallbackInterface(javaInterface);
+ } catch (InvalidInterfaceException e) {
+ throw new InvalidServiceType("Invalid callback interface "+callbackClass, interfaze);
+ }
+ } 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)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java
new file mode 100644
index 0000000000..9fe2fcd468
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.IntrospectionException;
+
+/**
+ * Denotes an illegal 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java
new file mode 100644
index 0000000000..f5696122df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java
new file mode 100644
index 0000000000..6a0d60c92f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java
new file mode 100644
index 0000000000..8f50852c2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.java
new file mode 100644
index 0000000000..54f7dfad1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.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.IntrospectionException;
+
+/**
+ * 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java
new file mode 100644
index 0000000000..25196c56e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java
new file mode 100644
index 0000000000..ccfbaf0043
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java
new file mode 100644
index 0000000000..e130f4221d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java
new file mode 100644
index 0000000000..583ccc86cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.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.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.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+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);
+ }
+
+ @Override
+ 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(!method.getReturnType().equals(void.class)) {
+ throw new IllegalInitException("Initializer must return void.", method);
+ }
+ if (type.getInitMethod() != null) {
+ throw new DuplicateInitException("More than one initializer found on implementaton");
+ }
+ if (!Modifier.isPublic(method.getModifiers())) {
+ throw new IllegalInitException("Initializer must be a public method. Invalid annotation @Init found on "+method);
+ }
+ type.setInitMethod(method);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java
new file mode 100644
index 0000000000..91b97b2caf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java
new file mode 100644
index 0000000000..a1e1d01ab3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java
new file mode 100644
index 0000000000..976b4da120
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java
new file mode 100644
index 0000000000..e77a6beb0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java
new file mode 100644
index 0000000000..debb5cbacc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java
new file mode 100644
index 0000000000..7147da55b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
new file mode 100644
index 0000000000..6039bd91f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
@@ -0,0 +1,577 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+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.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import org.osoa.sca.CallableReference;
+
+/**
+ * Implements various reflection-related operations
+ *
+ * @version $Rev$ $Date$
+ */
+public final class JavaIntrospectionHelper {
+ private static final Logger logger = Logger.getLogger(JavaIntrospectionHelper.class.getName());
+ 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, boolean validating) {
+ return getAllPublicAndProtectedFields(clazz, new HashSet<Field>(), validating);
+ }
+
+ private static void checkInvalidAnnotations(AnnotatedElement element) {
+ for (Annotation a : element.getAnnotations()) {
+ if (a.annotationType().getName().startsWith("org.osoa.sca.annotations.")) {
+ logger.warning("Invalid annotation " + a + " is found on " + element);
+ }
+ }
+ }
+
+ /**
+ * Recursively evaluates the type hierarchy to return all fields that are
+ * public or protected
+ */
+ private static Set<Field> getAllPublicAndProtectedFields(Class clazz, Set<Field> fields, boolean validating) {
+ if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) {
+ return fields;
+ }
+ fields = getAllPublicAndProtectedFields(clazz.getSuperclass(), fields, validating);
+ Field[] declaredFields = clazz.getDeclaredFields();
+ for (final Field field : declaredFields) {
+ int modifiers = field.getModifiers();
+ if ((Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) && !Modifier.isStatic(modifiers)) {
+ // Allow privileged access to set accessibility. Requires ReflectPermission
+ // in security policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ field.setAccessible(true); // ignore Java accessibility
+ return null;
+ }
+ });
+ fields.add(field);
+ } else {
+ if (validating) {
+ checkInvalidAnnotations(field);
+ }
+ }
+ }
+ return fields;
+ }
+
+ /**
+ * Returns a collection of public and protected methods declared by a class
+ * or one of its supertypes. Note that overridden 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, boolean validating) {
+ return getAllUniqueMethods(clazz, new HashSet<Method>(), validating);
+ }
+
+ /**
+ * Recursively evaluates the type hierarchy to return all unique methods
+ */
+ private static Set<Method> getAllUniqueMethods(Class pClass, Set<Method> methods, boolean validating) {
+ 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 (final Method declaredMethod : declaredMethods) {
+ int modifiers = declaredMethod.getModifiers();
+ if ((!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) || Modifier.isStatic(modifiers)) {
+ if (validating) {
+ checkInvalidAnnotations(declaredMethod);
+ }
+ 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 superclass (i.e.
+ // the method is not overridden)
+ if (exactMethodMatch(declaredMethod, method)) {
+ matched = true;
+ break;
+ }
+ }
+ if (!matched) {
+ // Allow privileged access to set accessibility. Requires ReflectPermission
+ // in security policy.
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ declaredMethod.setAccessible(true);
+ return null;
+ }
+ });
+ temp.add(declaredMethod);
+ }
+ methods.addAll(temp);
+ temp.clear();
+ }
+ }
+ // evaluate class hierarchy - this is done last to track inherited
+ // methods
+ methods = getAllUniqueMethods(pClass.getSuperclass(), methods, validating);
+ 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 implementation 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;
+ }
+ }
+
+ public static Type getParameterType(Type type) {
+ if (type instanceof ParameterizedType) {
+ // Collection<BaseType>
+ ParameterizedType parameterizedType = (ParameterizedType)type;
+ Type baseType = parameterizedType.getActualTypeArguments()[0];
+ return baseType;
+ } else {
+ return Object.class;
+ }
+ }
+
+ public static Class<?> getBusinessInterface(Class<?> cls, Type callableReferenceType) {
+ if (CallableReference.class.isAssignableFrom(cls) && callableReferenceType instanceof ParameterizedType) {
+ // Collection<BaseType>
+ ParameterizedType parameterizedType = (ParameterizedType)callableReferenceType;
+ Type baseType = parameterizedType.getActualTypeArguments()[0];
+ if (baseType instanceof GenericArrayType) {
+ // Base is array
+ return cls;
+ } else {
+ return getErasure(baseType);
+ }
+ }
+ return Object.class;
+ }
+
+ /**
+ * 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);
+ }
+ }
+
+ public static boolean isSetter(Method method) {
+ return (void.class == method.getReturnType() && method.getParameterTypes().length == 1 && method.getName()
+ .startsWith("set"));
+ }
+
+ public static boolean isGetter(Method method) {
+ return (void.class != method.getReturnType() && method.getParameterTypes().length == 0 && method.getName()
+ .startsWith("get"));
+ }
+
+ private final static Map<Class, String> signatures = new HashMap<Class, String>();
+ static {
+ signatures.put(boolean.class, "Z");
+ signatures.put(byte.class, "B");
+ signatures.put(char.class, "C");
+ signatures.put(short.class, "S");
+ signatures.put(int.class, "I");
+ signatures.put(long.class, "J");
+ signatures.put(float.class, "F");
+ signatures.put(double.class, "D");
+ };
+
+ public static String getSignature(Class<?> cls) {
+ if (cls.isPrimitive()) {
+ return signatures.get(cls);
+ }
+ if (cls.isArray()) {
+ return "[" + getSignature(cls.getComponentType());
+ }
+ return "L" + cls.getName().replace('.', '/') + ";";
+ }
+
+ public static Class<?> getArrayType(Class<?> componentType, int dims) throws ClassNotFoundException {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < dims; i++) {
+ buf.append('[');
+ }
+ buf.append(getSignature(componentType));
+ return Class.forName(buf.toString(), false, componentType.getClassLoader());
+ }
+
+ public static Set<Method> getPrivateMethods(Class clazz) {
+ Set<Method> methods = new HashSet<Method>();
+ Method[] declaredMethods = clazz.getDeclaredMethods();
+ for (final Method declaredMethod : declaredMethods) {
+ int modifiers = declaredMethod.getModifiers();
+ if(Modifier.isPrivate(modifiers)) {
+ methods.add(declaredMethod);
+ }
+ }
+
+ return methods;
+ }
+
+ public static Set<Field> getPrivateFields(Class clazz) {
+ Set<Field> fields = new HashSet<Field>();
+ Field[] declaredFields = clazz.getDeclaredFields();
+ for (final Field declaredField : declaredFields) {
+ int modifiers = declaredField.getModifiers();
+ if(Modifier.isPrivate(modifiers)) {
+ fields.add(declaredField);
+ }
+ }
+
+ return fields;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java
new file mode 100644
index 0000000000..453cfa35fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
new file mode 100644
index 0000000000..954a3abbc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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 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.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+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.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.osoa.sca.annotations.PolicySets;
+import org.osoa.sca.annotations.Requires;
+
+/**
+ * Processes an {@link org.osoa.sca.annotations.Requires} annotation
+ *
+ * @version $Rev$ $Date$
+ */
+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 readIntentsAndPolicySets(Class<?> clazz,
+ List<Intent> requiredIntents,
+ List<PolicySet> policySets) {
+ 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);
+ }
+ }
+ }
+
+ PolicySets policySetAnnotation = clazz.getAnnotation(PolicySets.class);
+ if (policySetAnnotation != null) {
+ String[] policySetNames = policySetAnnotation.value();
+ if (policySetNames.length != 0) {
+ for (String policySetName : policySetNames) {
+
+ // Add each intent to the list
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(getQName(policySetName));
+ policySets.add(policySet);
+ }
+ }
+ }
+ }
+
+ private void readIntents(Requires intentAnnotation, 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);
+ }
+ }
+ }
+ }
+
+ private void readPolicySets(PolicySets policySetAnnotation, List<PolicySet> policySets) {
+ if (policySetAnnotation != null) {
+ String[] policySetNames = policySetAnnotation.value();
+ if (policySetNames.length != 0) {
+ //Operation operation = assemblyFactory.createOperation();
+ //operation.setName(method.getName());
+ //operation.setUnresolved(true);
+ for (String policySetName : policySetNames) {
+ // Add each intent to the list, associated with the
+ // operation corresponding to the annotated method
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(getQName(policySetName));
+ //intent.getOperations().add(operation);
+ policySets.add(policySet);
+ }
+ }
+ }
+ }
+
+ @Override
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+
+ // Read intents on the Java implementation class
+ if ( type instanceof PolicySetAttachPoint ) {
+ readIntentsAndPolicySets(clazz,
+ ((PolicySetAttachPoint)type).getRequiredIntents(),
+ ((PolicySetAttachPoint)type).getPolicySets());
+ }
+
+ // 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) {
+ readIntentsAndPolicySets(javaInterface.getJavaClass(),
+ service.getRequiredIntents(),
+ service.getPolicySets());
+
+ // Read intents on the service interface methods
+ Method[] methods = javaInterface.getJavaClass().getMethods();
+ ConfiguredOperation confOp = null;
+ for (Method method: methods) {
+ if ( method.getAnnotation(Requires.class) != null ||
+ method.getAnnotation(PolicySets.class) != null ) {
+ confOp = assemblyFactory.createConfiguredOperation();
+ confOp.setName(method.getName());
+ confOp.setContractName(service.getName());
+
+ service.getConfiguredOperations().add(confOp);
+ readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
+ readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
+ }
+ }
+ }
+
+ }
+
+ // 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);
+ }
+ readIntentsAndPolicySets(javaCallbackInterface.getJavaClass(),
+ callback.getRequiredIntents(),
+ callback.getPolicySets());
+
+ // Read intents on the callback interface methods
+ Method[] methods = javaCallbackInterface.getJavaClass().getMethods();
+ ConfiguredOperation confOp = null;
+ for (Method method: methods) {
+ confOp = assemblyFactory.createConfiguredOperation();
+ confOp.setName(method.getName());
+ callback.getConfiguredOperations().add(confOp);
+ readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
+ readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private Reference getReference(Method method, JavaImplementation type) {
+ //since the ReferenceProcessor is called ahead of the PolicyProcessor the type should have
+ //picked up the reference setter method
+ org.osoa.sca.annotations.Reference annotation =
+ method.getAnnotation(org.osoa.sca.annotations.Reference.class);
+ if (annotation != null) {
+ if (JavaIntrospectionHelper.isSetter(method)) {
+ String name = annotation.name();
+ if ("".equals(name)) {
+ name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ }
+ return getReferenceByName(name, type);
+ }
+ }
+ return null;
+ }
+
+ private Reference getReferenceByName(String name, JavaImplementation type) {
+ for ( Reference reference : type.getReferences() ) {
+ if ( reference.getName().equals(name) ) {
+ return reference;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ org.osoa.sca.annotations.Reference annotation =
+ field.getAnnotation( org.osoa.sca.annotations.Reference.class);
+ if (annotation == null) {
+ return;
+ }
+ String name = annotation.name();
+ if ("".equals(name)) {
+ name = field.getName();
+ }
+
+ Reference reference = null;
+ if ( (reference = getReferenceByName(name, type)) != null ) {
+ readIntents(field.getAnnotation(Requires.class), reference.getRequiredIntents());
+ readPolicySets(field.getAnnotation(PolicySets.class), reference.getPolicySets());
+ }
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ Reference reference = null;
+ if ( (reference = getReference(method, type)) != null ) {
+ readIntents(method.getAnnotation(Requires.class), reference.getRequiredIntents());
+ readPolicySets(method.getAnnotation(PolicySets.class), reference.getPolicySets());
+ } else {
+ if ( type instanceof OperationsConfigurator ) {
+ //Read the intents specified on the given implementation method
+ if ( (method.getAnnotation(Requires.class) != null ||
+ method.getAnnotation(PolicySets.class) != null ) &&
+ (type instanceof PolicySetAttachPoint )) {
+ ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
+ confOp.setName(method.getName());
+ ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
+
+
+ readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
+ readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
+ }
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java
new file mode 100644
index 0000000000..cf1b4a9830
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.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.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);
+ }
+
+ @Override
+ protected String getName(Property annotation) {
+ return annotation.name();
+ }
+
+ @Override
+ 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java
new file mode 100644
index 0000000000..a1f8a766ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.annotation.ElementType;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+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.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.osoa.sca.CallableReference;
+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 JavaInterfaceFactory javaFactory;
+
+ public ReferenceProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+ super(assemblyFactory);
+ this.javaFactory = javaFactory;
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ Reference annotation = method.getAnnotation(Reference.class);
+ if (annotation == null) {
+ return; // Not a reference annotation.
+ }
+ if (!JavaIntrospectionHelper.isSetter(method)) {
+ throw new IllegalReferenceException("Annotated method is not a setter: " + method, method);
+ }
+ String name = annotation.name();
+ if ("".equals(name)) {
+ name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ }
+ JavaElementImpl ref = type.getReferenceMembers().get(name);
+ // Setter override field
+ if (ref != null && ref.getElementType() != ElementType.FIELD) {
+ throw new DuplicateReferenceException(name);
+ }
+ removeReference(ref, type);
+
+ 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);
+ }
+
+ private boolean removeReference(JavaElementImpl ref, JavaImplementation type) {
+ if (ref == null) {
+ return false;
+ }
+ List<org.apache.tuscany.sca.assembly.Reference> refs = type.getReferences();
+ for (int i = 0; i < refs.size(); i++) {
+ if (refs.get(i).getName().equals(ref.getName())) {
+ refs.remove(i);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ 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();
+ }
+ JavaElementImpl ref = type.getReferenceMembers().get(name);
+ if (ref != null && ref.getElementType() == ElementType.FIELD) {
+ throw new DuplicateReferenceException(name);
+ }
+
+ // Setter method override field
+ if (ref == null) {
+ JavaElementImpl element = new JavaElementImpl(field);
+ org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name);
+ type.getReferences().add(reference);
+ type.getReferenceMembers().put(name, element);
+ }
+ }
+
+ @Override
+ 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());
+ JavaElementImpl ref = type.getReferenceMembers().get(name);
+
+ // Setter override field
+ if (ref != null && ref.getElementType() != ElementType.FIELD) {
+ throw new DuplicateReferenceException(name);
+ }
+
+ removeReference(ref, type);
+ 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);
+ if (CallableReference.class.isAssignableFrom(baseType)) {
+ if (Collection.class.isAssignableFrom(rawType)) {
+ genericType = JavaIntrospectionHelper.getParameterType(genericType);
+ }
+ baseType = JavaIntrospectionHelper.getBusinessInterface(baseType, genericType);
+ }
+ try {
+ JavaInterface callInterface = javaFactory.createJavaInterface(baseType);
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ return reference;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java
new file mode 100644
index 0000000000..3d43e39ce8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/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.sca.implementation.java.introspect.impl;
+
+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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
new file mode 100644
index 0000000000..e15f9a0d6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.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.IntrospectionException;
+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;
+
+/**
+ * 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);
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ org.apache.tuscany.sca.implementation.java.introspect.impl.Resource annotation = method
+ .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.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);
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+
+ org.apache.tuscany.sca.implementation.java.introspect.impl.Resource annotation = field
+ .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.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.sca.implementation.java.introspect.impl.Resource.class);
+ element.setName(name);
+ return new JavaResourceImpl(element);
+ }
+
+ @Override
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
+ throws IntrospectionException {
+ org.apache.tuscany.sca.implementation.java.introspect.impl.Resource resourceAnnotation = parameter
+ .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java
new file mode 100644
index 0000000000..a3d3889d30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.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.introspect.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+
+/**
+ * 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);
+ }
+
+ @Override
+ 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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
new file mode 100644
index 0000000000..6854acdc2a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.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.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.jws.WebService;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+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.osoa.sca.CallableReference;
+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 static final Logger logger = Logger.getLogger(ServiceProcessor.class.getName());
+ private JavaInterfaceFactory javaFactory;
+
+ public ServiceProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+ super(assemblyFactory);
+ this.javaFactory = javaFactory;
+ }
+
+ @Override
+ 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 interfaces for remotable
+ Set<Class> interfaces = getAllInterfaces(clazz);
+ for (Class<?> interfaze : interfaces) {
+ if (interfaze.isAnnotationPresent(Remotable.class)
+ || interfaze.isAnnotationPresent(WebService.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");
+ logger.warning("Ignoring @Service annotation. No interfaces specified. class = "+clazz.getName());
+ } else {
+ interfaces = new Class<?>[1];
+ interfaces[0] = interfaze;
+ }
+ }
+ for (Class<?> interfaze : interfaces) {
+ try {
+ Service service = createService(interfaze);
+ type.getServices().add(service);
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ }
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+
+ Callback annotation = method.getAnnotation(Callback.class);
+ if (annotation == null) {
+ return;
+ }
+ if(Modifier.isPrivate(method.getModifiers())) {
+ throw new IllegalCallbackReferenceException("Illegal annotation @Callback found on "+method, method);
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalCallbackReferenceException("Setter must have one parameter", method);
+ }
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ createCallback(type, element);
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+
+ Callback annotation = field.getAnnotation(Callback.class);
+ if (annotation == null) {
+ return;
+ }
+ if(Modifier.isPrivate(field.getModifiers())) {
+ throw new IllegalCallbackReferenceException("Illegal annotation @Callback found on "+field, field);
+ }
+ JavaElementImpl element = new JavaElementImpl(field);
+ createCallback(type, element);
+ }
+
+ /**
+ * @param type
+ * @param element
+ * @throws IllegalCallbackReferenceException
+ */
+ private void createCallback(JavaImplementation type, JavaElementImpl element)
+ throws IllegalCallbackReferenceException {
+ Service callbackService = null;
+ Class<?> callbackClass = element.getType();
+ Type genericType = element.getGenericType();
+ Class<?> baseType = callbackClass;
+ if(CallableReference.class.isAssignableFrom(baseType)) {
+ // @Callback protected CallableReference<MyCallback> callback;
+ // The base type will be MyCallback
+ baseType = JavaIntrospectionHelper.getBusinessInterface(baseType, genericType);
+ }
+ for (Service service : type.getServices()) {
+ JavaInterface javaInterface = (JavaInterface)service.getInterfaceContract().getCallbackInterface();
+ if (javaInterface != null && baseType == javaInterface.getJavaClass()) {
+ callbackService = service;
+ }
+ }
+ if (callbackService == null) {
+ throw new IllegalCallbackReferenceException("Callback type does not match a service callback interface: " + type.getName() );
+ }
+ if(type.getCallbackMembers().get(baseType.getName()) == null) {
+ type.getCallbackMembers().put(baseType.getName(), new ArrayList<JavaElementImpl>());
+ }
+ type.getCallbackMembers().get(baseType.getName()).add(element);
+ }
+
+ 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 = javaFactory.createJavaInterface(interfaze);
+ service.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ return service;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java
new file mode 100644
index 0000000000..e1ca3ea565
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.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-android/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/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-android/modules/implementation-java/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-android/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..df60d57cf9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.
+
+org.apache.tuscany.sca.implementation.java.impl.JavaImplementationActivator
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory
new file mode 100644
index 0000000000..dc9de12632
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory
@@ -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.
+
+org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java
new file mode 100644
index 0000000000..fe93424d28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.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.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.IntrospectionException;
+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.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+
+/**
+ * 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();
+ referenceProcessor = new ReferenceProcessor(factory, javaFactory);
+ propertyProcessor = new PropertyProcessor(factory);
+ resourceProcessor = new ResourceProcessor(factory);
+ constructorProcessor = new ConstructorProcessor(factory);
+ referenceProcessor = new ReferenceProcessor(factory, javaFactory);
+ 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java
new file mode 100644
index 0000000000..5beb31f0f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.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 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.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"));
+ }
+
+ @Override
+ @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);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void initProperty(Property property, Bar annotation) {
+ // property.setDefaultValueFactory(EasyMock.createMock(ObjectFactory.class));
+ property.setName("test");
+ }
+
+ @Override
+ 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java
new file mode 100644
index 0000000000..e5abb07760
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.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.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));
+ }
+
+ @Override
+ 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java
new file mode 100644
index 0000000000..fa1527fbe5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.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.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.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();
+ ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory);
+ 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();
+ ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory);
+ 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
new file mode 100644
index 0000000000..690869ccb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.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.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.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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java
new file mode 100644
index 0000000000..8c10df2146
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.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 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
+ }
+ }
+
+ @Override
+ 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
new file mode 100644
index 0000000000..365fb12afe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.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 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;
+
+/**
+ * @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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
new file mode 100644
index 0000000000..f77c9abad9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Context;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ContextProcessorTestCase extends TestCase {
+ private ContextProcessor processor;
+ private ComponentNameProcessor nameProcessor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testComponentContextMethod() throws Exception {
+ Method method = Foo.class.getMethod("setContext", ComponentContext.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("context"));
+ }
+
+ public void testComponentContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("context");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(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 testComponentNameMethod() throws Exception {
+ Method method = Foo.class.getMethod("setName", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ nameProcessor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("name"));
+ }
+
+ public void testComponentNameField() throws Exception {
+ Field field = Foo.class.getDeclaredField("name");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ nameProcessor.visitField(field, type);
+ assertNotNull(type.getResources().get("name"));
+ }
+
+ 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());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ processor = new ContextProcessor(new DefaultAssemblyFactory());
+ nameProcessor = new ComponentNameProcessor(new DefaultAssemblyFactory());
+ }
+
+ private class Foo {
+ @Context
+ protected ComponentContext context;
+
+ @ComponentName
+ protected String name;
+
+ @Context
+ protected Object badContext;
+
+ protected ComponentContext noContext;
+
+ @Context
+ protected RequestContext requestContext;
+
+ @Context
+ public void setContext(ComponentContext context) {
+
+ }
+
+ @ComponentName
+ public void setName(String name) {
+
+ }
+
+ @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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java
new file mode 100644
index 0000000000..c6b2626e9c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.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.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.ConversationID;
+
+/**
+ * Test the ConversationIDProcessor
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationIDProcessorTestCase extends TestCase {
+ private ConversationIDProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testConversationIDMethod() throws Exception {
+ Method method = Foo.class.getMethod("setConversationID", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("conversationID"));
+ }
+
+ public void testConversationIDField() throws Exception {
+ Field field = Foo.class.getDeclaredField("cid");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(field, type);
+ assertNotNull(type.getResources().get("cid"));
+ }
+
+ public void testConversationIDMethodNotString() throws Exception {
+ Method method = Foo.class.getMethod("setConversationID", Long.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("conversationID"));
+ }
+
+ public void testConversationIDFieldNotString() throws Exception {
+ Field field = Foo.class.getDeclaredField("longCID");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(field, type);
+ assertNotNull(type.getResources().get("longCID"));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ processor = new ConversationIDProcessor(new DefaultAssemblyFactory());
+ }
+
+ private class Foo {
+
+ @ConversationID
+ protected String cid;
+
+ @ConversationID
+ public void setConversationID(String cid) {
+
+ }
+
+ @ConversationID
+ protected Long longCID;
+
+ @ConversationID
+ public void setConversationID(Long cid) {
+
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java
new file mode 100644
index 0000000000..4555736813
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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 testImplicitScope() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(ImplicitFooScope.class, type);
+ assertEquals(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope());
+ }
+
+ /* TUSCANY-1999 - apply conversation properties to all scopes
+ public void testBadFooScope() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitClass(BadFooScope.class, type);
+ fail();
+ } catch (InvalidConversationalImplementation e) {
+ // expected
+ }
+ }
+ */
+
+ public void testBadFooBoth() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(BadFooBoth.class, type);
+ assertEquals(10000L, type.getMaxAge());
+ assertEquals(10000L, type.getMaxIdleTime());
+ }
+
+ 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.getConversationIDMembers());
+ assertEquals(field, type.getConversationIDMembers().get(0));
+ }
+
+ public void testSetConversationIDMethod() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = FooWithConversationIDMethod.class.getDeclaredMethods()[0];
+ processor.visitMethod(method, type);
+ assertNotNull(type.getConversationIDMembers());
+ assertEquals(method, type.getConversationIDMembers().get(0));
+ }
+
+ @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
+ String conversationID;
+ }
+
+ private class FooWithConversationIDMethod {
+ @ConversationID
+ void setConversationID(String conversationID) {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java
new file mode 100644
index 0000000000..aa2671071c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.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.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
+ }
+ }
+
+ @Override
+ 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java
new file mode 100644
index 0000000000..ffc67325fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.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.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
+ }
+ }
+
+ public void testProtectedDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = Bar.class.getDeclaredMethod("protectedDestroy");
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalDestructorException e) {
+ // expected
+ }
+ }
+
+ public void testPrivateDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = Bar.class.getDeclaredMethod("privateDestroy");
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalDestructorException 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) {
+ }
+
+ @Destroy
+ protected void protectedDestroy(){
+ }
+
+ @Destroy
+ private void privateDestroy(){
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java
new file mode 100644
index 0000000000..09bcc7ab6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/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.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java
new file mode 100644
index 0000000000..c7f340bd46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.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.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.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());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ propertyProcessor = new PropertyProcessor(assemblyFactory);
+ heuristicProcessor = new HeuristicPojoProcessor(assemblyFactory, new DefaultJavaInterfaceFactory());
+ }
+
+ public static class Foo {
+ public Foo(@Property(name = "foo")
+ String prop) {
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java
new file mode 100644
index 0000000000..e98a8fec1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.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.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.IntrospectionException;
+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.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+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();
+ processor = new HeuristicPojoProcessor(factory, javaFactory);
+ }
+
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ for (Constructor<?> 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java
new file mode 100644
index 0000000000..ff267cd938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java
@@ -0,0 +1,562 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.jws.WebService;
+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.IntrospectionException;
+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.interfacedef.java.DefaultJavaInterfaceFactory;
+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;
+
+/**
+ * Verifies 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() {
+ processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ for (Constructor<?> 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 specification 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 specification 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 interface 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());
+ }
+
+ /**
+ * Errata for Java Component Implementation Specification v1.0 corrects the algorithm for determining
+ * references of an unannotated POJO (section 1.2.7). This test makes sure that the earlier implementation
+ * is corrected as per the errata. A notable difference is that the interfaces annotated with @Service
+ * no longer result in references.
+ */
+ public void testUpdatedRule() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(SomeServiceImpl.class, type);
+ assertEquals(12, type.getReferenceMembers().size());
+ assertTrue(type.getReferenceMembers().containsKey("rri1"));
+ assertTrue(type.getReferenceMembers().containsKey("rri2"));
+ assertTrue(type.getReferenceMembers().containsKey("rri3"));
+ assertTrue(type.getReferenceMembers().containsKey("rri4"));
+
+ assertTrue(type.getReferenceMembers().containsKey("rria1"));
+ assertTrue(type.getReferenceMembers().containsKey("rria2"));
+ assertTrue(type.getReferenceMembers().containsKey("rria3"));
+ assertTrue(type.getReferenceMembers().containsKey("rria4"));
+
+ assertTrue(type.getReferenceMembers().containsKey("rric1"));
+ assertTrue(type.getReferenceMembers().containsKey("rric2"));
+ assertTrue(type.getReferenceMembers().containsKey("rric3"));
+ assertTrue(type.getReferenceMembers().containsKey("rric4"));
+
+ assertEquals(16, type.getPropertyMembers().size());
+ assertTrue(type.getPropertyMembers().containsKey("pnri1"));
+ assertTrue(type.getPropertyMembers().containsKey("pnri2"));
+ assertTrue(type.getPropertyMembers().containsKey("pnri3"));
+ assertTrue(type.getPropertyMembers().containsKey("pnri4"));
+
+ assertTrue(type.getPropertyMembers().containsKey("pnria1"));
+ assertTrue(type.getPropertyMembers().containsKey("pnria2"));
+ assertTrue(type.getPropertyMembers().containsKey("pnria3"));
+ assertTrue(type.getPropertyMembers().containsKey("pnria4"));
+
+ assertTrue(type.getPropertyMembers().containsKey("pnric1"));
+ assertTrue(type.getPropertyMembers().containsKey("pnric2"));
+ assertTrue(type.getPropertyMembers().containsKey("pnric3"));
+ assertTrue(type.getPropertyMembers().containsKey("pnric4"));
+
+ assertTrue(type.getPropertyMembers().containsKey("gen1"));
+ assertTrue(type.getPropertyMembers().containsKey("gen2"));
+ assertTrue(type.getPropertyMembers().containsKey("gen3"));
+ assertTrue(type.getPropertyMembers().containsKey("gen4"));
+ }
+
+ /**
+ * Interfaces with "@WebService" annotation implemented by the class should result
+ * in a Service in the same manner as an "@Remotable" annotation would.
+ */
+ public void testInterfaceWithWebServiceAnnotation() throws Exception{
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(SomeWebServiceImpl.class, type);
+ assertEquals(1, type.getServices().size());
+ assertEquals("SomeWebService", type.getServices().get(0).getName());
+ }
+
+ @Remotable
+ private interface ReferenceRemotableInterface {
+ void operation1(String param1);
+ }
+
+ @Service
+ private interface PropertyNonRemotableInterface {
+ void operation1(String param1);
+ }
+
+ @Remotable
+ private interface SomeService {
+ void serviceOperation1();
+ }
+
+ private static class SomeServiceImpl implements SomeService {
+
+ public SomeServiceImpl() {
+ }
+
+ // References - interface with @Remotable
+ public void setRri1(ReferenceRemotableInterface rri) {
+ }
+ protected void setRri2(ReferenceRemotableInterface rri) {
+ }
+ public ReferenceRemotableInterface rri3;
+ protected ReferenceRemotableInterface rri4;
+
+ // References - array of interface with @Remotable
+ public void setRria1(ReferenceRemotableInterface[] rri) {
+ }
+ protected void setRria2(ReferenceRemotableInterface[] rri) {
+ }
+ public ReferenceRemotableInterface[] rria3;
+ protected ReferenceRemotableInterface[] rria4;
+
+ // References - parametrized Collection of interface with @Remotable
+ public void setRric1(Collection<ReferenceRemotableInterface> rri) {
+ }
+ protected void setRric2(Collection<ReferenceRemotableInterface> rri) {
+ }
+ public Collection<ReferenceRemotableInterface> rric3;
+ protected Collection<ReferenceRemotableInterface> rric4;
+
+ // Properties - interface with @Service and without @Remotable
+ public void setPnri1(PropertyNonRemotableInterface arg) {
+ }
+ protected void setPnri2(PropertyNonRemotableInterface arg) {
+ }
+ public PropertyNonRemotableInterface pnri3;
+ protected PropertyNonRemotableInterface pnri4;
+
+ // Properties - array of interface with @Service and without @Remotable
+ public void setPnria1(PropertyNonRemotableInterface[] arg) {
+ }
+ protected void setPnria2(PropertyNonRemotableInterface[] arg) {
+ }
+ public PropertyNonRemotableInterface[] pnria3;
+ protected PropertyNonRemotableInterface[] pnria4;
+
+ // Properties - parametrized Collection of interface with @Service and without @Remotable
+ public void setPnric1(Collection<PropertyNonRemotableInterface> arg) {
+ }
+ protected void setPnric2(Collection<PropertyNonRemotableInterface> arg) {
+ }
+ public Collection<PropertyNonRemotableInterface> pnric3;
+ protected Collection<PropertyNonRemotableInterface> pnric4;
+
+ // Properties - Non-parametrized Collection
+ public void setGen1(Collection arg) {
+ }
+ protected void setGen2(Collection arg) {
+ }
+ public Collection gen3;
+ protected Collection gen4;
+
+ public void serviceOperation1() {
+ }
+ }
+
+ private static class PropertyIntTypeOnConstructor {
+ protected int foo;
+
+ public PropertyIntTypeOnConstructor() {
+ }
+
+ public int getFoo() {
+ return foo;
+ }
+ }
+
+ @Remotable
+ private interface PropertyInterface {
+ void setString1(String val);
+ }
+
+ @Remotable
+ 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;
+ }
+
+ }
+
+ @Remotable
+ 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 specification, 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) {
+ }
+
+ }
+
+ @WebService
+ private interface SomeWebService {
+ void serviceOperation1();
+ }
+
+ @Service
+ private static class SomeWebServiceImpl implements SomeWebService {
+ public SomeWebServiceImpl() {
+
+ }
+
+ public void serviceOperation1() {
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java
new file mode 100644
index 0000000000..ed0527d3d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.IntrospectionException;
+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.interfacedef.java.DefaultJavaInterfaceFactory;
+
+/**
+ * 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() {
+ processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ for (Constructor<?> constructor : clazz.getConstructors()) {
+ visitConstructor(constructor, type);
+ }
+ processor.visitEnd(clazz, type);
+ }
+
+ /**
+ * Verifies heuristic processing can be called prior 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java
new file mode 100644
index 0000000000..70c615ca24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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
+ }
+ }
+
+ public void testProtectedInit() throws Exception {
+ InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = InitProcessorTestCase.Bar.class.getDeclaredMethod("protectedInit");
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalInitException e) {
+ // expected
+ }
+ }
+
+ public void testPrivateInit() throws Exception {
+ InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = InitProcessorTestCase.Bar.class.getDeclaredMethod("privateInit");
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalInitException e) {
+ // expected
+ }
+ }
+
+ public void testBadInit2() throws Exception {
+ InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = InitProcessorTestCase.Bar.class.getDeclaredMethod("badInit2");
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalInitException 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) {
+ }
+
+ @Init
+ public String badInit2() {
+ return null;
+ }
+
+ @Init
+ protected void protectedInit() {
+ }
+
+ @Init
+ private void privateInit() {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.java
new file mode 100644
index 0000000000..388a1aae8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.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.impl;
+
+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.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaClassIntrospectorImplTestCase extends TestCase {
+
+ public void testRegister() throws Exception {
+ JavaImplementationFactory factory = new DefaultJavaImplementationFactory();
+ JavaClassVisitor extension = EasyMock.createNiceMock(JavaClassVisitor.class);
+ factory.addClassVisitor(extension);
+ }
+
+ public void testUnegister() throws Exception {
+ JavaImplementationFactory factory = new DefaultJavaImplementationFactory();
+ JavaClassVisitor extension = EasyMock.createNiceMock(JavaClassVisitor.class);
+ factory.addClassVisitor(extension);
+ factory.removeClassVisitor(extension);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testWalk() throws Exception {
+ JavaImplementationFactory factory = new DefaultJavaImplementationFactory();
+ 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);
+ factory.addClassVisitor(extension);
+ factory.createJavaImplementation(Bar.class);
+ EasyMock.verify(extension);
+ }
+
+ @Override
+ 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/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-android/modules/implementation-java/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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java
new file mode 100644
index 0000000000..4a625982b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java
@@ -0,0 +1,418 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+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.impl.PolicyJavaInterfaceVisitor;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+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 PolicyJavaInterfaceVisitor visitor;
+ 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 stestSingleInterfaceWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
+ serviceProcessor.visitClass(Service1.class, type);
+ visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
+ policyProcessor.visitClass(Service1.class, type);
+ verifyIntents(Service1.class, type);
+ }
+
+ public void stestMultipleInterfacesWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
+ serviceProcessor.visitClass(Service2.class, type);
+ visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
+ policyProcessor.visitClass(Service2.class, type);
+ verifyIntents(Service2.class, type);
+ }
+
+ public void stestSingleInterfaceWithIntentsOnImplAtClassLevel() throws Exception {
+ serviceProcessor.visitClass(Service3.class, type);
+ visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
+ policyProcessor.visitClass(Service3.class, type);
+ verifyIntents(Service3.class, type);
+ }
+
+ public void stestMultipleInterfacesWithIntentsOnImplAtClassLevel() throws Exception {
+ serviceProcessor.visitClass(Service4.class, type);
+ visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
+ policyProcessor.visitClass(Service4.class, type);
+ verifyIntents(Service4.class, type);
+ }
+
+ public void stestSingleInterfaceWithIntentsOnInterfaceAtMethodLevel() throws Exception {
+ serviceProcessor.visitClass(Service5.class, type);
+ visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
+ policyProcessor.visitClass(Service5.class, type);
+ verifyIntents(Service5.class, type);
+ }
+
+ public void testSingleInterfaceWithIntentsOnServiceAndInterfaceAtImplAndInertfaceAndMethodLevel() throws Exception {
+ serviceProcessor.visitClass(Service6.class, type);
+ visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
+ 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) {
+ if ( !(type instanceof PolicySetAttachPoint) ) {
+ fail("No Intents on the service ");
+ }
+ Requires serviceImplIntentAnnotation = (Requires)serviceImplClass.getAnnotation(Requires.class);
+ if (serviceImplIntentAnnotation != null) {
+ String[] serviceImplIntents = serviceImplIntentAnnotation.value();
+ List<Intent> requiredIntents = ((PolicySetAttachPoint)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.getInterfaceContract().getInterface().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 = null;
+ for ( ConfiguredOperation confOp : service.getConfiguredOperations() ) {
+ if ( confOp.getName().equals(method.getName()) &&
+ confOp.getContractName().equals(service.getName()) ) {
+ requiredIntents = confOp.getRequiredIntents();
+ }
+ }
+
+ if (requiredIntents == null || 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)) {
+ found = true;
+ 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 = null;
+ for ( ConfiguredOperation confOp : ((OperationsConfigurator)type).getConfiguredOperations() ) {
+ if ( confOp.getName().equals(method.getName()) ) {
+ requiredIntents = confOp.getRequiredIntents();
+ }
+ }
+
+ if (requiredIntents == null || 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)) {
+ found = true;
+ break;
+ }
+ }
+ assertTrue("Operation " + method.getName()
+ + " did not contain Implementation method intent "
+ + intent, found);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ serviceProcessor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ policyProcessor = new PolicyProcessor(new DefaultAssemblyFactory(), new DefaultPolicyFactory());
+ visitor = new PolicyJavaInterfaceVisitor(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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java
new file mode 100644
index 0000000000..8d5e816a08
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.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.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.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("setDupMethod", String.class), type);
+ try {
+ processor.visitMethod(Bar.class.getMethod("setDupSomeMethod", 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
+ }
+ }
+
+ @Override
+ 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 setDupMethod(String s) {
+ }
+
+ @Property(name = "dupMethod")
+ public void setDupSomeMethod(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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java
new file mode 100644
index 0000000000..d68b1530f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.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("setDupMethod", Ref.class), type);
+ try {
+ processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("setDupSomeMethod", 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
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ processor = new ReferenceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ }
+
+ 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 setDupMethod(Ref s) {
+ }
+
+ @Reference(name = "dupMethod")
+ public void setDupSomeMethod(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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java
new file mode 100644
index 0000000000..7bb8e15696
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.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.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
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ }
+
+ private class Foo {
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
+ protected Bar bar;
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource(optional = true)
+ protected Bar barNotRequired;
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
+ public void setBar(Bar bar) {
+ }
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource(name = "someName", mappedName = "mapped")
+ public void setBar2(Bar bar) {
+ }
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
+ public void setBad() {
+ }
+
+ }
+
+ private interface Bar {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java
new file mode 100644
index 0000000000..d7de4e522e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.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.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.IntrospectionException;
+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.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());
+ }
+
+ @Override
+ 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("STATELESS")
+ private class Stateless {
+ }
+
+ private class None {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java
new file mode 100644
index 0000000000..10f0500e4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.osoa.sca.CallableReference;
+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 {
+ processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ 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()).iterator().next().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()).iterator().next().getAnchor());
+ }
+
+ public void testFieldCallbackInterface1() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooImpl1.class, type);
+ org.apache.tuscany.sca.assembly.Service service = getService(type, Foo.class.getSimpleName());
+ assertNotNull(service);
+ Field field1 = FooImpl1.class.getDeclaredField("callbackRef");
+ processor.visitField(field1, type);
+ assertEquals(field1, type.getCallbackMembers().get(FooCallback.class.getName()).iterator().next().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) {
+
+ }
+ }
+
+ @Service(Foo.class)
+ private static class FooImpl1 implements Foo {
+ @Callback
+ protected CallableReference<FooCallback> callbackRef;
+ }
+
+ 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-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java
new file mode 100644
index 0000000000..aea90aa6eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.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 javax.jws.WebService;
+
+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.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 testMultipleWithWebServiceAnnotation() throws Exception {
+ processor.visitClass(FooMultipleWithWebService.class, type);
+ assertEquals(2, 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 {
+ processor.visitClass(FooServiceUsingClassImpl.class, type);
+ }
+
+ public void testNoInterfaces() throws Exception {
+ try {
+ processor.visitClass(BadDefinition.class, type);
+ } catch (IllegalServiceDefinitionException e) {
+ //not expected
+ fail();
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ }
+
+ @Callback(Bar.class)
+ private interface Baz {
+ }
+
+ private interface Bar {
+ }
+
+ private interface Bar2 {
+ }
+
+ @WebService
+ private interface Bar3 {
+ }
+
+ @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 FooMultipleWithWebService implements BazRemotable, Bar3 {
+ }
+
+ private class FooRemotableNoService implements BazRemotable, Bar {
+
+ }
+
+ @Service(FooSingle.class)
+ private class FooServiceUsingClassImpl extends FooSingle {
+
+ }
+
+
+ @Service()
+ private class BadDefinition extends FooSingle {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/LICENSE b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-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-android/modules/implementation-node-runtime/META-INF/README b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/NOTICE b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-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-android/modules/implementation-node-runtime/pom.xml b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/pom.xml
new file mode 100644
index 0000000000..bc4f0ae7bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/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-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <name>Apache Tuscany SCA Node Implementation Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-launcher</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </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>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.node.runtime</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.implementation.node*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java
new file mode 100644
index 0000000000..8de2a3a3f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.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.node.launcher;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * Bootstrap class for the SCA node daemon.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationDaemonBootstrap {
+ private SCANode node;
+
+ /**
+ * A node wrappering an instance of a node daemon.
+ */
+ public static class NodeFacade implements SCANode {
+ private ClassLoader threadContextClassLoader;
+ private ClassLoader runtimeClassLoader;
+ private SCANode daemon;
+
+ private NodeFacade() {
+ runtimeClassLoader = Thread.currentThread().getContextClassLoader();
+ }
+
+ public void start() {
+ threadContextClassLoader = Thread.currentThread().getContextClassLoader();
+ boolean started = false;
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ daemon = factory.createSCANodeFromClassLoader("NodeDaemon.composite", threadContextClassLoader);
+ started = true;
+ } finally {
+ if (!started) {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+ }
+
+ public void stop() {
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ daemon.stop();
+ } finally {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+ }
+
+ /**
+ * Constructs a new daemon bootstrap.
+ */
+ public NodeImplementationDaemonBootstrap() throws Exception {
+ node = new NodeFacade();
+ }
+
+ /**
+ * Returns the node representing the daemon.
+ * @return
+ */
+ public SCANode getNode() {
+ return node;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java
new file mode 100644
index 0000000000..0264574fb9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.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.implementation.node.launcher;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * Bootstrap class for standalone SCA nodes.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationLauncherBootstrap {
+
+ private SCANode node;
+
+ /**
+ * A node facade.
+ */
+ public static class NodeFacade implements SCANode, SCAClient {
+ private ClassLoader threadContextClassLoader;
+ private ClassLoader runtimeClassLoader;
+ private SCANode delegate;
+
+ private NodeFacade(SCANode delegate) {
+ runtimeClassLoader = Thread.currentThread().getContextClassLoader();
+ this.delegate = delegate;
+ }
+
+ public void start() {
+ threadContextClassLoader = Thread.currentThread().getContextClassLoader();
+ boolean started = false;
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ delegate.start();
+ started = true;
+ } finally {
+ if (!started) {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+ }
+
+ public void stop() {
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ delegate.stop();
+ } finally {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)((SCAClient)delegate).cast(target);
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return (B)((SCAClient)delegate).getService(businessInterface, serviceName);
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ return (ServiceReference<B>)((SCAClient)delegate).getServiceReference(businessInterface, referenceName);
+ }
+ }
+
+ /**
+ * Bootstrap a new SCA node.
+ *
+ * @param configurationURI
+ */
+ public NodeImplementationLauncherBootstrap(String configurationURI) throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = new NodeFacade(nodeFactory.createSCANodeFromURL(configurationURI));
+ }
+
+ /**
+ * Bootstrap a new SCA node.
+ *
+ * @param configurationURI
+ * @param contributionClassLoader
+ */
+ public NodeImplementationLauncherBootstrap(String compositeURI, ClassLoader contributionClassLoader) throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = new NodeFacade(nodeFactory.createSCANodeFromClassLoader(compositeURI, contributionClassLoader));
+ }
+
+ /**
+ * Bootstrap a new SCA node.
+ *
+ * @param compositeURI
+ * @param uris
+ * @param locations
+ */
+ public NodeImplementationLauncherBootstrap(String compositeURI, String[] uris, String[] locations) throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ SCAContribution[] contributions = new SCAContribution[uris.length];
+ for (int i = 0; i < uris.length; i++) {
+ contributions[i] = new SCAContribution(uris[i], locations[i]);
+ }
+ node = new NodeFacade(nodeFactory.createSCANode(compositeURI, contributions));
+ }
+
+ /**
+ * Bootstrap a new SCA node.
+ *
+ * @param compositeURI
+ * @param uris
+ * @param locations
+ */
+ public NodeImplementationLauncherBootstrap(String compositeURI, String compositeContent, String[] uris, String[] locations) throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ SCAContribution[] contributions = new SCAContribution[uris.length];
+ for (int i = 0; i < uris.length; i++) {
+ contributions[i] = new SCAContribution(uris[i], locations[i]);
+ }
+ node = new NodeFacade(nodeFactory.createSCANode(compositeURI, compositeContent, contributions));
+ }
+
+ /**
+ * Returns the SCA node.
+ *
+ * @return
+ */
+ public SCANode getNode() {
+ return node;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.java b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.java
new file mode 100644
index 0000000000..62a822a85e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.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.node.launcher;
+
+/**
+ * Utility methods for node implementation launchers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationLauncherUtil {
+
+ private static final String TUSCANY_DOMAIN = "TUSCANY_DOMAIN";
+ private static final String DEFAULT_DOMAIN = "http://localhost:9990";
+
+ /**
+ * Determine the URI of a node configuration. The domain URI can be configured
+ * using a TUSCANY_DOMAIN system property or environment variable.
+ *
+ * @param nodeName
+ * @return
+ */
+ public static String nodeConfigurationURI(String nodeName) {
+ String domain = System.getProperty(TUSCANY_DOMAIN);
+ if (domain == null || domain.length() == 0) {
+ domain = System.getenv(TUSCANY_DOMAIN);
+ }
+ if (domain == null || domain.length() ==0) {
+ domain = DEFAULT_DOMAIN;
+ }
+ String nodeConfiguration = domain + "/node-config/" + nodeName;
+ return nodeConfiguration;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.java b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.java
new file mode 100644
index 0000000000..5895a8614d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.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.node.provider;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Implements an invoker for node component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+class NodeImplementationInvoker implements Invoker {
+ private Composite composite;
+
+ NodeImplementationInvoker(Composite composite) {
+ this.composite = composite;
+ }
+
+ public Message invoke(Message msg) {
+ //FIXME Implement later
+ msg.setBody(composite);
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.java b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.java
new file mode 100644
index 0000000000..6cdb18938e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.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.node.provider;
+
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+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;
+
+/**
+ * An implementation provider for node component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+class NodeImplementationProvider implements ImplementationProvider {
+
+ private NodeImplementation implementation;
+
+ /**
+ * Constructs a new node implementation provider.
+ *
+ * @param component
+ * @param implementation
+ */
+ NodeImplementationProvider(RuntimeComponent component, NodeImplementation implementation) {
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ NodeImplementationInvoker invoker = new NodeImplementationInvoker(implementation.getComposite());
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.java
new file mode 100644
index 0000000000..e2a3e4df92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.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.node.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Factory for node component implementation providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationProviderFactory implements ImplementationProviderFactory<NodeImplementation> {
+
+ /**
+ * Constructs a new factory.
+ *
+ * @param extensionPoints
+ */
+ public NodeImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, NodeImplementation implementation) {
+ return new NodeImplementationProvider(component, implementation);
+ }
+
+ public Class<NodeImplementation> getModelType() {
+ return NodeImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java
new file mode 100644
index 0000000000..f6a601a3cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.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.node.webapp;
+
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+/**
+ * A Servlet request dispatcher that can be used to delegate requests to a
+ * Serlvet registered with the Webapp Servlet host.
+ *
+ * @version $Rev$ $Date$
+ */
+class NodeWebAppRequestDispatcher implements RequestDispatcher {
+ private String servletPath;
+ private Servlet servlet;
+
+ /**
+ * Constructs a new request dispatcher.
+ *
+ * @param mapping
+ * @param servlet
+ */
+ public NodeWebAppRequestDispatcher(String mapping, Servlet servlet) {
+ if (mapping.endsWith("*")) {
+ mapping = mapping.substring(0, mapping.length()-1);
+ }
+ if (mapping.endsWith("/")) {
+ mapping = mapping.substring(0, mapping.length()-1);
+ }
+ this.servletPath = mapping;
+ this.servlet = servlet;
+ }
+
+ /**
+ * Returns a request wrapper which will return the correct Servlet path
+ * and path info.
+ *
+ * @param request
+ * @return
+ */
+ private HttpServletRequest createRequestWrapper(ServletRequest request) {
+ HttpServletRequest requestWrapper = new HttpServletRequestWrapper((HttpServletRequest)request) {
+
+ @Override
+ public String getServletPath() {
+ return servletPath;
+ }
+
+ @Override
+ public String getPathInfo() {
+ String path = super.getServletPath();
+ if (path.length() == 0) {
+ path = super.getPathInfo();
+ }
+
+ // TODO: another context path hack, revisit when context path is sorted out
+ path = fiddlePath(path, servletPath);
+
+ return path;
+ }
+ };
+ return requestWrapper;
+ }
+
+ /**
+ * Remove any path suffix thats part of the Servlet context path.
+ *
+ * @param path
+ * @param servletPath
+ */
+ private static String fiddlePath(String path, String servletPath) {
+ StringTokenizer st = new StringTokenizer(path, "/");
+ String root = "";
+ while (st.hasMoreTokens()){
+ String s = st.nextToken();
+ if (servletPath.endsWith((root + "/" + s))) {
+ root += "/" + s;
+ } else {
+ break;
+ }
+ }
+ String fiddlePath = path.substring(root.length());
+ return fiddlePath;
+ }
+
+ public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+ servlet.service(createRequestWrapper(request), response);
+ }
+
+ public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+ servlet.service(createRequestWrapper(request), response);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java
new file mode 100644
index 0000000000..5a50f87d4c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.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.implementation.node.webapp;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.RequestDispatcher;
+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.HttpServletRequest;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.host.http.ServletMappingException;
+import org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationLauncherUtil;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * ServletHost implementation for use in a Webapp Node environment.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeWebAppServletHost implements ServletHost, Filter {
+ private static final Logger logger = Logger.getLogger(NodeWebAppServletHost.class.getName());
+
+ private static final NodeWebAppServletHost servletHost = new NodeWebAppServletHost();
+
+ private Map<String, Servlet> servlets = new HashMap<String, Servlet>();
+ private SCANode node;
+
+ private String contextPath = "/";
+ private int defaultPort = 8080;
+
+ /**
+ * Constructs a new NodeWebAppServletHost.
+ */
+ private NodeWebAppServletHost() {
+ }
+
+ /**
+ * Returns the Servlet host for the current Web app.
+ *
+ * @return
+ */
+ public static NodeWebAppServletHost servletHost() {
+ return servletHost;
+ }
+
+ /**
+ * Initialize the Servlet host.
+ *
+ * @param filterConfig
+ * @throws ServletException
+ */
+ public void init(final FilterConfig filterConfig) throws ServletException {
+
+ // Create a Servlet config wrapping the given filter config
+ ServletConfig servletConfig = servletConfig(filterConfig);
+
+ // Get the Servlet context
+ ServletContext servletContext = servletConfig.getServletContext();
+
+ // Initialize the context path
+ contextPath = contextPath(servletContext);
+
+ // Derive the node name from the Webapp context path
+ String nodeName = contextPath;
+ if (nodeName.startsWith("/")) {
+ nodeName = nodeName.substring(1);
+ }
+ if (nodeName.endsWith("/")) {
+ nodeName = nodeName.substring(0, nodeName.length() - 1);
+ }
+
+ // Determine the node configuration URI
+ String nodeConfiguration = NodeImplementationLauncherUtil.nodeConfigurationURI(nodeName);
+
+ // Create the SCA node
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANodeFromURL(nodeConfiguration);
+
+ // Register the Servlet host
+ ServletHostExtensionPoint servletHosts = servletHosts(node);
+ servletHosts.getServletHosts().clear();
+ servletHosts.addServletHost(servletHost);
+
+ // Save the node in the Servlet context
+ servletContext.setAttribute(SCAClient.class.getName(), node);
+
+ // Start the node
+ node.start();
+
+ // Initialize the registered Servlets
+ for (Servlet servlet : servlets.values()) {
+ servlet.init(servletConfig);
+ }
+ }
+
+ public void addServletMapping(String suri, Servlet servlet) throws ServletMappingException {
+ URI pathURI = URI.create(suri);
+
+ // Make sure that the path starts with a /
+ suri = pathURI.getPath();
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ if (!suri.startsWith(contextPath)) {
+ suri = contextPath + suri;
+ }
+
+ // In a webapp just use the given path and ignore the host and port
+ // as they are fixed by the Web container
+ servlets.put(suri, servlet);
+
+ logger.info("Added Servlet mapping: " + suri);
+ }
+
+ public Servlet removeServletMapping(String suri) throws ServletMappingException {
+ URI pathURI = URI.create(suri);
+
+ // Make sure that the path starts with a /
+ suri = pathURI.getPath();
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ if (!suri.startsWith(contextPath)) {
+ suri = contextPath + suri;
+ }
+
+ // In a webapp just use the given path and ignore the host and port
+ // as they are fixed by the Web container
+ return servlets.remove(suri);
+ }
+
+ public Servlet getServletMapping(String suri) throws ServletMappingException {
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ if (!suri.startsWith(contextPath)) {
+ suri = contextPath + suri;
+ }
+
+ // Get the Servlet mapped to the given path
+ Servlet servlet = servlets.get(suri);
+ return servlet;
+ }
+
+ public URL getURLMapping(String suri) throws ServletMappingException {
+ URI uri = URI.create(suri);
+
+ // Get the URI scheme and port
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+ scheme = "http";
+ }
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPort;
+ }
+
+ // Get the host
+ String host;
+ try {
+ host = InetAddress.getLocalHost().getHostName();
+ } catch (UnknownHostException e) {
+ host = "localhost";
+ }
+
+ // Construct the URL
+ String path = uri.getPath();
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+
+ if (contextPath != null && !path.startsWith(contextPath)) {
+ path = contextPath + path;
+ }
+
+ URL url;
+ try {
+ url = new URL(scheme, host, portNumber, path);
+ } catch (MalformedURLException e) {
+ throw new ServletMappingException(e);
+ }
+ return url;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
+
+ // Make sure that the path starts with a /
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ suri = contextPath + suri;
+
+ // Get the Servlet mapped to the given path
+ Servlet servlet = servlets.get(suri);
+ if (servlet != null) {
+ return new NodeWebAppRequestDispatcher(suri, servlet);
+ }
+
+ for (Map.Entry<String, Servlet> entry : servlets.entrySet()) {
+ String servletPath = entry.getKey();
+ if (servletPath.endsWith("*")) {
+ servletPath = servletPath.substring(0, servletPath.length() - 1);
+ if (suri.startsWith(servletPath)) {
+ return new NodeWebAppRequestDispatcher(entry.getKey(), entry.getValue());
+ } else {
+ if ((suri + "/").startsWith(servletPath)) {
+ return new NodeWebAppRequestDispatcher(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ }
+
+ // No Servlet found
+ return null;
+ }
+
+ /**
+ * Destroy the Servlet host.
+ *
+ * @throws ServletException
+ */
+ public void destroy() {
+
+ // Destroy the registered Servlets
+ for (Servlet servlet : servlets.values()) {
+ servlet.destroy();
+ }
+
+ // Stop the node
+ if (node != null) {
+ node.stop();
+ }
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
+ throws IOException, ServletException {
+
+ // Get the Servlet path
+ HttpServletRequest httpRequest = (HttpServletRequest)request;
+ String path = httpRequest.getPathInfo();
+ if (path == null) {
+ path = httpRequest.getServletPath();
+ }
+ if (path == null) {
+ path = "/";
+ }
+
+ // Get a request dispatcher for the Servlet mapped to that path
+ RequestDispatcher dispatcher = getRequestDispatcher(path);
+ if (dispatcher != null) {
+
+ // Let the dispatcher forward the request to the Servlet
+ dispatcher.forward(request, response);
+
+ } else {
+
+ // Proceed down the filter chain
+ chain.doFilter(request, response);
+ }
+ }
+
+ public void setDefaultPort(int port) {
+ defaultPort = port;
+ }
+
+ public int getDefaultPort() {
+ return defaultPort;
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ public void setContextPath(String path) {
+ //this.contextPath = path;
+ }
+
+ /**
+ * Initializes the contextPath
+ * The 2.5 Servlet API has a getter for this, for pre 2.5 Servlet
+ * containers use an init parameter.
+ */
+ private static String contextPath(ServletContext context) {
+ String contextPath = "/";
+
+ // The getContextPath() is introduced since Servlet 2.5
+ Method m;
+ try {
+ // Try to get the method anyway since some ServletContext impl has this method even before 2.5
+ m = context.getClass().getMethod("getContextPath", new Class[] {});
+ contextPath = (String)m.invoke(context, new Object[] {});
+ } catch (Exception e) {
+ contextPath = context.getInitParameter("contextPath");
+ if (contextPath == null) {
+ logger.warning("Servlet level is: " + context.getMajorVersion() + "." + context.getMinorVersion());
+ throw new IllegalStateException(
+ "'contextPath' init parameter must be set for pre-2.5 servlet container");
+ }
+ }
+
+ logger.info("ContextPath: " + contextPath);
+ return contextPath;
+ }
+
+ /**
+ * Returns the Servlet host extension point used by the given node.
+ *
+ * @return
+ */
+ private static ServletHostExtensionPoint servletHosts(SCANode node) {
+ //FIXME Need a clean way to get the extension point registry
+ // from the node
+ ExtensionPointRegistry registry;
+ try {
+ registry = (ExtensionPointRegistry)node.getClass().getMethod("getExtensionPointRegistry").invoke(node);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ ServletHostExtensionPoint servletHosts = registry.getExtensionPoint(ServletHostExtensionPoint.class);
+ return servletHosts;
+ }
+
+ /**
+ * Returns a Servlet config wrapping a filter config.
+ *
+ * @param filterConfig
+ * @return
+ */
+ private static ServletConfig servletConfig(final FilterConfig filterConfig) {
+ ServletConfig servletConfig = new ServletConfig() {
+ public String getInitParameter(String name) {
+ return filterConfig.getInitParameter(name);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return filterConfig.getInitParameterNames();
+ }
+
+ public ServletContext getServletContext() {
+ return filterConfig.getServletContext();
+ }
+
+ public String getServletName() {
+ return filterConfig.getFilterName();
+ }
+ };
+ return servletConfig;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..306b53be5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 implementation extension
+org.apache.tuscany.sca.implementation.node.provider.NodeImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.node.NodeImplementation
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java
new file mode 100644
index 0000000000..73475f49fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.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.node;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * Test case for node component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationTestCase extends TestCase {
+
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("TestNode.composite", null);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ public void testNode() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/resources/TestComposite.composite b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/resources/TestComposite.composite
new file mode 100644
index 0000000000..55644c27e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/resources/TestComposite.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/composite"
+ xmlns:sc="http://sample/composite"
+ name="TestComposite">
+
+ <component name="TestComponent">
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/resources/TestNode.composite b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/resources/TestNode.composite
new file mode 100644
index 0000000000..d4dc62a42d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node-runtime/src/test/resources/TestNode.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/node"
+ xmlns:sc="http://sample/composite"
+ name="TestNode">
+
+ <component name="TestNode">
+ <tuscany:implementation.node uri="TestNode" composite="sc:TestComposite"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/LICENSE b/sca-java-1.x/branches/sca-android/modules/implementation-node/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/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-android/modules/implementation-node/META-INF/README b/sca-java-1.x/branches/sca-android/modules/implementation-node/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/NOTICE b/sca-java-1.x/branches/sca-android/modules/implementation-node/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/implementation-node/pom.xml b/sca-java-1.x/branches/sca-android/modules/implementation-node/pom.xml
new file mode 100644
index 0000000000..2027eb7e30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-node</artifactId>
+ <name>Apache Tuscany SCA Node Implementation Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.node</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.implementation.node*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java
new file mode 100644
index 0000000000..d4755f4071
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.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.node;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.contribution.Contribution;
+
+
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConfiguredNodeImplementation extends Implementation {
+
+ /**
+ * Returns the composite deployed to this node.
+ * @return the composite deployed to this node
+ */
+ Composite getComposite();
+
+ /**
+ * Sets the composite deployed to this node.
+ * @param composite the composite deployed to this node
+ */
+ void setComposite(Composite composite);
+
+ /**
+ * Returns the list of contributions deployed to this node.
+ * @return the list of contributions deployed to this node
+ */
+ List<Contribution> getContributions();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.java
new file mode 100644
index 0000000000..527698ea91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.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.node;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface NodeImplementation extends Implementation {
+
+ /**
+ * Returns the composite deployed to this node.
+ * @return the composite deployed to this node
+ */
+ Composite getComposite();
+
+ /**
+ * Sets the composite deployed to this node.
+ * @param composite the composite deployed to this node
+ */
+ void setComposite(Composite composite);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.java
new file mode 100644
index 0000000000..9c4fed689b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.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.node;
+
+
+/**
+ * Factory for the resource implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface NodeImplementationFactory {
+
+ /**
+ * Creates a new node implementation.
+ * @return a new node implementation
+ */
+ NodeImplementation createNodeImplementation();
+
+ /**
+ * Creates a new configured node implementation.
+ * @return a new configured node implementation
+ */
+ ConfiguredNodeImplementation createConfiguredNodeImplementation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
new file mode 100644
index 0000000000..736afc13f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.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.implementation.node.builder.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+
+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.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.impl.BaseConfigurationBuilderImpl;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that handles the configuration of composites assigned to
+ * node components, from the default configuration from the node components.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeCompositeBuilderImpl extends BaseConfigurationBuilderImpl implements CompositeBuilder {
+
+ @Deprecated
+ public NodeCompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+ super(assemblyFactory, scaBindingFactory,
+ null, null,
+ interfaceContractMapper, policyDefinitions, monitor);
+ }
+
+ public NodeCompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+ super(assemblyFactory, scaBindingFactory,
+ documentBuilderFactory, transformerFactory,
+ interfaceContractMapper, policyDefinitions, monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ configureNodeComponents(composite);
+ }
+
+ /**
+ * Configure the node components in the given composite.
+ *
+ * @param composite
+ * @throws CompositeBuilderException
+ */
+ private void configureNodeComponents(Composite composite) throws CompositeBuilderException {
+
+ // Process each node component in the given composite
+ for (Component component: composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof NodeImplementation) {
+
+ // Get the application composite assigned to the node
+ NodeImplementation nodeImplementation = (NodeImplementation)implementation;
+ Composite applicationComposite = nodeImplementation.getComposite();
+
+ // Get the default bindings configured on the node
+ List<Binding> defaultBindings = new ArrayList<Binding>();
+ for (ComponentService componentService: component.getServices()) {
+ defaultBindings.addAll(componentService.getBindings());
+ }
+
+ // Configure services in the application composite assigned to
+ // the node using the default bindings.
+ configureBindingURIs(applicationComposite, defaultBindings);
+ }
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java
new file mode 100644
index 0000000000..1d183513b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.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.implementation.node.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+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.contribution.Contribution;
+import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
+
+
+/**
+ * The model representing a configured node implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+class ConfiguredNodeImplementationImpl implements ConfiguredNodeImplementation {
+
+ private String uri;
+ private boolean unresolved;
+ private Composite composite;
+ private List<Contribution> contributions = new ArrayList<Contribution>();
+
+ /**
+ * Constructs a new node implementation.
+ */
+ ConfiguredNodeImplementationImpl() {
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The node implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The node implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The node implementation does not support services
+ return Collections.emptyList();
+ }
+
+ public List<Reference> getReferences() {
+ // The node implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public Composite getComposite() {
+ return composite;
+ }
+
+ public List<Contribution> getContributions() {
+ return contributions;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The node implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setComposite(Composite composite) {
+ this.composite = composite;
+ }
+
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.java
new file mode 100644
index 0000000000..94ea610314
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.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.node.impl;
+
+import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+
+/**
+ * Factory for the resource implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationFactoryImpl implements NodeImplementationFactory {
+
+ public NodeImplementationFactoryImpl() {
+ }
+
+ public NodeImplementation createNodeImplementation() {
+ return new NodeImplementationImpl();
+ }
+
+ public ConfiguredNodeImplementation createConfiguredNodeImplementation() {
+ return new ConfiguredNodeImplementationImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java
new file mode 100644
index 0000000000..8f6315d969
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.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.node.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+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.node.NodeImplementation;
+
+
+/**
+ * The model representing a node implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+class NodeImplementationImpl implements NodeImplementation {
+
+ private String uri;
+ private boolean unresolved;
+ private Composite composite;
+
+ /**
+ * Constructs a new node implementation.
+ */
+ NodeImplementationImpl() {
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The node implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The node implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The node implementation does not support services
+ return Collections.emptyList();
+ }
+
+ public List<Reference> getReferences() {
+ // The node implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public Composite getComposite() {
+ return composite;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The node implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setComposite(Composite composite) {
+ this.composite = composite;
+ }
+
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java
new file mode 100644
index 0000000000..e695340d45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.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.implementation.node.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+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.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+
+/**
+ * Implements a StAX artifact processor for configured node implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConfiguredNodeImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<ConfiguredNodeImplementation> {
+
+ private static final String ATOM_NS = "http://www.w3.org/2005/Atom";
+ private static final QName FEED_QNAME = new QName(ATOM_NS, "feed");
+ private static final QName ENTRY_QNAME = new QName(ATOM_NS, "entry");
+ private static final QName ID_QNAME = new QName(ATOM_NS, "id");
+ private static final QName LINK_QNAME = new QName(ATOM_NS, "link");
+ private static final String HREF = "href";
+
+ private ContributionFactory contributionFactory;
+ private AssemblyFactory assemblyFactory;
+ private NodeImplementationFactory implementationFactory;
+
+ public ConfiguredNodeImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.implementationFactory = modelFactories.getFactory(NodeImplementationFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return null;
+ }
+
+ public Class<ConfiguredNodeImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return ConfiguredNodeImplementation.class;
+ }
+
+ public ConfiguredNodeImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ ConfiguredNodeImplementation implementation = implementationFactory.createConfiguredNodeImplementation();
+ implementation.setUnresolved(true);
+
+ // Read a feed containing links to the composite and the contributions assigned to
+ // the node
+ Composite composite = null;
+ Contribution contribution = null;
+ boolean id = false;
+ QName name = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+
+ case START_ELEMENT:
+ name = reader.getName();
+
+ if (ENTRY_QNAME.equals(name)) {
+
+ // Read an <entry>
+ if (implementation.getComposite() == null) {
+ composite = assemblyFactory.createComposite();
+ } else {
+ contribution = contributionFactory.createContribution();
+ }
+ } else if (ID_QNAME.equals(name)) {
+
+ // Read an <id>
+ id = true;
+
+ } else if (LINK_QNAME.equals(name)) {
+
+ // Read a <link>
+ String href = getString(reader, HREF);
+
+ if (composite != null) {
+ composite.setURI(href);
+ } else if (contribution != null) {
+ contribution.setLocation(href);
+ }
+ }
+ break;
+
+ case XMLStreamConstants.CHARACTERS:
+
+ // Read characters inside an <id> element
+ if (id) {
+ if (contribution != null) {
+ contribution.setURI(reader.getText());
+ }
+ }
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (ENTRY_QNAME.equals(name)) {
+ if (composite != null) {
+ implementation.setComposite(composite);
+ } else if (contribution != null) {
+ implementation.getContributions().add(contribution);
+ }
+
+ composite = null;
+ contribution = null;
+
+ } else if (ID_QNAME.equals(name)) {
+ id = false;
+
+ } else if (FEED_QNAME.equals(name)) {
+
+ // We've reached the end of the feed
+ return implementation;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return implementation;
+ }
+
+ public void resolve(ConfiguredNodeImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the referenced composite
+ Composite composite = implementation.getComposite();
+ if (composite != null) {
+ composite = resolver.resolveModel(Composite.class, composite);
+ if (!composite.isUnresolved()) {
+ implementation.setComposite(composite);
+ }
+ }
+
+ // Resolve the referenced contributions
+ List<Contribution> contributions = implementation.getContributions();
+ for (int i = 0, n = contributions.size(); i < n; i++) {
+ Contribution contribution = contributions.get(i);
+ contribution = resolver.resolveModel(Contribution.class, contribution);
+ if (!contribution.isUnresolved()) {
+ contributions.set(i, contribution);
+ }
+ }
+
+ implementation.setUnresolved(false);
+ }
+
+ public void write(ConfiguredNodeImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ //TODO Write the feed describing the node configuration
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java
new file mode 100644
index 0000000000..201354f89c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.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.node.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.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+
+/**
+ * Implements a StAX artifact processor for node implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<NodeImplementation> {
+ private static final QName IMPLEMENTATION_NODE = new QName(Constants.SCA10_TUSCANY_NS, "implementation.node");
+
+ private AssemblyFactory assemblyFactory;
+ private NodeImplementationFactory implementationFactory;
+
+ public NodeImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.implementationFactory = modelFactories.getFactory(NodeImplementationFactory.class);
+ }
+
+ public QName getArtifactType() {
+ // Returns the QName of the XML element processed by this processor
+ return IMPLEMENTATION_NODE;
+ }
+
+ public Class<NodeImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return NodeImplementation.class;
+ }
+
+ public NodeImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.node> element
+ NodeImplementation implementation = implementationFactory.createNodeImplementation();
+ implementation.setUnresolved(false);
+
+ // Read the composite attribute
+ QName qname = getQName(reader, "composite");
+ if (qname != null) {
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(qname);
+ String uri = getString(reader, "uri");
+ composite.setURI(uri);
+ composite.setUnresolved(true);
+ implementation.setComposite(composite);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_NODE.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(NodeImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+ // We do not need to resolve the referenced composites here
+ // Nodes and application composites are not in the same composition tree
+ }
+
+ public void write(NodeImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <implementation.node>
+ Composite composite = implementation.getComposite();
+ QName qname;
+ String uri;
+ if (composite != null) {
+ qname = composite.getName();
+ uri = composite.getURI();
+ } else {
+ qname = null;
+ uri = null;
+ }
+ writeStart(writer, IMPLEMENTATION_NODE.getNamespaceURI(), IMPLEMENTATION_NODE.getLocalPart(),
+ new XAttr("composite", qname), new XAttr("uri", uri));
+
+ writeEnd(writer);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..9378db0875
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -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.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.node.xml.NodeImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.node,model=org.apache.tuscany.sca.implementation.node.NodeImplementation,factory=org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
+org.apache.tuscany.sca.implementation.node.xml.ConfiguredNodeImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.node.configured,model=org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation,factory=org.apache.tuscany.sca.implementation.node.NodeImplementationFactory \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
new file mode 100644
index 0000000000..b8a63a3b16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 model factory
+org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java
new file mode 100644
index 0000000000..1dc397659b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java
@@ -0,0 +1,587 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.node.builder.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+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.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class CalculateBindingURITestCase extends TestCase {
+ private static final Logger logger = Logger.getLogger(CalculateBindingURITestCase.class.getName());
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private NodeImplementationFactory nodeImplementationFactory;
+ private Monitor monitor;
+ private CompositeBuilder configurationBuilder;
+ private List<Binding> defaultBindings = new ArrayList<Binding>();
+
+ @Override
+ protected void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new TestBindingFactory();
+ nodeImplementationFactory = new NodeImplementationFactoryImpl();
+ monitor = new Monitor() {
+ public void problem(Problem problem) {
+ if (problem.getSeverity() == Severity.INFO) {
+ logger.info(problem.toString());
+ } else if (problem.getSeverity() == Severity.WARNING) {
+ logger.warning(problem.toString());
+ } else if (problem.getSeverity() == Severity.ERROR) {
+ if (problem.getCause() != null) {
+ logger.log(Level.SEVERE, problem.toString(), problem.getCause());
+ } else {
+ logger.severe(problem.toString());
+ }
+ }
+ }
+ public List<Problem> getProblems() {
+ return null;
+ }
+ };
+ configurationBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, null, null, monitor);
+ Binding defaultBinding = new TestBindingImpl();
+ defaultBinding.setURI("http://myhost:8080/root");
+ defaultBindings.add(defaultBinding);
+ }
+
+ /**
+ * Create a composite containing a node component pointing to the
+ * given application composite.
+ *
+ * @param composite
+ * @return
+ */
+ private Composite nodeComposite(Composite composite) {
+ Composite nodeComposite = assemblyFactory.createComposite();
+ Component nodeComponent = assemblyFactory.createComponent();
+ NodeImplementation nodeImplementation = nodeImplementationFactory.createNodeImplementation();
+ nodeImplementation.setComposite(composite);
+ nodeComponent.setImplementation(nodeImplementation);
+ ComponentService nodeService = assemblyFactory.createComponentService();
+ nodeService.getBindings().addAll(defaultBindings);
+ nodeComponent.getServices().add(nodeService);
+ nodeComposite.getComponents().add(nodeComponent);
+ return nodeComposite;
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ assemblyFactory = null;
+ }
+
+ /**
+ * Test that URI are generated in accordance with the Assembly Specification section 1.7.2.1 as
+ * follows. For the 3 parts that make up the URI;
+ *
+ * BaseURI / Component URI / Service Binding URI
+ *
+ * Test the following combinations for:
+ *
+ * NB. The short hand here, e.g. <service name="s1"> <binding.sca> <service name="s2"> means
+ * two services appear where the first has the sca binding specified.
+ *
+ * component service bindings
+ *
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca>
+ * --> http://myhost:8080/root/c1
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca> <service name="s2">
+ * --> http://myhost:8080/root/c1/s1
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca name="n"> <service name="s2">
+ * --> http://myhost:8080/root/c1/n
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca uri="b"> <service name="s2">
+ * --> http://myhost:8080/root/c1/b
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca uri="http://myhost:8080/b"> <service name="s2">
+ * --> http://myhost:8080/b
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca uri="../../b"> <service name="s2">
+ * --> http://myhost:8080/b
+ *
+ * top level composite service bindings
+ *
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca> <service name="s2">
+ * --> http://myhost:8080/root
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca> <service name="s2">
+ * --> http://myhost:8080/root/s1
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca name="n"> <service name="s2">
+ * --> http://myhost:8080/root/n
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca uri="b"> <service name="s2">
+ * --> http://myhost:8080/root/b
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca uri="http://myhost:8080/b"> <service name="s2">
+ * --> http://myhost:8080/b
+ *
+ * nested composite service bindings
+ *
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca>
+ * --> http://myhost:8080/root/c1/c2
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca> <service name="s2">
+ * --> http://myhost:8080/root/c1/c2/s1
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca name="n"> <service name="s2">
+ * --> http://myhost:8080/root/c1/c2/n
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca uri="b"> <service name="s2">
+ * --> http://myhost:8080/root/c1/c2/b
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca uri="http://myhost:8080/b"> <service name="s2">
+ * --> http://myhost:8080/b
+ *
+ * binding name duplication errors
+ *
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca> <binding.xyz>
+ * --> Error
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca name="b1"> <binding.xyz name="b1">
+ * --> Error
+ */
+
+ private Composite createComponentServiceBinding() {
+ Composite composite1 = assemblyFactory.createComposite();
+ composite1.setName(new QName("http://foo", "C1"));
+
+ Component c1 = assemblyFactory.createComponent();
+ c1.setName("c1");
+ composite1.getComponents().add(c1);
+
+ ComponentService s1 = assemblyFactory.createComponentService();
+ c1.getServices().add(s1);
+ s1.setName("s1");
+
+ ComponentService s2 = assemblyFactory.createComponentService();
+ c1.getServices().add(s2);
+ s2.setName("s2");
+
+ Binding b1 = new TestBindingImpl();
+ s1.getBindings().add(b1);
+
+ Binding b2 = new TestBindingImpl();
+ s2.getBindings().add(b2);
+
+ return composite1;
+ }
+
+ private Composite createTopLevelCompositeServiceBinding(){
+ Composite composite1 = assemblyFactory.createComposite();
+ composite1.setName(new QName("http://foo", "C1"));
+
+ CompositeService s1 = assemblyFactory.createCompositeService();
+ s1.setName("s1");
+ composite1.getServices().add(s1);
+
+ Binding b1 = new TestBindingImpl();
+ s1.getBindings().add(b1);
+
+ CompositeService s2 = assemblyFactory.createCompositeService();
+ s2.setName("s2");
+ composite1.getServices().add(s2);
+
+ Binding b2 = new TestBindingImpl();
+ s2.getBindings().add(b2);
+
+ return composite1;
+ }
+
+ private Composite createNestCompositeServiceBinding(){
+ Composite composite1 = assemblyFactory.createComposite();
+ composite1.setName(new QName("http://foo", "C1"));
+
+ Component c1 = assemblyFactory.createComponent();
+ c1.setName("c1");
+ composite1.getComponents().add(c1);
+
+ Composite composite2 = assemblyFactory.createComposite();
+ c1.setImplementation(composite2);
+ composite2.setName(new QName("http://foo", "C2"));
+
+ Component c2 = assemblyFactory.createComponent();
+ composite2.getComponents().add(c2);
+ c2.setName("c2");
+
+ ComponentService s1 = assemblyFactory.createComponentService();
+ c2.getServices().add(s1);
+ s1.setName("s1");
+
+ ComponentService s2 = assemblyFactory.createComponentService();
+ c2.getServices().add(s2);
+ s2.setName("s2");
+
+ Binding b1 = new TestBindingImpl();
+ s1.getBindings().add(b1);
+
+ Binding b2 = new TestBindingImpl();
+ s2.getBindings().add(b2);
+
+ return composite1;
+ }
+
+ // component service binding tests
+
+ public void testComponentServiceSingleService() {
+ Composite composite = createComponentServiceBinding();
+ composite.getComponents().get(0).getServices().remove(1);
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/c1", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingDefault() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/c1/s1", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingName() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/c1/n", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingURIRelative() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("b");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/c1/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingURIAbsolute() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("http://myhost:8080/b");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingURIRelative2() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("../../b");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ // top level composite service binding tests
+
+ public void testCompositeServiceSingleService() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ composite.getServices().remove(1);
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testCompositeServiceBindingDefault() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/s1", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testCompositeServiceBindingName() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+ b.setName("n");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/n", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testCompositeServiceBindingURIRelative() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("b");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testCompositeServiceBindingURIAbsolute() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("http://myhost:8080/b");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ // nested composite service binding tests
+
+ public void testNestedCompositeServiceSingleService() {
+ Composite composite = createNestCompositeServiceBinding();
+ ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().remove(1);
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/c1/c2", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testNestedCompositeServiceBindingDefault() {
+ Composite composite = createNestCompositeServiceBinding();
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/c1/c2/s1", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testNestedCompositeServiceBindingName() {
+ Composite composite = createNestCompositeServiceBinding();
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/c1/c2/n", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testNestedCompositeServiceBindingURIRelative() {
+ Composite composite = createNestCompositeServiceBinding();
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("b");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/root/c1/c2/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testNestedCompositeServiceBindingURIAbsolute() {
+ Composite composite = createNestCompositeServiceBinding();
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("http://myhost:8080/b");
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+
+ assertEquals("http://myhost:8080/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ // component service binding name error tests
+
+ //FIXME Need to find a better way to test these error cases as
+ // the composite builder now (intentionally) logs warnings instead of
+ // throwing exceptions
+ public void FIXMEtestComponentServiceBindingNameError1() {
+ Composite composite = createComponentServiceBinding();
+ Binding b1 = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ Binding b2 = new TestBindingImpl();
+ composite.getComponents().get(0).getServices().get(0).getBindings().add(b2);
+
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+ fail();
+ } catch(Exception ex){
+ //System.out.println(ex.toString());
+ }
+ }
+
+ //FIXME Need to find a better way to test these error cases as
+ // the composite builder now (intentionally) logs warnings instead of
+ // throwing exceptions
+ public void FIXMEtestComponentServiceBindingNameError2() {
+ Composite composite = createComponentServiceBinding();
+ Binding b1 = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ Binding b2 = new TestBindingImpl();
+ composite.getComponents().get(0).getServices().get(0).getBindings().add(b2);
+
+ b1.setName("b");
+ b2.setName("b");
+
+
+ try {
+ configurationBuilder.build(nodeComposite(composite));
+ fail();
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ }
+ }
+
+
+ public class TestBindingFactory implements SCABindingFactory {
+ public SCABinding createSCABinding() {
+ return new TestBindingImpl();
+ }
+ }
+
+ public class TestBindingImpl implements SCABinding {
+ private String name;
+ private String uri;
+ private boolean unresolved;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java
new file mode 100644
index 0000000000..bc0c3b1507
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.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.node.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+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.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Test reading Node implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private CompositeBuilder compositeBuilder;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestNode.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+ assertNotNull(composite);
+
+ compositeBuilder.build(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
new file mode 100644
index 0000000000..c5e6a40f89
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.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.implementation.node.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.Composite;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+
+/**
+ * Test reading/writing Node implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ outputFactory = XMLOutputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestNode.composite");
+ Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite
new file mode 100644
index 0000000000..55644c27e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/composite"
+ xmlns:sc="http://sample/composite"
+ name="TestComposite">
+
+ <component name="TestComponent">
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite
new file mode 100644
index 0000000000..92787d3ac1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/node"
+ xmlns:sc="http://sample/composite"
+ name="TestNode">
+
+ <component name="TestNode">
+ <tuscany:implementation.node composite="sc:TestComposite"/>
+ <service name="Default">
+ <binding.sca uri="http://localhost:8080"/>
+ </service>
+ </component>
+
+ <component name="TestNode2">
+ <tuscany:implementation.node.configured>
+
+ <feed xmlns="http://www.w3.org/2005/Atom">
+ <title type="text">Feed</title>
+ <entry>
+ <id>composite:store;http://store;store</id>
+ <title type="text">store - http://store;store</title>
+ <content type="text" />
+ <link
+ href="/resolved/composite/composite:store;http://store;store" />
+ </entry>
+ <entry>
+ <id>assets</id>
+ <title type="text">assets</title>
+ <content type="text" />
+ <link
+ href="http://localhost:9990/files/tutorial-assets.jar" />
+ </entry>
+ <entry>
+ <id>store</id>
+ <title type="text">store</title>
+ <content type="text" />
+ <link
+ href="http://localhost:9990/files/tutorial-store.jar" />
+ </entry>
+ </feed>
+
+ </tuscany:implementation.node.configured>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java-xml/LICENSE b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/interface-java-xml/META-INF/README b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java-xml/NOTICE b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/interface-java-xml/pom.xml b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/pom.xml
new file mode 100644
index 0000000000..989e7bd6ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <name>Apache Tuscany SCA Java Interface XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.interface.java.xml</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.interfacedef.java.xml*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java
new file mode 100644
index 0000000000..5d2d8ed51c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.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.interfacedef.java.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+/**
+ * Interface Java XML Constants.
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
new file mode 100644
index 0000000000..ae5bf4c56d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.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.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.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfaceContract>, JavaConstants {
+
+ private JavaInterfaceFactory javaFactory;
+ private Monitor monitor;
+
+ public JavaInterfaceProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "interface-javaxml-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "interface-javaxml-validation-messages", Severity.ERROR, model, message,(Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ private JavaInterface createJavaInterface(String interfaceName) {
+ JavaInterface javaInterface = javaFactory.createJavaInterface();
+ javaInterface.setUnresolved(true);
+ javaInterface.setName(interfaceName);
+ return javaInterface;
+ }
+
+ public JavaInterfaceContract read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // 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;
+ }
+
+ public void write(JavaInterfaceContract javaInterfaceContract, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // 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();
+ }
+
+ 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) {
+ error("ClassNotFoundException", resolver, javaInterface.getName());
+ return javaInterface;
+ //throw new ContributionResolveException(new ClassNotFoundException(javaInterface.getName()));
+ }
+
+ try {
+ // Introspect the Java interface and populate the interface and
+ // operations
+ javaFactory.createJavaInterface(javaInterface, javaClass);
+
+ } catch (InvalidInterfaceException e) {
+ ContributionResolveException ce = new ContributionResolveException(e);
+ error("ContributionResolveException", javaFactory, ce);
+ return javaInterface;
+ //throw ce;
+ }
+
+ // 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-android/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..b3e52e5709
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+org.apache.tuscany.sca.interfacedef.java.xml.JavaInterfaceProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#interface.java,model=org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/resources/interface-javaxml-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/resources/interface-javaxml-validation-messages.properties
new file mode 100644
index 0000000000..bc0a7192b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/main/resources/interface-javaxml-validation-messages.properties
@@ -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.
+#
+#
+ClassNotFoundException = Class Not Found Exception: {0}
+ContributionResolveException = ContributionResolveException occured due to :
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
new file mode 100644
index 0000000000..313f950873
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.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.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.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Test reading Java interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private CompositeBuilder compositeBuilder;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ outputFactory = XMLOutputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
+
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
+ }
+
+ public void testReadComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ComponentType componentType = (ComponentType)staxProcessor.read(reader);
+ assertNotNull(componentType);
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(reader);
+ assertNotNull(constrainingType);
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = (Composite)staxProcessor.read(reader);
+ assertNotNull(composite);
+
+ compositeBuilder.build(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java
new file mode 100644
index 0000000000..55fc12d176
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.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.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.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+
+/**
+ * Test writing Java interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ inputFactory = XMLInputFactory.newInstance();
+ outputFactory = XMLOutputFactory.newInstance();
+ StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
+ assertNotNull(componentType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
+ }
+
+ public void testReadWriteConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
+ assertNotNull(constrainingType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(constrainingType, outputFactory.createXMLStreamWriter(bos));
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/interface-java/LICENSE b/sca-java-1.x/branches/sca-android/modules/interface-java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/interface-java/META-INF/README b/sca-java-1.x/branches/sca-android/modules/interface-java/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/NOTICE b/sca-java-1.x/branches/sca-android/modules/interface-java/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/interface-java/pom.xml b/sca-java-1.x/branches/sca-android/modules/interface-java/pom.xml
new file mode 100644
index 0000000000..bab2576ea8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-java</artifactId>
+ <name>Apache Tuscany SCA Java Interface Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.interface.java</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.interfacedef.java*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java
new file mode 100644
index 0000000000..7853b597d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.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.java;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceFactoryImpl;
+import org.apache.tuscany.sca.interfacedef.java.impl.PolicyJavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * A factory for the Java interface model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultJavaInterfaceFactory extends JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
+ private ModelFactoryExtensionPoint modelFactoryExtensionPoint;
+ private boolean loadedVisitors;
+
+ public DefaultJavaInterfaceFactory() {
+ }
+
+ public DefaultJavaInterfaceFactory(ModelFactoryExtensionPoint modelFactoryExtensionPoint) {
+ this.modelFactoryExtensionPoint = modelFactoryExtensionPoint;
+ }
+
+ @Override
+ public List<JavaInterfaceVisitor> getInterfaceVisitors() {
+ loadVisitors();
+ return super.getInterfaceVisitors();
+ }
+
+ /**
+ * Load visitors declared under META-INF/services
+ */
+ @SuppressWarnings("unchecked")
+ private void loadVisitors() {
+ if (loadedVisitors)
+ return;
+
+ if (modelFactoryExtensionPoint != null) {
+ PolicyFactory policyFactory = modelFactoryExtensionPoint.getFactory(PolicyFactory.class);
+ if (policyFactory != null) {
+ addInterfaceVisitor(new PolicyJavaInterfaceVisitor(policyFactory));
+ }
+ }
+
+ // Get the databinding service declarations
+ Set<ServiceDeclaration> visitorDeclarations;
+ try {
+ visitorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(JavaInterfaceVisitor.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load data bindings
+ for (ServiceDeclaration visitorDeclaration: visitorDeclarations) {
+ JavaInterfaceVisitor visitor;
+ try {
+ Class<JavaInterfaceVisitor> visitorClass = (Class<JavaInterfaceVisitor>)visitorDeclaration.loadClass();
+ visitor = visitorClass.newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(e);
+ }
+ addInterfaceVisitor(visitor);
+ }
+
+ loadedVisitors = true;
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java
new file mode 100644
index 0000000000..9c09ef50c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.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.interfacedef.java;
+
+import javax.xml.namespace.QName;
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.interfacedef.Interface;
+
+/**
+ * Represents a Java interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterface extends Interface, Base {
+
+ /**
+ * 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 QName of the JAX-WS interface.
+ *
+ * @return the QName of the JAX-WS interface
+ */
+ QName getQName();
+
+ /**
+ * Sets the QName of the JAX-WS interface.
+ *
+ * @param interfaceName the QName of the JAX-WS interface
+ */
+ void setQName(QName interfaceName);
+
+ /**
+ * 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-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java
new file mode 100644
index 0000000000..9225926269
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.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.java;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+
+/**
+ * Factory for the Java interface model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceFactory {
+
+ /**
+ * Creates a new Java interface model.
+ *
+ * @return
+ */
+ JavaInterface createJavaInterface();
+
+ /**
+ * Creates a new Java interface model from an interface class.
+ * @param interfaceClass the interface class to introspect.
+ * @return
+ */
+ JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException;
+
+ /**
+ * Creates the contents of a Java interface model from an interface class.
+ * @param javaInterface the Java interface model
+ * @param interfaceClass the interface class to introspect.
+ * @return
+ */
+ void createJavaInterface(JavaInterface javaInterface, Class<?> interfaceClass) throws InvalidInterfaceException;
+
+ /**
+ * Creates a new Java interface contract.
+ *
+ * @return
+ */
+ JavaInterfaceContract createJavaInterfaceContract();
+
+ /**
+ * 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-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java
new file mode 100644
index 0000000000..e6cb35cc4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.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.interfacedef.java;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * Represents a Java operation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaOperation extends Operation {
+
+ /**
+ * Returns the Java method defining the operation.
+ * @return the Java method
+ */
+ Method getJavaMethod();
+
+ /**
+ * Sets the Java method defining the operation.
+ * @param method the Java method
+ */
+ void setJavaMethod(Method method);
+
+ /**
+ * Returns the JAX-WS @WebMethod action parameter.
+ * @return the action value
+ */
+ String getAction();
+
+ /**
+ * Sets the JAX-WS @WebMethod action parameter.
+ * @param action the action value
+ */
+ void setAction(String action);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java
new file mode 100644
index 0000000000..d43ebe558b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.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.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() {
+ }
+
+ @Override
+ public JavaInterfaceContractImpl clone() throws CloneNotSupportedException {
+ return (JavaInterfaceContractImpl) super.clone();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java
new file mode 100644
index 0000000000..b1efd6e197
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.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.interfacedef.java.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.JavaInterfaceVisitor;
+
+/**
+ * A factory for the Java model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
+
+ private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
+ private JavaInterfaceIntrospectorImpl introspector;
+
+ public JavaInterfaceFactoryImpl() {
+ introspector = new JavaInterfaceIntrospectorImpl(this);
+ }
+
+ public JavaInterface createJavaInterface() {
+ return new JavaInterfaceImpl();
+ }
+
+ public JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException {
+ JavaInterface javaInterface = createJavaInterface();
+ introspector.introspectInterface(javaInterface, interfaceClass);
+ return javaInterface;
+ }
+
+ public void createJavaInterface(JavaInterface javaInterface, Class<?> interfaceClass) throws InvalidInterfaceException {
+ introspector.introspectInterface(javaInterface, interfaceClass);
+ }
+
+ public JavaInterfaceContract createJavaInterfaceContract() {
+ return new JavaInterfaceContractImpl();
+ }
+
+ 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-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
new file mode 100644
index 0000000000..42e45317b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.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.interfacedef.java.impl;
+
+import javax.xml.namespace.QName;
+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;
+ private QName qname;
+
+ 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 QName getQName() {
+ return qname;
+ }
+
+ public void setQName(QName interfacename) {
+ qname = interfacename;
+ }
+
+ 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;
+ }
+
+ @Override
+ 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;
+ }
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
new file mode 100644
index 0000000000..b1198824fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+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.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+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 JavaInterfaceIntrospectorImpl {
+ public static final String IDL_INPUT = "idl:input";
+
+ private static final String UNKNOWN_DATABINDING = null;
+
+ private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
+
+ public JavaInterfaceIntrospectorImpl(JavaInterfaceFactory javaFactory) {
+ this.visitors = javaFactory.getInterfaceVisitors();
+ }
+
+ public void introspectInterface(JavaInterface javaInterface, Class<?> clazz)
+ throws InvalidInterfaceException {
+ javaInterface.setJavaClass(clazz);
+
+ boolean remotable = clazz.isAnnotationPresent(Remotable.class);
+
+ // Consider @javax.ejb.Remote, java.rmi.Remote and javax.ejb.EJBObject
+ // equivalent to @Remotable
+ if (!remotable) {
+ for (Annotation annotation : clazz.getAnnotations()) {
+ if ("javax.ejb.Remote".equals(annotation.annotationType().getName())) {
+ remotable = true;
+ break;
+ }
+ }
+ }
+ if (!remotable) {
+ for (Class<?> superInterface : clazz.getInterfaces()) {
+ if (Remote.class == superInterface || "javax.ejb.EJBObject".equals(superInterface.getName())) {
+ remotable = true;
+ break;
+ }
+ }
+ }
+
+ javaInterface.setRemotable(remotable);
+
+ boolean conversational = clazz.isAnnotationPresent(Conversational.class);
+ javaInterface.setConversational(conversational);
+
+ Class<?> callbackClass = null;
+ org.osoa.sca.annotations.Callback callback = clazz.getAnnotation(org.osoa.sca.annotations.Callback.class);
+ if (callback != null && !Void.class.equals(callback.value())) {
+ callbackClass = callback.value();
+ if (remotable && !callbackClass.isAnnotationPresent(Remotable.class)) {
+ throw new InvalidCallbackException("Callback must be remotable on a remotable interface");
+ }
+ if (!remotable && callbackClass.isAnnotationPresent(Remotable.class)) {
+ throw new InvalidCallbackException("Callback must not be remotable on a local interface");
+ }
+ } else if (callback != null && Void.class.equals(callback.value())) {
+ throw new InvalidCallbackException("No callback interface specified on annotation");
+ }
+
+ javaInterface.setCallbackClass(callbackClass);
+
+ String ns = JavaXMLMapper.getNamespace(clazz);
+ javaInterface.getOperations().addAll(getOperations(clazz, remotable, conversational, ns));
+
+ for (JavaInterfaceVisitor extension : visitors) {
+ extension.visitInterface(javaInterface);
+ }
+ }
+
+ private Class<?>[] getActualTypes(Type[] types, Class<?>[] rawTypes, Map<String, Type> typeBindings) {
+ Class<?>[] actualTypes = new Class<?>[types.length];
+ for (int i = 0; i < actualTypes.length; i++) {
+ actualTypes[i] = getActualType(types[i], rawTypes[i], typeBindings);
+ }
+ return actualTypes;
+ }
+
+ private Class<?> getActualType(Type type, Class<?> rawType, Map<String, Type> typeBindings) {
+ if (type instanceof TypeVariable<?>) {
+ TypeVariable<?> typeVariable = (TypeVariable<?>)type;
+ type = typeBindings.get(typeVariable.getName());
+ if (type instanceof Class<?>) {
+ return (Class<?>)type;
+ }
+ }
+ return rawType;
+ }
+
+ private <T> List<Operation> getOperations(Class<T> clazz,
+ boolean remotable,
+ boolean conversational,
+ String ns) throws InvalidInterfaceException {
+
+ Set<Type> genericInterfaces = new HashSet<Type>();
+ for (Type t : clazz.getGenericInterfaces()) {
+ genericInterfaces.add(t);
+ }
+ Map<String, Type> typeBindings = new HashMap<String, Type>();
+ for (Type genericInterface : genericInterfaces) {
+ if (genericInterface instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType)genericInterface;
+ TypeVariable<?>[] typeVariables = ((Class<?>)parameterizedType.getRawType()).getTypeParameters();
+ Type[] typeArguments = parameterizedType.getActualTypeArguments();
+ for (int i = 0; i < typeArguments.length; i++) {
+ typeBindings.put(typeVariables[i].getName(), typeArguments[i]);
+ }
+ }
+ }
+
+ Method[] methods = clazz.getMethods();
+ List<Operation> operations = new ArrayList<Operation>(methods.length);
+ Set<String> names = remotable ? new HashSet<String>() : null;
+ for (Method method : methods) {
+ if (method.getDeclaringClass() == Object.class) {
+ // Skip the methods on the Object.class
+ continue;
+ }
+ String name = method.getName();
+ if (remotable && names.contains(name)) {
+ throw new OverloadedOperationException(method);
+ }
+ if (remotable) {
+ names.add(name);
+ }
+
+ Class<?> returnType = getActualType(method.getGenericReturnType(), method.getReturnType(), typeBindings);
+ Class<?>[] parameterTypes =
+ getActualTypes(method.getGenericParameterTypes(), method.getParameterTypes(), typeBindings);
+ Class<?>[] faultTypes =
+ getActualTypes(method.getGenericExceptionTypes(), method.getExceptionTypes(), typeBindings);
+
+ boolean nonBlocking = method.isAnnotationPresent(OneWay.class);
+ if (nonBlocking) {
+ if (!(returnType == void.class)) {
+ throw new InvalidOperationException(
+ "Method should return 'void' when declared with an @OneWay annotation. " + method,
+ method);
+ }
+ if (!(faultTypes.length == 0)) {
+ throw new InvalidOperationException(
+ "Method should not declare exceptions with an @OneWay annotation. " + method,
+ method);
+ }
+ }
+
+ 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
+ XMLType xmlReturnType = new XMLType(new QName(ns, "return"), null);
+ DataType<XMLType> returnDataType =
+ returnType == void.class ? null : new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, returnType, method
+ .getGenericReturnType(), xmlReturnType);
+ List<DataType> paramDataTypes = new ArrayList<DataType>(parameterTypes.length);
+ Type[] genericParamTypes = method.getGenericParameterTypes();
+ for (int i = 0; i < parameterTypes.length; i++) {
+ Class paramType = parameterTypes[i];
+ XMLType xmlParamType = new XMLType(new QName(ns, "arg" + i), null);
+ paramDataTypes.add(new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, paramType, genericParamTypes[i],
+ xmlParamType));
+ }
+ List<DataType> faultDataTypes = new ArrayList<DataType>(faultTypes.length);
+ Type[] genericFaultTypes = method.getGenericExceptionTypes();
+ for (int i = 0; i < faultTypes.length; i++) {
+ Class<?> faultType = faultTypes[i];
+ // Only add checked exceptions
+ // JAXWS Specification v2.1 section 3.7 says RemoteException should not be mapped
+ if (Exception.class.isAssignableFrom(faultType) && (!RuntimeException.class.isAssignableFrom(faultType))
+ && (!RemoteException.class.isAssignableFrom(faultType))) {
+ XMLType xmlFaultType = new XMLType(new QName(ns, faultType.getSimpleName()), null);
+ DataType<XMLType> faultDataType =
+ new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, faultType, genericFaultTypes[i], xmlFaultType);
+ faultDataTypes.add(new DataTypeImpl<DataType>(UNKNOWN_DATABINDING, faultType, genericFaultTypes[i],
+ faultDataType));
+ }
+ }
+
+ DataType<List<DataType>> inputType =
+ new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class, paramDataTypes);
+ JavaOperation operation = new JavaOperationImpl();
+ operation.setName(name);
+ operation.setInputType(inputType);
+ operation.setOutputType(returnDataType);
+ operation.setFaultTypes(faultDataTypes);
+ operation.setConversationSequence(conversationSequence);
+ operation.setNonBlocking(nonBlocking);
+ operation.setJavaMethod(method);
+ operations.add(operation);
+ }
+ return operations;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
new file mode 100644
index 0000000000..2a9e3c5329
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.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.interfacedef.java.impl;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+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.java.JavaOperation;
+
+/**
+ * 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();
+ if (operation instanceof JavaOperation) {
+ name = ((JavaOperation)operation).getJavaMethod().getName();
+ }
+ Interface interface1 = operation.getInterface();
+ int numParams = operation.getInputType().getLogical().size();
+ if (interface1 != null && interface1.isRemotable()) {
+ List<Method> matchingMethods = new ArrayList<Method>();
+ for (Method m : implClass.getMethods()) {
+ if (m.getName().equals(name) && m.getParameterTypes().length == numParams) {
+ matchingMethods.add(m);
+ }
+ }
+
+ // TUSCANY-2180 If there is only one method then we just match on the name
+ // (this is the same as the existing behaviour)
+ if (matchingMethods.size() == 1) {
+ return matchingMethods.get(0);
+ }
+ if (matchingMethods.size() > 1) {
+ // TUSCANY-2180 We need to check the parameter types too
+ Class<?>[] paramTypes = getPhysicalTypes(operation);
+ return implClass.getMethod(name, paramTypes);
+ }
+
+ // No matching method found
+ throw new NoSuchMethodException("No matching method for operation " + operation.getName()
+ + " is found on "
+ + implClass);
+ }
+ 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;
+
+ }
+
+ private static String getPackageName(Class<?> cls) {
+ String name = cls.getName();
+ int index = name.lastIndexOf('.');
+ return index == -1 ? "" : name.substring(0, index);
+ }
+
+ public static String getNamespace(Class<?> cls) {
+ String packageName = getPackageName(cls);
+ if ("".equals(packageName)) {
+ return "";
+ }
+ StringBuffer ns = new StringBuffer("http://");
+ String[] names = packageName.split("\\.");
+ for (int i = names.length - 1; i >= 0; i--) {
+ ns.append(names[i]);
+ if (i != 0) {
+ ns.append('.');
+ }
+ }
+ ns.append('/');
+ return ns.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java
new file mode 100644
index 0000000000..4384213bf5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.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.interfacedef.java.impl;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+
+/**
+ * Represents a Java operation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaOperationImpl extends OperationImpl implements JavaOperation {
+
+ private Method method;
+ private String action;
+
+ public Method getJavaMethod() {
+ return method;
+ }
+
+ public void setJavaMethod(Method method) {
+ this.method = method;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((method == null) ? 0 : method.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final JavaOperationImpl other = (JavaOperationImpl)obj;
+ if (method == null) {
+ if (other.method != null)
+ return false;
+ } else if (!method.equals(other.method))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return method == null ? "null" : method.toGenericString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java
new file mode 100644
index 0000000000..ed00510a67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.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.interfacedef.java.impl;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+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.JavaOperation;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.osoa.sca.annotations.PolicySets;
+import org.osoa.sca.annotations.Requires;
+
+/**
+ * Processes an {@link org.osoa.sca.annotations.Requires} annotation
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyJavaInterfaceVisitor implements JavaInterfaceVisitor {
+ private PolicyFactory policyFactory;
+
+ public PolicyJavaInterfaceVisitor(PolicyFactory policyFactory) {
+ super();
+ 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 readIntentsAndPolicySets(Class<?> clazz, List<Intent> requiredIntents, List<PolicySet> policySets) {
+ 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);
+ }
+ }
+ }
+
+ PolicySets policySetAnnotation = clazz.getAnnotation(PolicySets.class);
+ if (policySetAnnotation != null) {
+ String[] policySetNames = policySetAnnotation.value();
+ if (policySetNames.length != 0) {
+ for (String policySetName : policySetNames) {
+
+ // Add each intent to the list
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(getQName(policySetName));
+ policySets.add(policySet);
+ }
+ }
+ }
+ }
+
+ private void readIntents(Requires intentAnnotation, 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);
+ }
+ }
+ }
+ }
+
+ private void readPolicySets(PolicySets policySetAnnotation, List<PolicySet> policySets) {
+ if (policySetAnnotation != null) {
+ String[] policySetNames = policySetAnnotation.value();
+ if (policySetNames.length != 0) {
+ //Operation operation = assemblyFactory.createOperation();
+ //operation.setName(method.getName());
+ //operation.setUnresolved(true);
+ for (String policySetName : policySetNames) {
+ // Add each intent to the list, associated with the
+ // operation corresponding to the annotated method
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(getQName(policySetName));
+ //intent.getOperations().add(operation);
+ policySets.add(policySet);
+ }
+ }
+ }
+ }
+
+ public void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException {
+
+ if (javaInterface.getJavaClass() != null) {
+ readIntentsAndPolicySets(javaInterface.getJavaClass(), javaInterface.getRequiredIntents(), javaInterface
+ .getPolicySets());
+
+ // Read intents on the service interface methods
+ List<Operation> operations = javaInterface.getOperations();
+ for (Operation op : operations) {
+ JavaOperation operation = (JavaOperation)op;
+ Method method = operation.getJavaMethod();
+ if (method.getAnnotation(Requires.class) != null || method.getAnnotation(PolicySets.class) != null) {
+ readIntents(method.getAnnotation(Requires.class), op.getRequiredIntents());
+ readPolicySets(method.getAnnotation(PolicySets.class), op.getPolicySets());
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java b/sca-java-1.x/branches/sca-android/modules/interface-java/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-android/modules/interface-java/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-android/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory
new file mode 100644
index 0000000000..5ba12ec137
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory
@@ -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.
+
+org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java
new file mode 100644
index 0000000000..14b0577f65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+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.InterfaceImpl;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This test case will test that a Component that has multiple Remotable interfaces
+ * that contain methods with the same name will correctly select the right method.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase {
+
+ /**
+ * Test to get the getTime() method from the LocalTimeService
+ *
+ * @throws Exception Test failed
+ */
+ public void testLocalTimeServiceGetTime() throws Exception {
+ doTestLocalTimeServiceGetTime(LocalTimeService.class);
+ }
+
+ /**
+ * Test to get the getTime() method from the LocalTimeService interface from
+ * the specified class
+ *
+ * @param timeServiceClass The class that implements the LocalTimeService
+ * @throws Exception Test failed
+ */
+ private void doTestLocalTimeServiceGetTime(Class timeServiceClass) throws Exception {
+ // Add a getTime() method
+ Operation operation = newOperation("getTime", LocalTimeService.class);
+
+ Method method = JavaInterfaceUtil.findMethod(timeServiceClass, operation);
+ assertEquals("getTime", method.getName());
+ assertEquals(0, method.getParameterTypes().length);
+ }
+
+ /**
+ * Test to get the getTime(String) method from the WorldTimeService
+ *
+ * @throws Exception Test failed
+ */
+ public void testWorldTimeServiceGetTime() throws Exception {
+ doTestWorldTimeServiceGetTime(WorldTimeService.class);
+ }
+
+ /**
+ * Test to get the getTime(String) method from the WorldTimeService interface from
+ * the specified class
+ *
+ * @param timeServiceClass The class that implements the WorldTimeService
+ * @throws Exception Test failed
+ */
+ private void doTestWorldTimeServiceGetTime(Class timeServiceClass) throws Exception {
+ // Add a getTime(String) method
+ Operation operation = newOperation("getTime", WorldTimeService.class, String.class);
+
+ Method method = JavaInterfaceUtil.findMethod(timeServiceClass, operation);
+ assertEquals("getTime", method.getName());
+ assertEquals(1, method.getParameterTypes().length);
+ assertEquals(String.class, method.getParameterTypes()[0]);
+ }
+
+ /**
+ * Test to get the getTime(int) method from the GMTTimeService
+ *
+ * @throws Exception Test failed
+ */
+ public void testGMTTimeServiceGetTime() throws Exception {
+ doTestGMTTimeServiceGetTime(GMTTimeService.class);
+ }
+
+ /**
+ * Test to get the getTime(int) method from the GMTTimeService interface from
+ * the specified class
+ *
+ * @param timeServiceClass The class that implements the WorldTimeService
+ * @throws Exception Test failed
+ */
+ private void doTestGMTTimeServiceGetTime(Class timeServiceClass) throws Exception {
+ // Add a getTime(String) method
+ Operation operation = newOperation("getTime", GMTTimeService.class, Integer.TYPE);
+
+ Method method = JavaInterfaceUtil.findMethod(timeServiceClass, operation);
+ assertEquals("getTime", method.getName());
+ assertEquals(1, method.getParameterTypes().length);
+ assertEquals(Integer.TYPE, method.getParameterTypes()[0]);
+ }
+
+
+ /**
+ * Test to get the getTime() method from the LocalTimeService on the
+ * TimeServiceImpl class
+ *
+ * @throws Exception Test failed
+ */
+ public void testLocalTimeServiceGetTimeFromTimeServiceImpl() throws Exception {
+ doTestLocalTimeServiceGetTime(TimeServiceImpl.class);
+ }
+
+ /**
+ * Test to get the getTime(String) method from the WorldTimeService on the
+ * TimeServiceImpl class
+ *
+ * @throws Exception Test failed
+ */
+ public void testWorldTimeServiceGetTimeFromTimeServiceImpl() throws Exception {
+ doTestWorldTimeServiceGetTime(TimeServiceImpl.class);
+ }
+
+ /**
+ * Test to get the getTime(int) method from the GMTTimeService
+ *
+ * @throws Exception Test failed
+ */
+ public void testGMTTimeServiceGetTimeFromTimeServiceImpl() throws Exception {
+ doTestGMTTimeServiceGetTime(TimeServiceImpl.class);
+ }
+
+ /**
+ * Creates a new operation with the specified name and parameter types
+ *
+ * @param name The name of the operation
+ * @param operationInterface The interface to which the operation belongs
+ * @param parameterTypes The types of the parameters for this operation
+ * @return An operation with the specified name and parameter types
+ */
+ private static Operation newOperation(String name, Class operationInterface, Class... parameterTypes) {
+ // Create and set the operation name
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+
+ // Make the operation remotable
+ Interface iface = new InterfaceImpl();
+ iface.setRemotable(true);
+ operation.setInterface(iface);
+
+ // Construct the parameters
+ List<DataType> types = new ArrayList<DataType>();
+ DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ for (Class parameterType : parameterTypes) {
+ DataType type = new DataTypeImpl<Class>(parameterType, Object.class);
+ types.add(type);
+ }
+ operation.setInputType(inputType);
+
+ // Return the created operation
+ return operation;
+ }
+
+ /**
+ * Test case that validates that a @Remotable interface with Overloaded operations
+ * is detected.
+ *
+ * This test case is for TUSCANY-2194
+ */
+ public void testDuplicateOpeartionOnRemotableInterface()
+ {
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorImpl introspector = new JavaInterfaceIntrospectorImpl(javaFactory);
+ JavaInterfaceImpl javaInterface = new JavaInterfaceImpl();
+
+ try {
+ introspector.introspectInterface(javaInterface, DuplicateMethodOnRemotableInterface.class);
+ Assert.fail("Should have thrown an exception as @Remotable interface has overloaded methods");
+ } catch (OverloadedOperationException ex) {
+ // As expected
+ // Make sure that the class and method names are in the exception
+ String exMsg = ex.toString();
+ Assert.assertTrue("Method name missing from exception", exMsg.indexOf("aDuplicateMethod") != -1);
+ Assert.assertTrue("Class name missing from exception",
+ exMsg.indexOf(DuplicateMethodOnRemotableInterface.class.getName()) != -1);
+ } catch (InvalidInterfaceException ex) {
+ // Should have thrown OverloadedOperationException
+ Assert.fail("Should have thrown an OverloadedOperationException but threw " + ex);
+ }
+ }
+
+
+ /**
+ * Sample @Remotable interface that has an overloaded operation which is not
+ * allowed according to the SCA Assembly Specification.
+ */
+ @Remotable
+ private interface DuplicateMethodOnRemotableInterface {
+ void aNonDuplicateMethod();
+ void aDuplicateMethod();
+ void aDuplicateMethod(String aParam);
+ }
+
+
+ /**
+ * Sample interface needed for the unit tests
+ */
+ @Remotable
+ private interface LocalTimeService {
+
+ /**
+ * Gets the local time
+ *
+ * @return The Local Time
+ */
+ String getTime();
+ }
+
+ /**
+ * Sample interface needed for the unit tests
+ */
+ @Remotable
+ private interface WorldTimeService {
+
+ /**
+ * Gets the time in the specified TimeZone
+ *
+ * @param timeZone A Time Zone
+ *
+ * @return The time in the specified TimeZone
+ */
+ String getTime(String timeZone);
+ }
+
+ /**
+ * Sample interface needed for the unit tests
+ */
+ @Remotable
+ private interface GMTTimeService {
+
+ /**
+ * Gets the time with the specified GMT offset
+ *
+ * @param gmtOffset A GMT offset in hours
+ *
+ * @return The time with the specified GMT offset
+ */
+ String getTime(int gmtOffset);
+ }
+
+ /**
+ * Sample implementation class that implements the three @Remotable interfaces
+ */
+ private class TimeServiceImpl implements LocalTimeService, WorldTimeService, GMTTimeService {
+ /**
+ * Gets the local time
+ *
+ * @return The Local Time
+ */
+ public String getTime() {
+ return "The current local time";
+ }
+
+ /**
+ * Gets the time in the specified TimeZone
+ *
+ * @param timeZone A Time Zone
+ *
+ * @return The time in the specified TimeZone
+ */
+ public String getTime(String timeZone) {
+ return "The current time in TimeZone " + timeZone;
+ }
+
+ /**
+ * Gets the time with the specified GMT offset
+ *
+ * @param gmtOffset A GMT offset in hours
+ *
+ * @return The time with the specified GMT offset
+ */
+ public String getTime(int gmtOffset) {
+ return "The current time with GMT offset of " + gmtOffset;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java
new file mode 100644
index 0000000000..66f98adce3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.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.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());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ Operation operation = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("foo");
+ operation.setInputType(inputType);
+ operations.add(operation);
+
+ }
+
+ private interface Foo {
+ void foo();
+
+ void foo(String foo);
+
+ void foo(int b);
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java
new file mode 100644
index 0000000000..f90a5cb8a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.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.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.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalIntrospectionTestCase extends TestCase {
+ private JavaInterfaceFactory javaFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ javaFactory = new DefaultJavaInterfaceFactory();
+ }
+
+ 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 = javaFactory.createJavaInterface(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 {
+ javaFactory.createJavaInterface(BadFoo.class);
+ fail();
+ } catch (InvalidOperationException e) {
+ // expected
+ }
+ }
+
+ public void testNonConversationalInformationIntrospection() throws Exception {
+ Interface i = javaFactory.createJavaInterface(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-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java
new file mode 100644
index 0000000000..14ac8b0134
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.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.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.util.List;
+
+import javax.xml.namespace.QName;
+
+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.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceProcessorRegistryImplTestCase extends TestCase {
+ private JavaInterfaceFactory factory;
+
+ @SuppressWarnings("unchecked")
+ public void testSimpleInterface() throws InvalidInterfaceException {
+ JavaInterface intf = factory.createJavaInterface(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());
+
+ QName element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "return");
+
+ DataType<XMLType> returnType = baseInt.getOutputType();
+ assertEquals(Integer.TYPE, returnType.getPhysical());
+ assertEquals(element, returnType.getLogical().getElementName());
+
+ List<DataType> parameterTypes = baseInt.getInputType().getLogical();
+ assertEquals(1, parameterTypes.size());
+ DataType<XMLType> arg0 = parameterTypes.get(0);
+ assertEquals(Integer.TYPE, arg0.getPhysical());
+
+ element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "arg0");
+ assertEquals(element, arg0.getLogical().getElementName());
+
+ List<DataType> faultTypes = baseInt.getFaultTypes();
+ assertEquals(1, faultTypes.size());
+ DataType<DataType<XMLType>> fault0 = faultTypes.get(0);
+ assertEquals(IOException.class, fault0.getPhysical());
+ element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "IOException");
+ assertEquals(element, fault0.getLogical().getLogical().getElementName());
+ }
+
+ public void testUnregister() throws Exception {
+ JavaInterfaceVisitor extension = createMock(JavaInterfaceVisitor.class);
+ extension.visitInterface(EasyMock.isA(JavaInterface.class));
+ expectLastCall().once();
+ replay(extension);
+ factory.addInterfaceVisitor(extension);
+ factory.createJavaInterface(Base.class);
+ factory.removeInterfaceVisitor(extension);
+ factory.createJavaInterface(Base.class);
+ verify(extension);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = new DefaultJavaInterfaceFactory();
+
+ }
+
+ 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-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java
new file mode 100644
index 0000000000..5a454f176c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.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.java.introspection.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.impl.PolicyJavaInterfaceVisitor;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.osoa.sca.annotations.PolicySets;
+import org.osoa.sca.annotations.Requires;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PolicyProcessorTestCase extends TestCase {
+ private JavaInterfaceFactory factory = new DefaultJavaInterfaceFactory();
+ private PolicyJavaInterfaceVisitor policyProcessor;
+
+ public void testInterfaceLevel() throws Exception {
+ JavaInterface type = factory.createJavaInterface(Interface1.class);
+ policyProcessor.visitInterface(type);
+ assertEquals(1, type.getRequiredIntents().size());
+ assertEquals(1, type.getPolicySets().size());
+ }
+
+ public void testMethodLevel() throws Exception {
+ JavaInterface type = factory.createJavaInterface(Interface2.class);
+ policyProcessor.visitInterface(type);
+ assertEquals(0, type.getRequiredIntents().size());
+ assertEquals(1, type.getOperations().get(0).getRequiredIntents().size());
+ assertEquals(1, type.getOperations().get(1).getRequiredIntents().size());
+ assertEquals(0, type.getPolicySets().size());
+ assertEquals(1, type.getOperations().get(0).getPolicySets().size());
+ assertEquals(1, type.getOperations().get(1).getPolicySets().size());
+ }
+
+ public void testInterfaceAndMethodLevel() throws Exception {
+ JavaInterface type = factory.createJavaInterface(Interface3.class);
+ policyProcessor.visitInterface(type);
+ assertEquals(1, type.getRequiredIntents().size());
+ assertEquals(1, type.getOperations().get(0).getRequiredIntents().size());
+ assertEquals(1, type.getOperations().get(1).getRequiredIntents().size());
+ assertEquals(1, type.getPolicySets().size());
+ assertEquals(1, type.getOperations().get(0).getPolicySets().size());
+ assertEquals(1, type.getOperations().get(1).getPolicySets().size());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ policyProcessor = new PolicyJavaInterfaceVisitor(new DefaultPolicyFactory());
+ }
+
+ // @Remotable
+ @Requires( {"transaction.global"})
+ @PolicySets( {"{http://ns1}PS1"})
+ private interface Interface1 {
+ int method1();
+
+ int method2();
+
+ int method3();
+
+ int method4();
+ }
+
+ private interface Interface2 {
+ @Requires( {"transaction.global"})
+ @PolicySets( {"{http://ns1}PS1"})
+ int method1();
+
+ @Requires( {"transaction.local"})
+ @PolicySets( {"{http://ns1}PS2"})
+ int method2();
+ }
+
+ @Requires( {"transaction.global.Interface6"})
+ @PolicySets( {"{http://ns1}PS1"})
+ private interface Interface3 {
+ @Requires( {"transaction.global.Interface6.method1"})
+ @PolicySets( {"{http://ns1}PS2"})
+ int method1();
+
+ @Requires( {"transaction.local.Interface6.method2"})
+ @PolicySets( {"{http://ns1}PS3"})
+ int method2();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/LICENSE b/sca-java-1.x/branches/sca-android/modules/interface/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/interface/META-INF/README b/sca-java-1.x/branches/sca-android/modules/interface/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/NOTICE b/sca-java-1.x/branches/sca-android/modules/interface/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/interface/pom.xml b/sca-java-1.x/branches/sca-android/modules/interface/pom.xml
new file mode 100644
index 0000000000..7c75e66767
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface</artifactId>
+ <name>Apache Tuscany SCA Interface Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.interface</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.interfacedef*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java
new file mode 100644
index 0000000000..247a432330
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.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.interfacedef;
+
+/**
+ * Enum of the Conversation Sequence values.
+ *
+ * @version $Rev$ $Date$
+ */
+public enum ConversationSequence {
+ CONVERSATION_NONE, CONVERSATION_START, CONVERSATION_CONTINUE, CONVERSATION_END
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java
new file mode 100644
index 0000000000..1f5620c0b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.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.interfacedef;
+
+import java.lang.reflect.Type;
+
+/**
+ * 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();
+
+ /**
+ * Get the java generic type
+ * @return The java generic type
+ */
+ Type getGenericType();
+
+ /**
+ * Set the java generic type
+ * @param genericType
+ */
+ void setGenericType(Type genericType);
+
+ /**
+ * 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();
+
+ /**
+ * Get the databinding for the given data type
+ * @return the databinding
+ */
+ String getDataBinding();
+
+ /**
+ * Set the databinding for the given data type
+ * @param dataBinding the dataBinding to set
+ */
+ void setDataBinding(String dataBinding);
+
+ /**
+ * Clone a data type
+ * @return The cloned data type
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+ /**
+ * Set the logical type of the data type
+ * @param logical the logical to set
+ */
+ void setLogical(L logical);
+
+ /**
+ * Get the databinding-specific metadata
+ * @param type The java type of the metadata
+ * @return the databinding-specific metadata
+ */
+ <T> T getMetaData(Class<T> type);
+ /**
+ * Set the databinding-specific metadata
+ * @param type The java type of the metadata
+ * @param metaData the databinding-specific metadata, such as SDO's commonj.sdo.Type or
+ * JAXB's javax.xml.bind.JAXBContext
+ */
+ <T> void setMetaData(Class<T> type, T metaData);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java
new file mode 100644
index 0000000000..70f6d5b403
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.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.interfacedef;
+
+/**
+ * This interface represents the mapping between WSDL faults and Java exceptions
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("unchecked")
+public interface FaultExceptionMapper {
+ /**
+ * Introspect an exception class to find out the fault data type following the WSDL2Java
+ * mapping rules. The result will be populated into the logical type of the exception data
+ * type
+ *
+ * @param exceptionDataType The data type representing a java exception class
+ * @param operation TODO
+ * @param generatingFaultBean If JAXWS Section 3.7 Fault Bean will be generated
+ * @return true if the introspection can recognize the exception data type
+ */
+ boolean introspectFaultDataType(DataType<DataType> exceptionDataType, Operation operation, boolean generatingFaultBean);
+
+ /**
+ * Create a java exception to wrap the fault data
+ *
+ * @param exceptionType The DataType for the exception
+ * @param message message for the exception
+ * @param faultInfo The fault data
+ * @param cause of the exception
+ * @param operation TODO
+ * @return An instance of java exception to represent the fault
+ */
+ Throwable wrapFaultInfo(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause, Operation operation);
+
+ /**
+ * Retrieve the fault info from a java exception
+ *
+ * @param exception The java exception that represents the fault data
+ * @param faultBeanClass
+ * @param operation TODO
+ * @return The fault data
+ */
+ Object getFaultInfo(Throwable exception, Class<?> faultBeanClass, Operation operation);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java
new file mode 100644
index 0000000000..179dc1755e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 incompatible 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-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java
new file mode 100644
index 0000000000..f9de645a6e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.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.interfacedef;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * 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.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Interface extends Cloneable, PolicySetAttachPoint {
+
+ /**
+ * 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();
+
+ /**
+ * Set the databinding for the interface
+ * @param dataBinding
+ * @deprecated Please use resetDataBinding
+ */
+ @Deprecated
+ void setDefaultDataBinding(String dataBinding);
+
+ /**
+ * Reset the databinding for the interface
+ * @param dataBinding
+ */
+ void resetDataBinding(String dataBinding);
+
+ /**
+ * Returns true if the Interface is dynamic.
+ *
+ * @return true if the Interface is dynamic.
+ */
+ boolean isDynamic();
+
+ /**
+ * Implementations must support cloning.
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java
new file mode 100644
index 0000000000..568a6c595c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.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;
+
+
+/**
+ * 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 extends Cloneable {
+
+ /**
+ * 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);
+
+ // FIXME: We need a better way to do this
+ /**
+ * Convert an interface contract to a unidirectional interface contract
+ *
+ * @param isCallback true for a callback interface contract, false for
+ * a forward interface contract
+ * @return A unidirectional interface contract, cloned if necessary
+ */
+ InterfaceContract makeUnidirectional(boolean isCallback);
+
+ /**
+ * Implementations must support cloning.
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
new file mode 100644
index 0000000000..5601b09660
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 compatibility 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 symmetric: 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-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java
new file mode 100644
index 0000000000..2a273c9a26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.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.interfacedef;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class InvalidInterfaceException extends Exception {
+
+ public InvalidInterfaceException() {
+ super();
+ }
+
+ 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-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java
new file mode 100644
index 0000000000..4676e35f80
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.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.sca.interfacedef;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents an operation on a service interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Operation extends Cloneable, PolicySetAttachPoint {
+ /**
+ * 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);
+
+ /**
+ * @deprecated This should be the WrapperInfo.getDataBinding()
+ * Get the databinding for the operation
+ * @return
+ */
+ @Deprecated
+ String getDataBinding();
+
+ /**
+ * @deprecated This should be the WrapperInfo.setDataBinding()
+ * Set the databinding for the operation
+ * @param dataBinding
+ */
+ @Deprecated
+ void setDataBinding(String dataBinding);
+
+ /**
+ * Returns true if the operation is dynamic.
+ *
+ * @return true if the operation is dynamic otherwise false
+ */
+ boolean isDynamic();
+
+ /**
+ * Set if the operation is dynamic
+ * @param b
+ */
+ void setDynamic(boolean b);
+
+ /**
+ * Get the synthesized fault beans for this operation
+ *
+ * @return the fault beans
+ */
+ Map<QName, List<DataType<XMLType>>> getFaultBeans();
+
+ /**
+ * Set the synthesized fault beans for this operation
+ * @param faultBeans
+ */
+ void setFaultBeans(Map<QName, List<DataType<XMLType>>> faultBeans);
+
+ /**
+ * Implementations must support cloning.
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java
new file mode 100644
index 0000000000..6773b29088
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.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.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(operation == null ?
+ null : "Cannot overload operation " + operation.getName()
+ + " on " + operation.getDeclaringClass().getName()
+ + " as it is a @Remotable interface");
+ this.operation = operation;
+ }
+
+ public Method getOperation() {
+ return operation;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java
new file mode 100644
index 0000000000..c1c8400b71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+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 String dataBinding;
+ private Class<?> physical;
+ private Type genericType;
+ private L logical;
+ private Map<Class<?>, Object> metaDataMap;
+
+ /**
+ * 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(null, physical, physical, logical);
+ }
+
+ /**
+ * @param dataBinding
+ * @param physical
+ * @param logical
+ */
+ public DataTypeImpl(String dataBinding, Class<?> physical, L logical) {
+ this(dataBinding, physical, physical, logical);
+ }
+
+ /**
+ * @param dataBinding
+ * @param physical
+ * @param genericType
+ * @param logical
+ */
+ public DataTypeImpl(String dataBinding, Class<?> physical, Type genericType, L logical) {
+ super();
+ this.dataBinding = dataBinding;
+ this.physical = physical;
+ this.genericType = genericType;
+ this.logical = logical;
+ }
+
+ /**
+ * Returns the physical type used by the runtime.
+ *
+ * @return the physical type used by the runtime
+ */
+ public Class<?> getPhysical() {
+ return physical;
+ }
+
+ /**
+ * @param physical the physical to set
+ */
+ public void setPhysical(Class<?> physical) {
+ this.physical = physical;
+ }
+
+ /**
+ * Get the java generic type
+ * @return The java generic type
+ */
+ public Type getGenericType() {
+ return genericType;
+ }
+
+ /**
+ * Set the java generic type
+ * @param genericType
+ */
+ public void setGenericType(Type genericType) {
+ this.genericType = genericType;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * @param logical the logical to set
+ */
+ public void setLogical(L logical) {
+ this.logical = logical;
+ }
+
+ public String getDataBinding() {
+ return dataBinding;
+ }
+
+ /**
+ * @param dataBinding the dataBinding to set
+ */
+ public void setDataBinding(String dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((dataBinding == null) ? 0 : dataBinding.hashCode());
+ result = prime * result + ((genericType == null) ? 0 : genericType.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 (genericType == null) {
+ if (other.genericType != null)
+ return false;
+ } else if (!genericType.equals(other.genericType))
+ 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;
+ }
+
+ public <T> T getMetaData(Class<T> type) {
+ return metaDataMap == null ? null : type.cast(metaDataMap.get(type));
+ }
+
+ public <T> void setMetaData(Class<T> type, T metaData) {
+ if (metaDataMap == null) {
+ metaDataMap = new ConcurrentHashMap<Class<?>, Object>();
+ }
+ metaDataMap.put(type, metaData);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java
new file mode 100644
index 0000000000..15581b5e04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.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.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;
+ }
+
+ public InterfaceContract makeUnidirectional(boolean isCallback) {
+ if (!isCallback && callbackInterface == null)
+ return this; // already a unidirectional forward interface contract
+
+ if (isCallback && callInterface == null)
+ return this; // already a unidirectional callback interface contract
+
+ // contract is bidirectional, so create a new unidirectional contract
+ try {
+ InterfaceContract newContract = clone();
+ if (!isCallback) {
+ newContract.setCallbackInterface(null); // create unidirectional forward interface contract
+ } else {
+ newContract.setInterface(null); // create unidirectional callback interface contract
+ }
+ return newContract;
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ return null;
+ }
+ }
+
+ @Override
+ public InterfaceContractImpl clone() throws CloneNotSupportedException {
+ InterfaceContractImpl copy = (InterfaceContractImpl)super.clone();
+ if (this.callbackInterface != null) {
+ copy.callbackInterface = (Interface)this.callbackInterface.clone();
+ }
+ if (this.callInterface != null) {
+ copy.callInterface = (Interface)this.callInterface.clone();
+ }
+ return copy;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((callInterface == null) ? 0 : callInterface.hashCode());
+ result = prime * result + ((callbackInterface == null) ? 0 : callbackInterface.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 InterfaceContractImpl other = (InterfaceContractImpl)obj;
+ if (callInterface == null) {
+ if (other.callInterface != null) {
+ return false;
+ }
+ } else if (!callInterface.equals(other.callInterface)) {
+ return false;
+ }
+ if (callbackInterface == null) {
+ if (other.callbackInterface != null) {
+ return false;
+ }
+ } else if (!callbackInterface.equals(other.callbackInterface)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
new file mode 100644
index 0000000000..9e7d6882f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.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) {
+ if (source == null || target == null) {
+ return false;
+ }
+ // For local case
+ return target.getPhysical().isAssignableFrom(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;
+ }
+
+ if (source.isDynamic() || target.isDynamic()) {
+ return true;
+ }
+
+ // Check name
+ if (!source.getName().equals(target.getName())) {
+ return false;
+ }
+
+ if (source.getInterface().isRemotable() != target.getInterface().isRemotable()) {
+ return false;
+ }
+
+ // if (source.getInterface().isRemotable()) {
+ // return true;
+ // }
+
+ // 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;
+ }
+
+ boolean checkSourceWrapper = true;
+ List<DataType> sourceInputType = source.getInputType().getLogical();
+ if (source.isWrapperStyle() && source.getWrapper() != null) {
+ sourceInputType = source.getWrapper().getUnwrappedInputType().getLogical();
+ checkSourceWrapper = false;
+ }
+ boolean checkTargetWrapper = true;
+ List<DataType> targetInputType = target.getInputType().getLogical();
+ if (target.isWrapperStyle() && target.getWrapper() != null) {
+ targetInputType = target.getWrapper().getUnwrappedInputType().getLogical();
+ checkTargetWrapper = false;
+ }
+
+ if (checkSourceWrapper != checkTargetWrapper) {
+ return true;
+ }
+ 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().isDynamic() || target.getInterface().isDynamic()) {
+ 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 (!isCompatible(operation, targetOperation, false)) {
+ 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 (!source.getCallbackInterface().isRemotable()) {
+ // FIXME: for remotable operation, only compare name for now
+ 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.isDynamic() || target.isDynamic()) {
+ return true;
+ }
+
+ 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 (!isCompatible(operation, targetOperation, source.isRemotable())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean isCompatible(InterfaceContract source, InterfaceContract target) {
+ try {
+ return checkCompatibility(source, target, false, false);
+ } 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) {
+ // TODO: How to handle the case that source operation is dynamic?
+ if (target == null || target.isDynamic()) {
+ return source;
+ } else 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-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
new file mode 100644
index 0000000000..e2a524c5e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.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;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * 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;
+
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType type;
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+
+ 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);
+ }
+
+ }
+
+ @Deprecated
+ 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);
+ }
+ DataType ft = (DataType) d.getLogical();
+ if (ft.getDataBinding() == null) {
+ ft.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);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void setDataBinding(DataType dataType, String dataBinding) {
+ if ("java:array".equals(dataType.getDataBinding())) {
+ setDataBinding((DataType)dataType.getLogical(), dataBinding);
+ } else {
+ dataType.setDataBinding(dataBinding);
+ }
+ }
+
+ public void resetDataBinding(String dataBinding) {
+ for (Operation op : getOperations()) {
+ op.setDataBinding(dataBinding);
+ DataType<List<DataType>> inputType = op.getInputType();
+ if (inputType != null) {
+ for (DataType d : inputType.getLogical()) {
+ setDataBinding(d, dataBinding);
+ }
+ }
+ DataType outputType = op.getOutputType();
+ if (outputType != null) {
+ setDataBinding(outputType, dataBinding);
+ }
+ List<DataType> faultTypes = op.getFaultTypes();
+ if (faultTypes != null) {
+ for (DataType d : faultTypes) {
+ setDataBinding(d, dataBinding);
+ setDataBinding((DataType) d.getLogical(), 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()) {
+ setDataBinding(d, dataBinding);
+ }
+ }
+ DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
+ if (unwrappedOutputType != null) {
+ setDataBinding(unwrappedOutputType, dataBinding);
+ }
+ }
+ }
+ }
+ }
+
+ public boolean isDynamic() {
+ return false;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return type;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.type = type;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ InterfaceImpl copy = (InterfaceImpl)super.clone();
+ copy.operations = new OperationList();
+ for (Operation operation : this.operations) {
+ Operation clonedOperation = (Operation)operation.clone();
+ copy.operations.add(clonedOperation);
+ }
+ return copy;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (conversational ? 1231 : 1237);
+ result = prime * result + ((operations == null) ? 0 : operations.hashCode());
+ result = prime * result + (remotable ? 1231 : 1237);
+ result = prime * result + (unresolved ? 1231 : 1237);
+ 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 InterfaceImpl other = (InterfaceImpl)obj;
+ if (conversational != other.conversational)
+ return false;
+ if (operations == null) {
+ if (other.operations != null)
+ return false;
+ } else if (!operations.equals(other.operations))
+ return false;
+ if (remotable != other.remotable)
+ return false;
+ if (unresolved != other.unresolved)
+ return false;
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
new file mode 100644
index 0000000000..00a5dc3065
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
@@ -0,0 +1,339 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+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;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * 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 boolean dynamic;
+ private Map<QName, List<DataType<XMLType>>> faultBeans;
+
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private IntentAttachPointType type;
+
+ /**
+ * @param name
+ */
+ public OperationImpl() {
+ inputType = new DataTypeImpl<List<DataType>>("idl:input", Object[].class, new ArrayList<DataType>());
+ faultTypes = new ArrayList<DataType>();
+ faultBeans = new HashMap<QName, List<DataType<XMLType>>>();
+ }
+
+ 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 interface
+ */
+ public Interface getInterface() {
+ return interfaze;
+ }
+
+ /**
+ * @param interfaze the interface 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;
+ }
+
+ @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 wrapper != null ? wrapper.getDataBinding() : null;
+ }
+
+ public void setDataBinding(String dataBinding) {
+ if (wrapper != null) {
+ wrapper.setDataBinding(dataBinding);
+ }
+ }
+
+ public boolean isDynamic() {
+ return dynamic;
+ }
+
+ public void setDynamic(boolean b) {
+ this.dynamic = b;
+ }
+
+ public Map<QName, List<DataType<XMLType>>> getFaultBeans() {
+ return faultBeans;
+ }
+
+ public void setFaultBeans(Map<QName, List<DataType<XMLType>>> faultBeans) {
+ this.faultBeans = faultBeans;
+ }
+
+ @Override
+ public OperationImpl clone() throws CloneNotSupportedException {
+ OperationImpl copy = (OperationImpl) super.clone();
+
+ final List<DataType> clonedFaultTypes = new ArrayList<DataType>(this.faultTypes.size());
+ for (DataType t : this.faultTypes) {
+ clonedFaultTypes.add((DataType) t.clone());
+ }
+ copy.faultTypes = clonedFaultTypes;
+
+ List<DataType> clonedLogicalTypes = new ArrayList<DataType>();
+ for (DataType t : inputType.getLogical()) {
+ DataType type = (DataType) t.clone();
+ clonedLogicalTypes.add(type);
+ }
+ DataType<List<DataType>> clonedInputType =
+ new DataTypeImpl<List<DataType>>(inputType.getPhysical(), clonedLogicalTypes);
+ clonedInputType.setDataBinding(inputType.getDataBinding());
+ copy.inputType = clonedInputType;
+
+ if (this.outputType != null) {
+ copy.outputType = (DataType) this.outputType.clone();
+ }
+
+ return copy;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return type;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.type = type;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java
new file mode 100644
index 0000000000..777fa567f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.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.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstraction of XML schema elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ElementInfo {
+ private final QName name;
+ private final TypeInfo type;
+ private boolean many = false;
+ private boolean nillable = false;
+
+ /**
+ * @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;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Element: ").append(name).append(" ").append(type);
+ return sb.toString();
+ }
+
+ public boolean isMany() {
+ return many;
+ }
+
+ public void setMany(boolean many) {
+ this.many = many;
+ }
+
+ public boolean isNillable() {
+ return nillable;
+ }
+
+ public void setNillable(boolean nillable) {
+ this.nillable = nillable;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.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 ElementInfo other = (ElementInfo)obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ /*
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ */
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java
new file mode 100644
index 0000000000..844b0af509
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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 transient Object faultInfo; // FIXME: How to serialize it?
+ private QName faultName;
+
+ /**
+ * @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 getFaultName() {
+ return faultName;
+ }
+
+ public void setFaultName(QName logical) {
+ this.faultName = logical;
+ }
+
+ public boolean isMatchingType(Object type) {
+ if (faultName == null) {
+ return false;
+ }
+
+ if ((type instanceof QName) && faultName.equals(type)) {
+ return true;
+ }
+ if (type instanceof XMLType && faultName.equals(((XMLType)type).getElementName())) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java
new file mode 100644
index 0000000000..54c0a3ec11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.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.sca.interfacedef.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Utility class that can be used to map XSD types to Java classes and Java classes to XSD types.
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+ }
+
+ private static String getPackageName(Class<?> cls) {
+ String name = cls.getName();
+ int index = name.lastIndexOf('.');
+ return index == -1 ? "" : name.substring(0, index);
+ }
+
+ public static String getNamespace(Class<?> cls) {
+ String packageName = getPackageName(cls);
+ if ("".equals(packageName)) {
+ return "";
+ }
+ StringBuffer ns = new StringBuffer("http://");
+ String[] names = packageName.split("\\.");
+ for (int i = names.length - 1; i >= 0; i--) {
+ ns.append(names[i]);
+ if (i != 0) {
+ ns.append('.');
+ }
+ }
+ ns.append('/');
+ return ns.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java
new file mode 100644
index 0000000000..2598dc8545
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.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.interfacedef.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstraction of XML schema types
+ *
+ * @version $Rev$ $Date$
+ */
+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;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Type: ").append(name);
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.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 TypeInfo other = (TypeInfo)obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
new file mode 100644
index 0000000000..12db460959
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.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.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;
+
+ // The data type of the unwrapped input child elements
+ private DataType<List<DataType>> unwrappedInputType;
+
+ // The data type of the unwrapped output child element (we only supports one child)
+ private DataType<XMLType> unwrappedOutputType;
+
+ // The data for the input/output wrappers
+ private String dataBinding;
+
+ // The data type for the input (request) wrapper bean
+ private DataType<XMLType> inputWrapperType;
+ // The data type for the output (response) wrapper bean
+ private DataType<XMLType> outputWrapperType;
+
+ 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 type = getDataType(element);
+ childTypes.add(type);
+ }
+ unwrappedInputType = new DataTypeImpl<List<DataType>>("idl:unwrapped.input", Object[].class, childTypes);
+ }
+ return unwrappedInputType;
+ }
+
+ private DataType getDataType(ElementInfo element) {
+ DataType type = null;
+ if (element.isMany()) {
+ DataType logical = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
+ type = new DataTypeImpl<DataType>("java:array", Object[].class, logical);
+ } else {
+ type = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
+ }
+ return type;
+ }
+
+ /**
+ * @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 = getDataType(element);
+ }
+ }
+ return unwrappedOutputType;
+ }
+
+ public Class<?> getInputWrapperClass() {
+ return inputWrapperType == null ? null : inputWrapperType.getPhysical();
+ }
+
+ public Class<?> getOutputWrapperClass() {
+ return outputWrapperType == null ? null : outputWrapperType.getPhysical();
+ }
+
+ public String getDataBinding() {
+ return dataBinding;
+ }
+
+ public void setDataBinding(String dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+ public DataType<XMLType> getInputWrapperType() {
+ return inputWrapperType;
+ }
+
+ public void setInputWrapperType(DataType<XMLType> inputWrapperType) {
+ this.inputWrapperType = inputWrapperType;
+ }
+
+ public DataType<XMLType> getOutputWrapperType() {
+ return outputWrapperType;
+ }
+
+ public void setOutputWrapperType(DataType<XMLType> outputWrapperType) {
+ this.outputWrapperType = outputWrapperType;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java
new file mode 100644
index 0000000000..26ecf6e352
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.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.interfacedef.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The metadata for an XML element or type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLType {
+ public static final XMLType UNKNOWN = new XMLType(null, null);
+ protected QName element;
+ protected QName type;
+ protected boolean nillable = true;
+ protected boolean many = false;
+
+ /**
+ * @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 void setElementName(QName element) {
+ this.element = element;
+ }
+
+ public void setTypeName(QName type) {
+ this.type = type;
+ }
+
+ 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;
+ }
+
+ public boolean isNillable() {
+ return nillable;
+ }
+
+ public void setNillable(boolean niable) {
+ this.nillable = niable;
+ }
+
+ public boolean isMany() {
+ return many;
+ }
+
+ public void setMany(boolean many) {
+ this.many = many;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.InterfaceContractMapper b/sca-java-1.x/branches/sca-android/modules/interface/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.InterfaceContractMapper
new file mode 100644
index 0000000000..821c58bde1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.InterfaceContractMapper
@@ -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.
+
+org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java b/sca-java-1.x/branches/sca-android/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
new file mode 100644
index 0000000000..269a3dc038
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
@@ -0,0 +1,380 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+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;
+
+ @Override
+ protected void setUp() throws Exception {
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ mapper = utilities.getUtility(InterfaceContractMapper.class);
+ }
+
+ 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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperationImpl("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 = newOperationImpl("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 = newOperation("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 = newOperation("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);
+ }
+
+ /**
+ * Verifies 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 = newOperationImpl("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 = newOperationImpl("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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("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 = newOperation("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
+ * compatible
+ *
+ * @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 = newOperationImpl("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 = newOperationImpl("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 compatible
+ */
+ 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 = newOperationImpl("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 = newOperationImpl("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();
+ setInterface(jInterface);
+ }
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java b/sca-java-1.x/branches/sca-android/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java
new file mode 100644
index 0000000000..338170da52
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.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.impl;
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InterfaceContractTestCase {
+ private InterfaceContract contract;
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ contract = new MockInterfaceContract();
+ Interface i1 = new MockInterface();
+ contract.setInterface(i1);
+ Operation op1 = newOperation("op1");
+ i1.getOperations().add(op1);
+ Interface i2 = new MockInterface();
+ contract.setCallbackInterface(i2);
+ Operation callbackOp1 = newOperation("callbackOp1");
+ i2.getOperations().add(callbackOp1);
+ }
+
+ @Test
+ public void testClone() throws Exception {
+ InterfaceContract copy = (InterfaceContract) contract.clone();
+ Assert.assertEquals(contract, copy);
+ }
+
+ private static class MockInterfaceContract extends InterfaceContractImpl implements InterfaceContract {
+ }
+
+ private static class MockInterface extends InterfaceImpl implements Interface {
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/monitor/LICENSE b/sca-java-1.x/branches/sca-android/modules/monitor/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/monitor/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-android/modules/monitor/META-INF/README b/sca-java-1.x/branches/sca-android/modules/monitor/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/monitor/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/monitor/NOTICE b/sca-java-1.x/branches/sca-android/modules/monitor/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/monitor/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/monitor/pom.xml b/sca-java-1.x/branches/sca-android/modules/monitor/pom.xml
new file mode 100644
index 0000000000..44990c4c02
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/monitor/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-monitor</artifactId>
+ <name>Apache Tuscany SCA Monitor</name>
+
+ <dependencies>
+
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.monitor</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.monitor*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java
new file mode 100644
index 0000000000..c16140213d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.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.monitor;
+
+import java.util.List;
+
+/**
+ * A monitor for the watching for validation problems
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Monitor {
+ /**
+ * Reports a build problem.
+ *
+ * @param problem
+ */
+ void problem(Problem problem);
+
+ /**
+ * Returns a list of reported problems.
+ *
+ * @return the list of problems. The list may be empty
+ */
+ List<Problem> getProblems();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java
new file mode 100644
index 0000000000..38c3bbd991
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.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.monitor;
+
+/**
+ * A factory for validation monitors
+ *
+ * @version $Rev$ $Date$
+ */
+public interface MonitorFactory {
+
+ /**
+ * Create a new monitor
+ *
+ * @return a new monitor
+ */
+ Monitor createMonitor();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java
new file mode 100644
index 0000000000..83a2d63eae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.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.monitor;
+
+
+/**
+ * Records an validation problem.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Problem {
+
+ public enum Severity {
+ INFO,
+ WARNING,
+ ERROR
+ }
+
+ String getSourceClassName();
+
+ String getBundleName();
+
+ Severity getSeverity();
+
+ Object getProblemObject();
+
+ String getMessageId();
+
+ Exception getCause();
+
+ Object[] getMessageParams();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java
new file mode 100644
index 0000000000..274b4faefd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.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.monitor.impl;
+
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+
+
+/**
+ * A factory for creating validation monitors
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultMonitorFactoryImpl implements MonitorFactory {
+
+ private Monitor monitor = null;
+
+ public Monitor createMonitor() {
+ if (monitor == null){
+ monitor = new DefaultMonitorImpl();
+ }
+ return monitor ;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java
new file mode 100644
index 0000000000..b98f29d4dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.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.monitor.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+
+/**
+ * A monitor for the watching for validation problems
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultMonitorImpl implements Monitor {
+ private static final Logger logger = Logger.getLogger(DefaultMonitorImpl.class.getName());
+
+ // Cache all the problem reported to monitor for further analysis
+ private List<Problem> problemCache = new ArrayList<Problem>();
+
+ public void problem(Problem problem) {
+
+ Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName());
+
+ if (problemLogger == null){
+ logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getBundleName());
+ }
+
+ if (problem.getSeverity() == Severity.INFO) {
+ problemCache.add(problem);
+ problemLogger.logp(Level.INFO, problem.getSourceClassName(), null,
+ problem.getMessageId(), problem.getMessageParams());
+ }
+ else if (problem.getSeverity() == Severity.WARNING) {
+ problemCache.add(problem);
+ problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null,
+ problem.getMessageId(), problem.getMessageParams());
+ }
+ else if (problem.getSeverity() == Severity.ERROR) {
+ if (problem.getCause() != null) {
+ problemCache.add(problem);
+ problemLogger.logp(Level.SEVERE, problem.getSourceClassName(),
+ null, problem.getMessageId(), problem.getCause().toString());
+
+ } else {
+ problemCache.add(problem);
+ problemLogger.logp(Level.SEVERE, problem.getSourceClassName(), null,
+ problem.getMessageId(), problem.getMessageParams());
+ }
+ }
+ }
+
+ public List<Problem> getProblems(){
+ return problemCache;
+ }
+
+ public Problem getLastLoggedProblem(){
+ return problemCache.get(problemCache.size() - 1);
+ }
+
+ public boolean isMessageLogged(String messageId) {
+ for (Problem problem : problemCache){
+ if (problem.getMessageId().equals(messageId)){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public Problem getProblem(String messageId) {
+ for (Problem problem : problemCache){
+ if (problem.getMessageId().equals(messageId)){
+ return problem;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-api/LICENSE b/sca-java-1.x/branches/sca-android/modules/node-api/LICENSE
new file mode 100644
index 0000000000..6e529a25c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-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-android/modules/node-api/META-INF/README b/sca-java-1.x/branches/sca-android/modules/node-api/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-api/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/node-api/NOTICE b/sca-java-1.x/branches/sca-android/modules/node-api/NOTICE
new file mode 100644
index 0000000000..1325efd8bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-api/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/node-api/pom.xml b/sca-java-1.x/branches/sca-android/modules/node-api/pom.xml
new file mode 100644
index 0000000000..02210daa88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-api/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node-api</artifactId>
+ <name>Apache Tuscany SCA Node API</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.node.api</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.node*</Export-Package>
+ <DynamicImport-Package>org.apache.tuscany.sca.node.impl,org.apache.tuscany.sca.extensibility</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.java b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.java
new file mode 100644
index 0000000000..f390e8881e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.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.node;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+
+/**
+ * Provides client access to the services in a domain.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCAClient {
+
+ /**
+ * Cast a type-safe reference to a CallahbleReference. 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 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
+ */
+ <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
+ */
+ <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String serviceName);
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java
new file mode 100644
index 0000000000..de7f352122
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.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.node;
+
+/**
+ * Represents an SCA contribution uri + location.
+ */
+public final class SCAContribution {
+ private String uri;
+ private String location;
+
+ /**
+ * Constructs a new SCA contribution.
+ *
+ * @param uri The URI that uniquely identifies the contribution in the SCA domain
+ * @param location The URL of the contribution archive
+ */
+ public SCAContribution(String uri, String location) {
+ this.uri = uri;
+ this.location = location;
+ }
+
+ /**
+ * Get the URI of the contribution
+ * @return The URI that uniquely identifies the contribution in the SCA domain
+ */
+ public String getURI() {
+ return uri;
+ }
+
+ /**
+ * The location of the contribution
+ * @return The URL of the contribution archive
+ */
+ public String getLocation() {
+ return location;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java
new file mode 100644
index 0000000000..fea749a57c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.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.node;
+
+
+
+/**
+ * Represents an SCA processing node.
+ * A node is loaded with an SCA composites. It can start and stop that composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCANode {
+
+ /**
+ * Start the composite loaded in the node.
+ */
+ void start();
+
+ /**
+ * Stop the composite loaded in the node.
+ */
+ void stop();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.java b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.java
new file mode 100644
index 0000000000..a1d4ddb2b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.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.node;
+
+
+
+/**
+ * Represents an SCA processing node.
+ * A node is loaded with an SCA composites. It can start and stop that composite.
+ *
+ * @version $Rev$ $Date$
+ * @deprecated Use SCANode instead
+ */
+@Deprecated
+public interface SCANode2 extends SCANode {
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java
new file mode 100644
index 0000000000..2b0dbc88eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.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.sca.node;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A factory for SCA processing nodes. An SCA processing node can be loaded
+ * with an SCA composite and the SCA contributions required by the composite.
+ *
+ * @version $Rev$ $Date$
+ * @deprecated Use SCANodeFactory
+ */
+@Deprecated
+public abstract class SCANode2Factory {
+
+ public static class NodeProxy implements SCANode2, SCAClient {
+ private Object node;
+
+ private NodeProxy(Object node) {
+ super();
+ this.node = node;
+ }
+
+ public static <T> T createProxy(Class<T> type, Object node) {
+ try {
+ return type.getDeclaredConstructor(Object.class).newInstance(node);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ try {
+ return (R)node.getClass().getMethod("cast", Object.class).invoke(node, target);
+ } catch (Throwable e) {
+ handleException(e);
+ return null;
+ }
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ try {
+ return (B)node.getClass().getMethod("getService", Class.class, String.class).invoke(node,
+ businessInterface,
+ serviceName);
+ } catch (Throwable e) {
+ handleException(e);
+ return null;
+ }
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String serviceName) {
+ try {
+ return (ServiceReference<B>)node.getClass().getMethod("getServiceReference", Class.class, String.class)
+ .invoke(node, businessInterface, serviceName);
+ } catch (Throwable e) {
+ handleException(e);
+ return null;
+ }
+ }
+
+ public void start() {
+ try {
+ node.getClass().getMethod("start").invoke(node);
+ } catch (Throwable e) {
+ handleException(e);
+ }
+ }
+
+ public void stop() {
+ try {
+ node.getClass().getMethod("stop").invoke(node);
+ } catch (Throwable e) {
+ handleException(e);
+ }
+ }
+
+ private static void handleException(Throwable ex) {
+ if (ex instanceof InvocationTargetException) {
+ ex = ((InvocationTargetException)ex).getTargetException();
+ }
+ if (ex instanceof RuntimeException) {
+ throw (RuntimeException)ex;
+ }
+ if (ex instanceof Error) {
+ throw (Error)ex;
+ } else {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ }
+
+ /**
+ * Returns a new SCA node factory instance.
+ *
+ * @return a new SCA node factory
+ */
+ public static SCANode2Factory newInstance() {
+ SCANode2Factory scaNodeFactory = null;
+
+ try {
+ final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ // Use reflection APIs to call ServiceDiscovery to avoid hard dependency to tuscany-extensibility
+ try {
+ Class<?> discoveryClass =
+ Class.forName("org.apache.tuscany.sca.extensibility.ServiceDiscovery", true, classLoader);
+ Object instance = discoveryClass.getMethod("getInstance").invoke(null);
+ Class<?> factoryImplClass =
+ (Class<?>)discoveryClass.getMethod("loadFirstServiceClass", Class.class)
+ .invoke(instance, SCANode2Factory.class);
+ if (factoryImplClass != null) {
+ scaNodeFactory = (SCANode2Factory)factoryImplClass.newInstance();
+ return scaNodeFactory;
+ }
+ } catch (ClassNotFoundException e) {
+ // Ignore
+ }
+
+ // Fail back to default impl
+ String className = "org.apache.tuscany.sca.node.impl.Node2FactoryImpl";
+
+ Class<?> cls = Class.forName(className, true, classLoader);
+ scaNodeFactory = (SCANode2Factory)cls.newInstance();
+ return scaNodeFactory;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Create a SCA node based on the discovery of the contribution on the classpath for the
+ * given classloader. This method should be treated a convinient shortcut with the following
+ * assumptions:
+ * <ul>
+ * <li>This is a standalone application and there is a deployable composite file on the classpath.
+ * <li>There is only one contribution which contains the deployable composite file physically in its packaging hierarchy.
+ * </ul>
+ * @param compositeURI The URI of the composite file relative to the root of the enclosing contribution
+ * @param classLoader The ClassLoader used to load the composite file as a resource. If the value is null,
+ * then thread context classloader will be used
+ * @return A newly created SCA node
+ */
+ public abstract SCANode2 createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader);
+
+ /**
+ * Creates a new SCA node from the configuration URL
+ *
+ * @param configurationURL the URL of the node configuration which is the ATOM feed
+ * that contains the URI of the composite and a collection of URLs for the contributions
+ *
+ * @return a new SCA node.
+ */
+ public abstract SCANode2 createSCANodeFromURL(String configurationURL);
+
+ /**
+ * Creates a new SCA node.
+ *
+ * @param compositeURI the URI of the composite to use
+ * @param contributions the URI of the contributions that provides the composites and related
+ * artifacts. If the list is empty, then we will use the thread context classloader to discover
+ * the contribution on the classpath
+ *
+ * @return a new SCA node.
+ */
+ public abstract SCANode2 createSCANode(String compositeURI, SCAContribution... contributions);
+
+ /**
+ * Creates a new SCA node.
+ *
+ * @param compositeURI the URI of the composite to use
+ * @param compositeContent the XML content of the composite to use
+ * @param contributions the URI of the contributions that provides the composites and related artifacts
+ * @return a new SCA node.
+ */
+ public abstract SCANode2 createSCANode(String compositeURI,
+ String compositeContent,
+ SCAContribution... contributions);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java
new file mode 100644
index 0000000000..e41afd29c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.node;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A factory for SCA processing nodes. An SCA processing node can be loaded
+ * with an SCA composite and the SCA contributions required by the composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class SCANodeFactory {
+
+ public static class NodeProxy implements SCANode, SCAClient {
+ private Object node;
+
+ private NodeProxy(Object node) {
+ super();
+ this.node = node;
+ }
+
+ public static <T> T createProxy(Class<T> type, Object node) {
+ try {
+ return type.getDeclaredConstructor(Object.class).newInstance(node);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ try {
+ return (R)node.getClass().getMethod("cast", Object.class).invoke(node, target);
+ } catch (Throwable e) {
+ handleException(e);
+ return null;
+ }
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ try {
+ return (B)node.getClass().getMethod("getService", Class.class, String.class).invoke(node,
+ businessInterface,
+ serviceName);
+ } catch (Throwable e) {
+ handleException(e);
+ return null;
+ }
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String serviceName) {
+ try {
+ return (ServiceReference<B>)node.getClass().getMethod("getServiceReference", Class.class, String.class)
+ .invoke(node, businessInterface, serviceName);
+ } catch (Throwable e) {
+ handleException(e);
+ return null;
+ }
+ }
+
+ public void start() {
+ try {
+ node.getClass().getMethod("start").invoke(node);
+ } catch (Throwable e) {
+ handleException(e);
+ }
+ }
+
+ public void stop() {
+ try {
+ node.getClass().getMethod("stop").invoke(node);
+ } catch (Throwable e) {
+ handleException(e);
+ }
+ }
+
+ private static void handleException(Throwable ex) {
+ if (ex instanceof InvocationTargetException) {
+ ex = ((InvocationTargetException)ex).getTargetException();
+ }
+ if (ex instanceof RuntimeException) {
+ throw (RuntimeException)ex;
+ }
+ if (ex instanceof Error) {
+ throw (Error)ex;
+ } else {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ }
+
+ /**
+ * Returns a new SCA node factory instance.
+ *
+ * @return a new SCA node factory
+ */
+ public static SCANodeFactory newInstance() {
+ SCANodeFactory scaNodeFactory = null;
+
+ try {
+ // final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ // Use reflection APIs to call ServiceDiscovery to avoid hard dependency to tuscany-extensibility
+ try {
+ Class<?> discoveryClass =
+ Class.forName("org.apache.tuscany.sca.extensibility.ServiceDiscovery");
+ Object instance = discoveryClass.getMethod("getInstance").invoke(null);
+ Class<?> factoryImplClass =
+ (Class<?>)discoveryClass.getMethod("loadFirstServiceClass", Class.class)
+ .invoke(instance, SCANodeFactory.class);
+ if (factoryImplClass != null) {
+ scaNodeFactory = (SCANodeFactory)factoryImplClass.newInstance();
+ return scaNodeFactory;
+ }
+ } catch (ClassNotFoundException e) {
+ // Ignore
+ }
+
+ // Fail back to default impl
+ String className = "org.apache.tuscany.sca.node.impl.NodeFactoryImpl";
+
+ Class<?> cls = Class.forName(className);
+ scaNodeFactory = (SCANodeFactory)cls.newInstance();
+ return scaNodeFactory;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Create a SCA node based on the discovery of the contribution on the classpath for the
+ * given classloader. This method should be treated a convinient shortcut with the following
+ * assumptions:
+ * <ul>
+ * <li>This is a standalone application and there is a deployable composite file on the classpath.
+ * <li>There is only one contribution which contains the deployable composite file physically in its packaging hierarchy.
+ * </ul>
+ * @param compositeURI The URI of the composite file relative to the root of the enclosing contribution
+ * @param classLoader The ClassLoader used to load the composite file as a resource. If the value is null,
+ * then thread context classloader will be used
+ * @return A newly created SCA node
+ */
+ public abstract SCANode createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader);
+
+ /**
+ * Creates a new SCA node from the configuration URL
+ *
+ * @param configurationURL the URL of the node configuration which is the ATOM feed
+ * that contains the URI of the composite and a collection of URLs for the contributions
+ *
+ * @return a new SCA node.
+ */
+ public abstract SCANode createSCANodeFromURL(String configurationURL);
+
+ /**
+ * Creates a new SCA node.
+ *
+ * @param compositeURI the URI of the composite to use
+ * @param contributions the URI of the contributions that provides the composites and related
+ * artifacts. If the list is empty, then we will use the thread context classloader to discover
+ * the contribution on the classpath
+ *
+ * @return a new SCA node.
+ */
+ public abstract SCANode createSCANode(String compositeURI, SCAContribution... contributions);
+
+ /**
+ * Creates a new SCA node.
+ *
+ * @param compositeURI the URI of the composite to use
+ * @param compositeContent the XML content of the composite to use
+ * @param contributions the URI of the contributions that provides the composites and related artifacts
+ * @return a new SCA node.
+ */
+ public abstract SCANode createSCANode(String compositeURI,
+ String compositeContent,
+ SCAContribution... contributions);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/LICENSE b/sca-java-1.x/branches/sca-android/modules/node-impl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-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-android/modules/node-impl/META-INF/README b/sca-java-1.x/branches/sca-android/modules/node-impl/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/NOTICE b/sca-java-1.x/branches/sca-android/modules/node-impl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/node-impl/pom.xml b/sca-java-1.x/branches/sca-android/modules/node-impl/pom.xml
new file mode 100644
index 0000000000..f932c9abc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/pom.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node-impl</artifactId>
+ <name>Apache Tuscany SCA Node Implementation</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-endpoint</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.node.impl</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.node.impl*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2FactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2FactoryImpl.java
new file mode 100644
index 0000000000..419900c5ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2FactoryImpl.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.node.impl;
+
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode2;
+import org.apache.tuscany.sca.node.SCANode2Factory;
+
+/**
+ * Default implementation of an SCA node factory.
+ *
+ * @version $Rev$ $Date$
+ * @deprecated
+ */
+@Deprecated
+public class Node2FactoryImpl extends SCANode2Factory {
+ public Node2FactoryImpl() {
+ }
+
+ @Override
+ public SCANode2 createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader) {
+ return new Node2Impl(classLoader, compositeURI);
+ }
+
+ @Override
+ public SCANode2 createSCANodeFromURL(String configurationURI) {
+ return new Node2Impl(configurationURI);
+ }
+
+ @Override
+ public SCANode2 createSCANode(String compositeURI, SCAContribution... contributions) {
+ return new Node2Impl(compositeURI, contributions);
+ }
+
+ @Override
+ public SCANode2 createSCANode(String compositeURI, String compositeContent, SCAContribution... contributions) {
+ return new Node2Impl(compositeURI, compositeContent, contributions);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2Impl.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2Impl.java
new file mode 100644
index 0000000000..bc2f10fb7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2Impl.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.node.impl;
+
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode2;
+
+/**
+ * Node2 Impl
+ */
+public class Node2Impl extends NodeImpl implements SCANode2 {
+
+ /**
+ * @param configurationURI
+ */
+ public Node2Impl(String configurationURI) {
+ super(configurationURI);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param classLoader
+ * @param compositeURI
+ */
+ public Node2Impl(ClassLoader classLoader, String compositeURI) {
+ super(classLoader, compositeURI);
+ }
+
+ /**
+ * @param compositeURI
+ * @param contributions
+ */
+ public Node2Impl(String compositeURI, SCAContribution[] contributions) {
+ super(compositeURI, contributions);
+ }
+
+ /**
+ * @param compositeURI
+ * @param compositeContent
+ * @param contributions
+ */
+ public Node2Impl(String compositeURI, String compositeContent, SCAContribution[] contributions) {
+ super(compositeURI, compositeContent, contributions);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
new file mode 100644
index 0000000000..18b166acdd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.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.node.impl;
+
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * Default implementation of an SCA node factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeFactoryImpl extends SCANodeFactory {
+ public NodeFactoryImpl() {
+ }
+
+ @Override
+ public SCANode createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader) {
+ return new NodeImpl(classLoader, compositeURI);
+ }
+
+ @Override
+ public SCANode createSCANodeFromURL(String configurationURI) {
+ return new NodeImpl(configurationURI);
+ }
+
+ @Override
+ public SCANode createSCANode(String compositeURI, SCAContribution... contributions) {
+ return new NodeImpl(compositeURI, contributions);
+ }
+
+ @Override
+ public SCANode createSCANode(String compositeURI, String compositeContent, SCAContribution... contributions) {
+ return new NodeImpl(compositeURI, compositeContent, contributions);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
new file mode 100644
index 0000000000..a8a076a602
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -0,0 +1,824 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.tuscany.sca.node.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+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.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+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.xml.CompositeDocumentProcessor;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A local representation of the SCADomain running on a single node
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImpl implements SCANode, SCAClient {
+
+ private static final Logger logger = Logger.getLogger(NodeImpl.class.getName());
+
+ // The node configuration name, used for logging
+ private String configurationName;
+
+ // The Tuscany runtime that does the hard work
+ private RuntimeBootStrapper runtime;
+ private CompositeActivator compositeActivator;
+ private XMLInputFactory inputFactory;
+ private ModelFactoryExtensionPoint modelFactories;
+ private StAXArtifactProcessorExtensionPoint artifactProcessors;
+ private URLArtifactProcessorExtensionPoint documentProcessors;
+ private Monitor monitor;
+
+ private List<Contribution> contributions;
+ // The composite loaded into this node
+ private Composite composite;
+
+ /**
+ * Constructs a new SCA node.
+ *
+ * @param configurationURI the URI of the node configuration information.
+ */
+ NodeImpl(String configurationURI) {
+ configurationName = configurationURI;
+ logger.log(Level.INFO, "Creating node: " + configurationName);
+
+ try {
+ // Initialize the runtime
+ initRuntime();
+
+ // Read the node configuration feed
+ StAXArtifactProcessor<ConfiguredNodeImplementation> configurationProcessor =
+ artifactProcessors.getProcessor(ConfiguredNodeImplementation.class);
+ URL configurationURL = new URL(configurationURI);
+ InputStream is = configurationURL.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ reader.nextTag();
+ ConfiguredNodeImplementation configuration = configurationProcessor.read(reader);
+ is.close();
+
+ // Resolve contribution URLs
+ for (Contribution contribution : configuration.getContributions()) {
+ URL contributionURL = new URL(configurationURL, contribution.getLocation());
+ contribution.setLocation(contributionURL.toString());
+ }
+
+ // Resolve composite URL
+ URL compositeURL = new URL(configurationURL, configuration.getComposite().getURI());
+ configuration.getComposite().setURI(compositeURL.toString());
+
+ // Configure the node
+ configureNode(configuration);
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Construct a node by discovering the node configuration (composite+contrbutions) on the classpath
+ * @param classLoader
+ * @param compositeURI
+ */
+ NodeImpl(ClassLoader classLoader, String compositeURI) {
+ configurationName = compositeURI;
+ logger.log(Level.INFO, "Creating node: " + configurationName);
+
+ if (compositeURI != null) {
+ URI uri = URI.create(compositeURI);
+ if (uri.isAbsolute()) {
+ throw new IllegalArgumentException("Composite URI must be a resource name: " + compositeURI);
+ }
+ }
+ try {
+ // Initialize the runtime
+ initRuntime();
+
+ ConfiguredNodeImplementation config = findNodeConfiguration(compositeURI, classLoader);
+ configureNode(config);
+ } catch (Throwable e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Discover the contribution on the classpath
+ * @param compositeURI
+ * @param classLoader
+ * @return A configured node implementation
+ * @throws Exception
+ */
+ private ConfiguredNodeImplementation findNodeConfiguration(final String compositeURI, ClassLoader classLoader)
+ throws Exception {
+ NodeImplementationFactory nodeImplementationFactory =
+ modelFactories.getFactory(NodeImplementationFactory.class);
+ ConfiguredNodeImplementation config = nodeImplementationFactory.createConfiguredNodeImplementation();
+
+ // Default to thread context classloader
+ if (classLoader == null) {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ }
+ String contributionArtifactPath = compositeURI;
+ URL contributionArtifactURL = null;
+ if (compositeURI != null) {
+ contributionArtifactURL = getResource(classLoader, compositeURI);
+ if (contributionArtifactURL == null) {
+ throw new IllegalArgumentException("Composite not found: " + contributionArtifactPath);
+ }
+ // Set to relative URI to avoid duplicate loading
+ Composite composite = createComposite(compositeURI);
+ config.setComposite(composite);
+ } else {
+ // No composite is specified, tring to search the SCA metadata files
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_META;
+ contributionArtifactURL = getResource(classLoader, Contribution.SCA_CONTRIBUTION_META);
+
+ if (contributionArtifactURL == null) {
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_GENERATED_META;
+ contributionArtifactURL = getResource(classLoader, Contribution.SCA_CONTRIBUTION_GENERATED_META);
+ }
+ if (contributionArtifactURL == null) {
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
+ contributionArtifactURL = getResource(classLoader, Contribution.SCA_CONTRIBUTION_DEPLOYABLES);
+ }
+
+ // No contribution can be discovered
+ if (contributionArtifactURL == null) {
+ throw new IllegalArgumentException("No default contribution can be discovered on the classpath");
+ }
+
+ // No composite will be created, all deployable composites will be used later
+ }
+
+ Contribution c = getContribution(contributionArtifactURL, contributionArtifactPath);
+ config.getContributions().add(c);
+
+ return config;
+ }
+
+ private Contribution getContribution(URL contributionArtifactURL, String contributionArtifactPath) {
+ URL contributionURL = getContributionURL(contributionArtifactURL, contributionArtifactPath);
+
+ ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+
+ SCAContribution contribution = new SCAContribution(contributionURL.toString(), contributionURL.toString());
+ Contribution c = createContribution(contributionFactory, contribution);
+ return c;
+ }
+
+ public static URL getContributionURL(URL contributionArtifactURL, String contributionArtifactPath) {
+ 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)) {
+ final String location = url.substring(0, url.lastIndexOf(contributionArtifactPath));
+ // workaround from evil URL/URI form Maven
+ // contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ // Allow privileged access to open URL stream. Add FilePermission to added to
+ // security policy file.
+ try {
+ contributionURL = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
+ public URL run() throws IOException {
+ return FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (MalformedURLException)e.getException();
+ }
+ }
+
+ } 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();
+
+ } else if ("wsjar".equals(protocol)) {
+ // See https://issues.apache.org/jira/browse/TUSCANY-2219
+ // wsjar contribution
+ String location = url.substring(6, url.lastIndexOf("!/"));
+ // workaround for evil url/uri from maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+
+ } else if ("zip".equals(protocol)) {
+ // See https://issues.apache.org/jira/browse/TUSCANY-2598
+ // zip contribution, remove the zip prefix and pad with file:
+ String location = "file:"+url.substring(4, url.lastIndexOf("!/"));
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+
+ } else if (protocol != null && (protocol.equals("bundle") || protocol.equals("bundleresource"))) {
+ contributionURL =
+ new URL(contributionArtifactURL.getProtocol(), contributionArtifactURL.getHost(),
+ contributionArtifactURL.getPort(), "/");
+ }
+ } catch (MalformedURLException mfe) {
+ throw new IllegalArgumentException(mfe);
+ }
+ return contributionURL;
+ }
+
+ private static URL getResource(final ClassLoader classLoader, final String compositeURI) {
+ return AccessController.doPrivileged(new PrivilegedAction<URL>() {
+ public URL run() {
+ return classLoader.getResource(compositeURI);
+ }
+ });
+ }
+
+ /**
+ * Constructs a new SCA node.
+ *
+ * @param compositeURI
+ * @param contributions
+ */
+ NodeImpl(String compositeURI, SCAContribution[] contributions) {
+ configurationName = compositeURI;
+ logger.log(Level.INFO, "Creating node: " + configurationName);
+
+ try {
+ // Initialize the runtime
+ initRuntime();
+
+ URI uri = compositeURI == null ? null : URI.create(compositeURI);
+ ConfiguredNodeImplementation configuration = null;
+ if (contributions == null || contributions.length == 0) {
+ if (uri != null && uri.getScheme() != null) {
+ throw new IllegalArgumentException("No SCA contributions are provided");
+ }
+ configuration = findNodeConfiguration(compositeURI, null);
+ } else {
+
+ // Create a node configuration
+ NodeImplementationFactory nodeImplementationFactory =
+ modelFactories.getFactory(NodeImplementationFactory.class);
+ configuration = nodeImplementationFactory.createConfiguredNodeImplementation();
+
+ Composite composite = compositeURI == null ? null : createComposite(compositeURI);
+ configuration.setComposite(composite);
+
+
+ // Create contribution models
+ ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ for (SCAContribution c : contributions) {
+ Contribution contribution = createContribution(contributionFactory, c);
+ configuration.getContributions().add(contribution);
+ }
+ }
+
+ // Configure the node
+ configureNode(configuration);
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ private Composite createComposite(String compositeURI) {
+ // Create composite model
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ Composite composite = assemblyFactory.createComposite();
+ composite.setURI(compositeURI);
+ composite.setUnresolved(true);
+ return composite;
+ }
+
+ /**
+ * Constructs a new SCA node.
+ *
+ * @param compositeURI
+ * @param compositeContent
+ * @param contributions
+ */
+ NodeImpl(String compositeURI, String compositeContent, SCAContribution[] contributions) {
+ configurationName = compositeURI;
+ logger.log(Level.INFO, "Creating node: " + configurationName);
+
+ try {
+ // Initialize the runtime
+ initRuntime();
+
+ ConfiguredNodeImplementation configuration = null;
+ if (contributions == null || contributions.length == 0) {
+ configuration = findNodeConfiguration(compositeURI, null);
+ } else {
+ // Create a node configuration
+ NodeImplementationFactory nodeImplementationFactory =
+ modelFactories.getFactory(NodeImplementationFactory.class);
+ configuration = nodeImplementationFactory.createConfiguredNodeImplementation();
+
+ // Read the composite model
+ StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class);
+ // URL compositeURL = new URL(compositeURI);
+ logger.log(Level.INFO, "Loading composite: " + compositeURI);
+
+ CompositeDocumentProcessor compositeDocProcessor =
+ (CompositeDocumentProcessor)documentProcessors.getProcessor(Composite.class);
+ composite =
+ compositeDocProcessor.read(URI.create(compositeURI), new ByteArrayInputStream(compositeContent
+ .getBytes("UTF-8")));
+
+ analyzeProblems();
+
+ configuration.setComposite(composite);
+
+ // Create contribution models
+ ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ for (SCAContribution c : contributions) {
+ Contribution contribution = createContribution(contributionFactory, c);
+ configuration.getContributions().add(contribution);
+ }
+ }
+
+ // Configure the node
+ configureNode(configuration);
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ private static Contribution createContribution(ContributionFactory contributionFactory, SCAContribution c) {
+ Contribution contribution = contributionFactory.createContribution();
+ contribution.setURI(c.getURI());
+ contribution.setLocation(c.getLocation());
+ contribution.setUnresolved(true);
+ return contribution;
+ }
+
+ /**
+ * Initialize the Tuscany runtime.
+ *
+ * @throws Exception
+ */
+ private void initRuntime() throws Exception {
+
+ // Create a node runtime
+ runtime = new RuntimeBootStrapper(Thread.currentThread().getContextClassLoader());
+ runtime.start();
+
+ // Get the various factories we need
+ ExtensionPointRegistry registry = runtime.getExtensionPointRegistry();
+ modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+
+ // Create the required artifact processors
+ artifactProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+
+ // Save the composite activator
+ compositeActivator = runtime.getCompositeActivator();
+
+ // save the monitor
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ monitor = monitorFactory.createMonitor();
+ }
+
+ /**
+ * Escape the space in URL string
+ * @param uri
+ * @return
+ */
+ private static URI createURI(String uri) {
+ if (uri.indexOf(' ') != -1) {
+ uri = uri.replace(" ", "%20");
+ }
+ return URI.create(uri);
+ }
+
+ private void configureNode(ConfiguredNodeImplementation configuration) throws Exception {
+
+ // Find if any contribution JARs already available locally on the classpath
+ Map<String, URL> localContributions = localContributions();
+
+ // Load the specified contributions
+ ContributionService contributionService = runtime.getContributionService();
+ contributions = new ArrayList<Contribution>();
+ for (Contribution contribution : configuration.getContributions()) {
+ URI uri = createURI(contribution.getLocation());
+ if (uri.getScheme() == null) {
+ uri = new File(contribution.getLocation()).toURI();
+ }
+ URL contributionURL = uri.toURL();
+
+ // Extract contribution file name
+ String file = contributionURL.getPath();
+ int i = file.lastIndexOf('/');
+ if (i != -1 && i < file.length() - 1) {
+ file = file.substring(i + 1);
+
+ // If we find the local contribution file on the classpath, use it in
+ // place of the original contribution URL
+ URL localContributionURL = localContributions.get(file);
+ if (localContributionURL != null) {
+ contributionURL = localContributionURL;
+ }
+ }
+
+ // Load the contribution
+ logger.log(Level.INFO, "Loading contribution: " + contributionURL);
+ contributions.add(contributionService.contribute(contribution.getURI(), contributionURL, false));
+ analyzeProblems();
+ }
+
+ composite = configuration.getComposite();
+
+ // FIXME: This is a hack to get a list of deployable composites. By design, the deployment composite should
+ // has been configured
+ if (composite == null) {
+ List<Composite> deployables = new ArrayList<Composite>();
+ for (Contribution c : contributions) {
+ deployables.addAll(c.getDeployables());
+ }
+ aggregate(deployables);
+ configuration.setComposite(composite);
+ }
+
+ Contribution contribution = null;
+ if (composite.getName() == null) {
+ // Load the specified composite
+ URL compositeURL;
+
+ URI uri = createURI(configuration.getComposite().getURI());
+ if (uri.getScheme() == null) {
+
+ // If the composite URI is a relative URI, try to resolve it within the contributions
+ contribution = contribution(contributions, uri.toString());
+ if (contribution == null) {
+ throw new IllegalArgumentException("Composite is not found in contributions: " + uri);
+ }
+ compositeURL = new URL(location(contribution, uri.toString()));
+
+ } else {
+
+ // If the composite URI is an absolute URI, use it as is
+ compositeURL = uri.toURL();
+ }
+
+ URLArtifactProcessor<Composite> compositeDocProcessor = documentProcessors.getProcessor(Composite.class);
+ // Read the composite
+ logger.log(Level.INFO, "Loading composite: " + compositeURL);
+ // InputStream is = compositeURL.openStream();
+ // XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ composite = compositeDocProcessor.read(null, uri, compositeURL);
+ // reader.close();
+
+ analyzeProblems();
+
+ }
+ // And resolve the composite within the scope of the last contribution
+ if (contribution == null && contributions.size() != 0) {
+ contribution = contributions.get(contributions.size() - 1);
+ }
+
+ // Resolve the given composite within the scope of the selected contribution
+ if (contribution != null) {
+ StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class);
+ compositeProcessor.resolve(composite, contribution.getModelResolver());
+ analyzeProblems();
+ }
+ // Create a top level composite to host our composite
+ // This is temporary to make the activator happy
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ Composite tempComposite = assemblyFactory.createComposite();
+ tempComposite.setName(new QName("http://tempuri.org", "temp"));
+ tempComposite.setURI("http://tempuri.org");
+
+ // Include the node composite in the top-level composite
+ tempComposite.getIncludes().add(composite);
+
+ // set the top level composite on the composite activator as
+ // logic in callable reference resolution relies on this being
+ // available
+ compositeActivator.setDomainComposite(tempComposite);
+
+ // Build the composite
+ runtime.buildComposite(composite);
+
+ analyzeProblems();
+ }
+
+ /**
+ * Create a deployment composite that includes a list of deployable composites
+ * @param composites
+ */
+ private void aggregate(List<Composite> composites) {
+ if (composites.size() == 0) {
+ throw new IllegalArgumentException("No deployable composite is declared");
+ } else if (composites.size() == 1) {
+ composite = composites.get(0);
+ } else {
+ // Include all composites
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ Composite aggregated = assemblyFactory.createComposite();
+ aggregated.setName(new QName("http://tempuri.org", "aggregated"));
+ aggregated.setURI("http://tempuri.org/aggregated");
+ aggregated.getIncludes().addAll(composites);
+ composite = aggregated;
+ }
+ }
+
+ /**
+ * Returns the artifact representing the given composite.
+ *
+ * @param contribution
+ * @param compositeURI
+ * @return
+ */
+ private String location(Contribution contribution, String uri) {
+ if (uri != null && uri.startsWith("/")) {
+ uri = uri.substring(1);
+ }
+ ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ Artifact compositeFile = contributionFactory.createArtifact();
+ compositeFile.setUnresolved(true);
+ compositeFile.setURI(uri);
+ ModelResolver resolver = contribution.getModelResolver();
+ Artifact resolved = resolver.resolveModel(Artifact.class, compositeFile);
+ if (resolved != null && !resolved.isUnresolved()) {
+ return resolved.getLocation();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the contribution containing the given composite.
+ *
+ * @param contributions
+ * @param compositeURI
+ * @return
+ */
+ private Contribution contribution(List<Contribution> contributions, String compositeURI) {
+ if (compositeURI != null && compositeURI.startsWith("/")) {
+ compositeURI = compositeURI.substring(1);
+ }
+ ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ Artifact compositeFile = contributionFactory.createArtifact();
+ compositeFile.setUnresolved(true);
+ compositeFile.setURI(compositeURI);
+ for (Contribution c : contributions) {
+ ModelResolver resolver = c.getModelResolver();
+ Artifact resolved = resolver.resolveModel(Artifact.class, compositeFile);
+ if (resolved != null && !resolved.isUnresolved()) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ private void analyzeProblems() throws Exception {
+
+ for (Problem problem : monitor.getProblems()) {
+ if ((problem.getSeverity() == Severity.ERROR) && (!problem.getMessageId().equals("SchemaError"))) {
+ if (problem.getCause() != null) {
+ throw problem.getCause();
+ } else {
+ throw new ServiceRuntimeException(problem.toString());
+ }
+ }
+ }
+ }
+
+ public void start() {
+ logger.log(Level.INFO, "Starting node: " + configurationName);
+
+ try {
+
+ // Activate the composite
+ compositeActivator.activate(composite);
+
+ // Start the composite
+ compositeActivator.start(composite);
+
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public void stop() {
+ logger.log(Level.INFO, "Stopping node: " + configurationName);
+
+ try {
+
+ // Stop the composite
+ compositeActivator.stop(composite);
+
+ // Deactivate the composite
+ compositeActivator.deactivate(composite);
+
+ runtime.stop();
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)runtime.getProxyFactory().cast(target);
+ }
+
+ 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();
+ }
+
+ 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
+ Component component = null;
+
+ for (Component compositeComponent : composite.getComponents()) {
+ if (compositeComponent.getName().equals(componentName)) {
+ component = compositeComponent;
+ }
+ }
+
+ if (component == null) {
+ throw new ServiceRuntimeException("The service " + name + " has not been contributed to the domain");
+ }
+ RuntimeComponentContext 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) {
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ if (serviceName != null) {
+ serviceName = "$promoted$" + component.getName() + "$slash$" + serviceName;
+ }
+ componentContext =
+ ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
+ return componentContext.createSelfReference(businessInterface, compositeService
+ .getPromotedService());
+ }
+ break;
+ }
+ }
+ // No matching service found
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ } else {
+ componentContext = ((RuntimeComponent)component).getComponentContext();
+ if (serviceName != null) {
+ return componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ return componentContext.createSelfReference(businessInterface);
+ }
+ }
+ }
+
+ /**
+ * Returns the extension point registry used by this node.
+ *
+ * @return
+ */
+ public ExtensionPointRegistry getExtensionPointRegistry() {
+ return runtime.getExtensionPointRegistry();
+ }
+
+ /**
+ * Returns the composite being run by this node.
+ *
+ * @return
+ */
+ public Composite getComposite() {
+ return composite;
+ }
+
+ /**
+ * Returns contribution JARs available on the classpath.
+ *
+ * @return
+ */
+ private static Map<String, URL> localContributions() {
+ Map<String, URL> localContributions = new HashMap<String, URL>();
+ collectJARs(localContributions, Thread.currentThread().getContextClassLoader());
+ return localContributions;
+ }
+
+ /**
+ * Collect JARs on the classpath of a URLClassLoader
+ * @param urls
+ * @param cl
+ */
+ private static void collectJARs(Map<String, URL> urls, ClassLoader cl) {
+ if (cl == null) {
+ return;
+ }
+
+ // Collect JARs from the URLClassLoader's classpath
+ if (cl instanceof URLClassLoader) {
+ URL[] jarURLs = ((URLClassLoader)cl).getURLs();
+ if (jarURLs != null) {
+ for (URL jarURL : jarURLs) {
+ String file = jarURL.getPath();
+ int i = file.lastIndexOf('/');
+ if (i != -1 && i < file.length() - 1) {
+ file = file.substring(i + 1);
+ urls.put(file, jarURL);
+ }
+ }
+ }
+ }
+
+ // Collect JARs from the parent ClassLoader
+ collectJARs(urls, cl.getParent());
+ }
+
+ public CompositeActivator getCompositeActivator() {
+ return compositeActivator;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java
new file mode 100644
index 0000000000..5b0e31fd03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.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.node.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
+import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
+import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
+import org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeBootStrapper {
+ private static final Logger logger = Logger.getLogger(RuntimeBootStrapper.class.getName());
+ private List<ModuleActivator> modules;
+ private ExtensionPointRegistry registry;
+
+ private ClassLoader classLoader;
+ private AssemblyFactory assemblyFactory;
+ private ContributionService contributionService;
+ private CompositeActivator compositeActivator;
+ private CompositeBuilder compositeBuilder;
+ // private DomainBuilder domainBuilder;
+ private WorkScheduler workScheduler;
+ private ScopeRegistry scopeRegistry;
+ private ProxyFactory proxyFactory;
+ private List<SCADefinitions> policyDefinitions;
+ private ModelResolver policyDefinitionsResolver;
+ private Monitor monitor;
+
+ public RuntimeBootStrapper(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ public void start() throws ActivationException {
+ long start = System.currentTimeMillis();
+
+ // Create our extension point registry
+ registry = new DefaultExtensionPointRegistry();
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+
+ // Get work scheduler
+ workScheduler = utilities.getUtility(WorkScheduler.class);
+
+ // Create an interface contract mapper
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+
+ // Get factory extension point
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ // Get Message factory
+ MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
+
+ // Get proxy factory
+ ProxyFactoryExtensionPoint proxyFactories = registry.getExtensionPoint(ProxyFactoryExtensionPoint.class);
+ proxyFactory = new ExtensibleProxyFactory(proxyFactories);
+
+ // Create model factories
+ assemblyFactory = new RuntimeAssemblyFactory();
+ factories.addFactory(assemblyFactory);
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+
+ // Load the runtime modules
+ modules = loadModules(registry);
+
+ // Start the runtime modules
+ startModules(registry, modules);
+
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory = new DefaultIntentAttachPointTypeFactory();
+ factories.addFactory(intentAttachPointTypeFactory);
+ ContributionFactory contributionFactory = factories.getFactory(ContributionFactory.class);
+
+ // Create a monitor
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+
+ if (monitorFactory != null) {
+ monitor = monitorFactory.createMonitor();
+ } else {
+ monitorFactory = new DefaultMonitorFactoryImpl();
+ monitor = monitorFactory.createMonitor();
+ utilities.addUtility(monitorFactory);
+ //logger.fine("No MonitorFactory is found on the classpath.");
+ }
+
+ // Create a contribution service
+ policyDefinitions = new ArrayList<SCADefinitions>();
+ policyDefinitionsResolver = new DefaultModelResolver();
+ contributionService =
+ RuntimeBuilder.createContributionService(classLoader,
+ registry,
+ contributionFactory,
+ assemblyFactory,
+ policyFactory,
+ mapper,
+ policyDefinitions,
+ policyDefinitionsResolver,
+ monitor);
+
+ // Create the ScopeRegistry
+ scopeRegistry = RuntimeBuilder.createScopeRegistry(registry);
+
+ // Create a composite activator
+ compositeActivator =
+ RuntimeBuilder.createCompositeActivator(registry,
+ assemblyFactory,
+ messageFactory,
+ scaBindingFactory,
+ mapper,
+ proxyFactory,
+ scopeRegistry,
+ workScheduler);
+
+ // Load the definitions.xml
+ loadSCADefinitions();
+
+ if (logger.isLoggable(Level.FINE)) {
+ long end = System.currentTimeMillis();
+ logger.fine("The tuscany runtime is started in " + (end - start) + " ms.");
+ }
+ }
+
+ public void stop() throws ActivationException {
+ long start = System.currentTimeMillis();
+
+ // Stop the runtime modules
+ stopModules(registry, modules);
+
+ // Stop and destroy the work manager
+ workScheduler.destroy();
+
+ // Cleanup
+ modules = null;
+ registry = null;
+ assemblyFactory = null;
+ contributionService = null;
+ compositeActivator = null;
+ workScheduler = null;
+ scopeRegistry = null;
+
+ if (logger.isLoggable(Level.FINE)) {
+ long end = System.currentTimeMillis();
+ logger.fine("The tuscany runtime is stopped in " + (end - start) + " ms.");
+ }
+ }
+
+ public void buildComposite(Composite composite) throws CompositeBuilderException {
+ //Get factory extension point
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory =
+ factories.getFactory(IntentAttachPointTypeFactory.class);
+ EndpointFactory endpointFactory = factories.getFactory(EndpointFactory.class);
+ DocumentBuilderFactory documentBuilderFactory = factories.getFactory(DocumentBuilderFactory.class);
+ TransformerFactory transformerFactory = factories.getFactory(TransformerFactory.class);
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
+
+ //Create a composite builder
+ SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
+ for (SCADefinitions definition : ((List<SCADefinitions>)policyDefinitions)) {
+ SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
+ }
+ compositeBuilder =
+ RuntimeBuilder.createCompositeBuilder(monitor,
+ assemblyFactory,
+ scaBindingFactory,
+ endpointFactory,
+ intentAttachPointTypeFactory,
+ documentBuilderFactory,
+ transformerFactory,
+ mapper,
+ aggregatedDefinitions);
+ compositeBuilder.build(composite);
+
+ }
+
+ public ContributionService getContributionService() {
+ return contributionService;
+ }
+
+ public CompositeActivator getCompositeActivator() {
+ return compositeActivator;
+ }
+
+ public CompositeBuilder getCompositeBuilder() {
+ return compositeBuilder;
+ }
+
+ public AssemblyFactory getAssemblyFactory() {
+ return assemblyFactory;
+ }
+
+ private void loadSCADefinitions() throws ActivationException {
+ try {
+ URLArtifactProcessorExtensionPoint documentProcessors =
+ registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ URLArtifactProcessor<SCADefinitions> definitionsProcessor =
+ documentProcessors.getProcessor(SCADefinitions.class);
+ SCADefinitionsProviderExtensionPoint scaDefnProviders =
+ registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);
+
+ SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
+ SCADefinitions aSCADefn = null;
+ for (SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders()) {
+ aSCADefn = aProvider.getSCADefinition();
+ SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
+ }
+
+ policyDefinitions.add(systemSCADefinitions);
+
+ //we cannot expect that providers will add the intents and policysets into the resolver
+ //so we do this here explicitly
+ for (Intent intent : systemSCADefinitions.getPolicyIntents()) {
+ policyDefinitionsResolver.addModel(intent);
+ }
+
+ for (PolicySet policySet : systemSCADefinitions.getPolicySets()) {
+ policyDefinitionsResolver.addModel(policySet);
+ }
+
+ for (IntentAttachPointType attachPoinType : systemSCADefinitions.getBindingTypes()) {
+ policyDefinitionsResolver.addModel(attachPoinType);
+ }
+
+ for (IntentAttachPointType attachPoinType : systemSCADefinitions.getImplementationTypes()) {
+ policyDefinitionsResolver.addModel(attachPoinType);
+ }
+
+ //now that all system sca definitions have been read, lets resolve them right away
+ definitionsProcessor.resolve(systemSCADefinitions, policyDefinitionsResolver);
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ }
+
+ private List<ModuleActivator> loadModules(ExtensionPointRegistry registry) throws ActivationException {
+
+ // Load and instantiate the modules found on the classpath (or any registered ClassLoaders)
+ modules = new ArrayList<ModuleActivator>();
+ try {
+ Set<ServiceDeclaration> moduleActivators =
+ ServiceDiscovery.getInstance().getServiceDeclarations(ModuleActivator.class);
+ Set<String> moduleClasses = new HashSet<String>();
+ for (ServiceDeclaration moduleDeclarator : moduleActivators) {
+ if (moduleClasses.contains(moduleDeclarator.getClassName())) {
+ continue;
+ }
+ moduleClasses.add(moduleDeclarator.getClassName());
+ Class<?> moduleClass = moduleDeclarator.loadClass();
+ ModuleActivator module = (ModuleActivator)moduleClass.newInstance();
+ modules.add(module);
+ }
+ } catch (IOException e) {
+ throw new ActivationException(e);
+ } catch (ClassNotFoundException e) {
+ throw new ActivationException(e);
+ } catch (InstantiationException e) {
+ throw new ActivationException(e);
+ } catch (IllegalAccessException e) {
+ throw new ActivationException(e);
+ }
+
+ return modules;
+ }
+
+ private void startModules(ExtensionPointRegistry registry, List<ModuleActivator> modules)
+ throws ActivationException {
+ boolean debug = logger.isLoggable(Level.FINE);
+ // Start all the extension modules
+ for (ModuleActivator module : modules) {
+ long start = 0L;
+ if (debug) {
+ logger.fine(module.getClass().getName() + " is starting.");
+ start = System.currentTimeMillis();
+ }
+ try {
+ module.start(registry);
+ if (debug) {
+ long end = System.currentTimeMillis();
+ logger.fine(module.getClass().getName() + " is started in " + (end - start) + " ms.");
+ }
+ } catch (Throwable e) {
+ logger.log(Level.WARNING, "Exception starting module " + module.getClass().getName()
+ + " :"
+ + e.getMessage());
+ logger.log(Level.FINE, "Exception starting module " + module.getClass().getName(), e);
+ }
+ }
+ }
+
+ private void stopModules(final ExtensionPointRegistry registry, List<ModuleActivator> modules) {
+ boolean debug = logger.isLoggable(Level.FINE);
+ for (ModuleActivator module : modules) {
+ long start = 0L;
+ if (debug) {
+ logger.fine(module.getClass().getName() + " is stopping.");
+ start = System.currentTimeMillis();
+ }
+ module.stop(registry);
+ if (debug) {
+ long end = System.currentTimeMillis();
+ logger.fine(module.getClass().getName() + " is stopped in " + (end - start) + " ms.");
+ }
+ }
+ }
+
+ /**
+ * @return the proxyFactory
+ */
+ public ProxyFactory getProxyFactory() {
+ return proxyFactory;
+ }
+
+ /**
+ * @return the registry
+ */
+ public ExtensionPointRegistry getExtensionPointRegistry() {
+ return registry;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBuilder.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBuilder.java
new file mode 100644
index 0000000000..6c93fa7800
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBuilder.java
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.node.impl;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
+import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultValidationSchemaExtensionPoint;
+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.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+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.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.CompositeScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ConversationalScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.RequestScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.core.scope.ScopeRegistryImpl;
+import org.apache.tuscany.sca.core.scope.StatelessScopeContainerFactory;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeBuilder {
+
+ // private static final Logger logger = Logger.getLogger(RuntimeBuilder.class.getName());
+
+ public static CompositeActivator createCompositeActivator(ExtensionPointRegistry registry,
+ AssemblyFactory assemblyFactory,
+ MessageFactory messageFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper mapper,
+ ProxyFactory proxyFactory,
+ ScopeRegistry scopeRegistry,
+ WorkScheduler workScheduler) {
+
+ // Create a wire post processor extension point
+ RuntimeWireProcessorExtensionPoint wireProcessors =
+ registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+ RuntimeWireProcessor wireProcessor = new ExtensibleWireProcessor(wireProcessors);
+
+ // Retrieve the processors extension point
+ StAXArtifactProcessorExtensionPoint processors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ // Create a provider factory extension point
+ ProviderFactoryExtensionPoint providerFactories =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+
+ // Create a endpoint resolver factory extension point
+ EndpointResolverFactoryExtensionPoint endpointResolverFactories =
+ registry.getExtensionPoint(EndpointResolverFactoryExtensionPoint.class);
+
+ JavaInterfaceFactory javaInterfaceFactory =
+ registry.getExtensionPoint(ModelFactoryExtensionPoint.class).getFactory(JavaInterfaceFactory.class);
+ RequestContextFactory requestContextFactory =
+ registry.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class);
+
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ ConversationManager conversationManager = utilities.getUtility(ConversationManager.class);
+
+ // Create the composite activator
+ CompositeActivator compositeActivator =
+ new CompositeActivatorImpl(assemblyFactory, messageFactory, javaInterfaceFactory, scaBindingFactory,
+ mapper, scopeRegistry, workScheduler, wireProcessor, requestContextFactory,
+ proxyFactory, providerFactories, endpointResolverFactories, processors,
+ conversationManager);
+
+ return compositeActivator;
+ }
+
+ public static CompositeBuilder createCompositeBuilder(Monitor monitor,
+ AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ EndpointFactory endpointFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions) {
+
+ return new CompositeBuilderImpl(assemblyFactory, endpointFactory, scaBindingFactory,
+ intentAttachPointTypeFactory, documentBuilderFactory, transformerFactory,
+ interfaceContractMapper, policyDefinitions,
+ monitor);
+ }
+
+ /**
+ * Create the contribution service used by this domain.
+ *
+ * @throws ActivationException
+ */
+ public static ContributionService createContributionService(ClassLoader classLoader,
+ ExtensionPointRegistry registry,
+ ContributionFactory contributionFactory,
+ AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ InterfaceContractMapper mapper,
+ List<SCADefinitions> policyDefinitions,
+ ModelResolver policyDefinitionResolver,
+ Monitor monitor) throws ActivationException {
+
+ // Get the model factory extension point
+ ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ // Create a new XML input factory
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+
+ // Create a validation XML schema extension point
+ ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
+
+ // Create a validating XML input factory
+ XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, monitor);
+ modelFactories.addFactory(validatingInputFactory);
+
+ // Create StAX artifact processor extension point
+ StAXArtifactProcessorExtensionPoint staxProcessors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ // Create and register StAX processors for SCA assembly XML
+ // Allow privileged access to factory. Requires RuntimePermission in security policy file.
+ XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ ExtensibleStAXArtifactProcessor staxProcessor =
+ new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
+
+ // Create URL artifact processor extension point
+ URLArtifactProcessorExtensionPoint documentProcessors =
+ registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+
+ // Create and register document processors for SCA assembly XML
+ DocumentBuilderFactory documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
+ documentBuilderFactory.setNamespaceAware(true);
+ documentProcessors.getProcessor(Composite.class);
+ documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory,
+ documentBuilderFactory, policyDefinitions, monitor));
+
+ // Create Model Resolver extension point
+ ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
+
+ // Create contribution package processor extension point
+ TypeDescriber describer = new PackageTypeDescriberImpl();
+ PackageProcessor packageProcessor =
+ new ExtensiblePackageProcessor(registry.getExtensionPoint(PackageProcessorExtensionPoint.class), describer,
+ monitor);
+
+ // Create contribution listener
+ ExtensibleContributionListener contributionListener =
+ new ExtensibleContributionListener(registry.getExtensionPoint(ContributionListenerExtensionPoint.class));
+
+ // Create a contribution repository
+ ContributionRepository repository;
+ try {
+ repository = new ContributionRepositoryImpl("target", inputFactory, monitor);
+ } catch (IOException e) {
+ throw new ActivationException(e);
+ }
+
+ ExtensibleURLArtifactProcessor documentProcessor =
+ new ExtensibleURLArtifactProcessor(documentProcessors, monitor);
+
+ // Create the contribution service
+ ContributionService contributionService =
+ new ContributionServiceImpl(repository, packageProcessor, documentProcessor, staxProcessor,
+ contributionListener, policyDefinitionResolver, modelResolvers, modelFactories,
+ assemblyFactory, contributionFactory, inputFactory, policyDefinitions, monitor);
+ return contributionService;
+ }
+
+ public static ScopeRegistry createScopeRegistry(ExtensionPointRegistry registry) {
+ ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
+ ScopeContainerFactory[] factories =
+ new ScopeContainerFactory[] {new CompositeScopeContainerFactory(), new StatelessScopeContainerFactory(),
+ new RequestScopeContainerFactory(),
+ new ConversationalScopeContainerFactory(null),
+ // new HttpSessionScopeContainer(monitor)
+ };
+ for (ScopeContainerFactory f : factories) {
+ scopeRegistry.register(f);
+ }
+
+ //FIXME Pass the scope container differently as it's not an extension point
+ registry.addExtensionPoint(scopeRegistry);
+
+ return scopeRegistry;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory
new file mode 100644
index 0000000000..4215855ac9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+org.apache.tuscany.sca.node.impl.Node2FactoryImpl \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory
new file mode 100644
index 0000000000..800bdd84cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+org.apache.tuscany.sca.node.impl.NodeFactoryImpl \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/hello/HelloWorld.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/hello/HelloWorld.java
new file mode 100644
index 0000000000..2f519cb81d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/hello/HelloWorld.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 hello;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * HelloWorld interface
+ */
+@Remotable
+public interface HelloWorld {
+ String hello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/hello/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/hello/HelloWorldImpl.java
new file mode 100644
index 0000000000..c9a7560b12
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/hello/HelloWorldImpl.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 hello;
+
+/**
+ * HelloWorldImpl
+ */
+public class HelloWorldImpl implements HelloWorld {
+ public String hello(String name) {
+ System.out.println("Hello: " + name);
+ return "Hello, " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/Node2ImplTestCase.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/Node2ImplTestCase.java
new file mode 100644
index 0000000000..52d96dd72d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/Node2ImplTestCase.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.node.impl;
+
+import hello.HelloWorld;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode2;
+import org.apache.tuscany.sca.node.SCANode2Factory;
+import org.junit.Test;
+
+/**
+ * Test case for Node2Impl
+ */
+public class Node2ImplTestCase {
+ private static String composite =
+ "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"" + " xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\""
+ + " targetNamespace=\"http://sample/composite\""
+ + " xmlns:sc=\"http://sample/composite\""
+ + " name=\"HelloWorld\">"
+ + " <component name=\"HelloWorld\">"
+ + " <implementation.java class=\"hello.HelloWorldImpl\"/>"
+ + " </component>"
+ + " </composite>";
+
+ @Test
+ public void testNodeWithCompositeContent() {
+ SCANode2Factory factory = SCANode2Factory.newInstance();
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
+ SCANode2 node = factory.createSCANode("HelloWorld.composite", composite, contribution);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithCompositeContentAndNoContribution() {
+ SCANode2Factory factory = SCANode2Factory.newInstance();
+ SCANode2 node = factory.createSCANode("HelloWorld.composite", composite);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithoutCompositeURI() {
+ SCANode2Factory factory = SCANode2Factory.newInstance();
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
+ SCANode2 node = factory.createSCANode(null, contribution);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithCompositeURI() {
+ SCANode2Factory factory = SCANode2Factory.newInstance();
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
+ String compositeURI = new File("target/test-classes/HelloWorld.composite").toURI().toString();
+ SCANode2 node = factory.createSCANode(compositeURI, contribution);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithRelativeCompositeURI() {
+ SCANode2Factory factory = SCANode2Factory.newInstance();
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
+ String compositeURI = "HelloWorld.composite";
+ SCANode2 node = factory.createSCANode(compositeURI, contribution);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithRelativeCompositeURIAndNoContribution() {
+ SCANode2Factory factory = SCANode2Factory.newInstance();
+ String compositeURI = "HelloWorld.composite";
+ SCANode2 node = factory.createSCANode(compositeURI, new SCAContribution[0]);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithClassLoader() {
+ SCANode2Factory factory = SCANode2Factory.newInstance();
+ String compositeURI = "HelloWorld.composite";
+ SCANode2 node = factory.createSCANodeFromClassLoader(compositeURI, HelloWorld.class.getClassLoader());
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithClassLoaderAndNullComposite() {
+ SCANode2Factory factory = SCANode2Factory.newInstance();
+ SCANode2 node = factory.createSCANodeFromClassLoader(null, HelloWorld.class.getClassLoader());
+ testNode(node);
+ }
+
+ private void testNode(SCANode2 node) {
+ node.start();
+ HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
+ Assert.assertEquals("Hello, Node", hw.hello("Node"));
+ node.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java
new file mode 100644
index 0000000000..d620f6b62a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.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.node.impl;
+
+import hello.HelloWorld;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.Test;
+
+/**
+ * Test case for NodeImpl
+ */
+public class NodeImplTestCase {
+ private static String composite =
+ "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"" + " xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\""
+ + " targetNamespace=\"http://sample/composite\""
+ + " xmlns:sc=\"http://sample/composite\""
+ + " name=\"HelloWorld\">"
+ + " <component name=\"HelloWorld\">"
+ + " <implementation.java class=\"hello.HelloWorldImpl\"/>"
+ + " </component>"
+ + " </composite>";
+
+ @Test
+ public void testNodeWithCompositeContent() {
+ SCANodeFactory factory = new NodeFactoryImpl();
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
+ SCANode node = factory.createSCANode("HelloWorld.composite", composite, contribution);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithCompositeContentAndNoContribution() {
+ SCANodeFactory factory = new NodeFactoryImpl();
+ SCANode node = factory.createSCANode("HelloWorld.composite", composite);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithoutCompositeURI() {
+ SCANodeFactory factory = new NodeFactoryImpl();
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
+ SCANode node = factory.createSCANode(null, contribution);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithCompositeURI() {
+ SCANodeFactory factory = new NodeFactoryImpl();
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
+ String compositeURI = new File("target/test-classes/HelloWorld.composite").toURI().toString();
+ SCANode node = factory.createSCANode(compositeURI, contribution);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithRelativeCompositeURI() {
+ SCANodeFactory factory = new NodeFactoryImpl();
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
+ String compositeURI = "HelloWorld.composite";
+ SCANode node = factory.createSCANode(compositeURI, contribution);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithRelativeCompositeURIAndNoContribution() {
+ SCANodeFactory factory = new NodeFactoryImpl();
+ String compositeURI = "HelloWorld.composite";
+ SCANode node = factory.createSCANode(compositeURI, new SCAContribution[0]);
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithClassLoader() {
+ SCANodeFactory factory = new NodeFactoryImpl();
+ String compositeURI = "HelloWorld.composite";
+ SCANode node = factory.createSCANodeFromClassLoader(compositeURI, HelloWorld.class.getClassLoader());
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithClassLoaderAndNullComposite() {
+ SCANodeFactory factory = new NodeFactoryImpl();
+ SCANode node = factory.createSCANodeFromClassLoader(null, HelloWorld.class.getClassLoader());
+ testNode(node);
+ }
+
+ private void testNode(SCANode node) {
+ node.start();
+ HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
+ Assert.assertEquals("Hello, Node", hw.hello("Node"));
+ node.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/resources/HelloWorld.composite b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/resources/HelloWorld.composite
new file mode 100644
index 0000000000..9e3299d691
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/resources/HelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/composite"
+ xmlns:sc="http://sample/composite"
+ name="HelloWorld">
+
+ <component name="HelloWorld">
+ <implementation.java class="hello.HelloWorldImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..1d37bcebe0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-impl/src/test/resources/META-INF/sca-contribution.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.
+-->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:sc="http://sample/composite">
+ <deployable composite="sc:HelloWorld" />
+</contribution>
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/LICENSE b/sca-java-1.x/branches/sca-android/modules/node-launcher/LICENSE
new file mode 100644
index 0000000000..6e529a25c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/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-android/modules/node-launcher/META-INF/README b/sca-java-1.x/branches/sca-android/modules/node-launcher/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/NOTICE b/sca-java-1.x/branches/sca-android/modules/node-launcher/NOTICE
new file mode 100644
index 0000000000..1325efd8bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/node-launcher/pom.xml b/sca-java-1.x/branches/sca-android/modules/node-launcher/pom.xml
new file mode 100644
index 0000000000..606a4f9164
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node-launcher</artifactId>
+ <name>Apache Tuscany SCA Node Launcher</name>
+
+ <dependencies>
+ <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>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.sca.node.launcher.NodeMain</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.node.launcher</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.node*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/Contribution.java b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/Contribution.java
new file mode 100644
index 0000000000..4f4f861e2f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/Contribution.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.node.launcher;
+
+/**
+ * Represents an SCA contribution uri + location.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class Contribution {
+ private String uri;
+ private String location;
+
+ /**
+ * Constructs a new SCA contribution.
+ *
+ * @param uri
+ * @param location
+ */
+ public Contribution(String uri, String location) {
+ this.uri = uri;
+ this.location = location;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java
new file mode 100644
index 0000000000..eb06ad7411
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.node.launcher;
+
+import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.domainManager;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Simple launcher for the SCA domain manager.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DomainManagerLauncher {
+
+ static final Logger logger = Logger.getLogger(DomainManagerLauncher.class.getName());
+
+ /**
+ * Constructs a new DomainManagerLauncher.
+ */
+ private DomainManagerLauncher() {
+ }
+
+ /**
+ * Returns a new launcher instance.
+ *
+ * @return a new launcher instance
+ */
+ public static DomainManagerLauncher newInstance() {
+ return new DomainManagerLauncher();
+ }
+
+ /**
+ * Creates a new DomainManager.
+ *
+ * @return a new DomainManager
+ * @throws LauncherException
+ */
+ public <T> T createDomainManager() throws LauncherException {
+ return (T)domainManager(".");
+ }
+
+ /**
+ * Creates a new DomainManager.
+ *
+ * @param rootDirectory the domain's root configuration directory
+ *
+ * @return a new DomainManager
+ * @throws LauncherException
+ */
+ public <T> T createDomainManager(String rootDirectory) throws LauncherException {
+ return (T)domainManager(rootDirectory);
+ }
+
+ public static void main(String[] args) throws Exception {
+ logger.info("Apache Tuscany SCA Domain Manager is starting...");
+
+ // Create a launcher
+ DomainManagerLauncher launcher = newInstance();
+
+ Object domainManager = null;
+ ShutdownThread shutdown = null;
+ try {
+ while (true) {
+
+ // Start the domain manager
+ domainManager = launcher.createDomainManager();
+ try {
+ domainManager.getClass().getMethod("start").invoke(domainManager);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Domain Manager could not be started", e);
+ throw e;
+ }
+ logger.info("SCA Domain Manager is now started.");
+
+ // Install a shutdown hook
+ shutdown = new ShutdownThread(domainManager);
+ Runtime.getRuntime().addShutdownHook(shutdown);
+
+ logger.info("Press 'q' to quit, 'r' to restart.");
+ int k = 0;
+ try {
+ while ((k != 'q') && (k != 'r')) {
+ k = System.in.read();
+ }
+ } catch (IOException e) {
+
+ // Wait forever
+ Object lock = new Object();
+ synchronized(lock) {
+ lock.wait();
+ }
+ }
+
+ // Stop the domain manager
+ if (domainManager != null) {
+ Object dm = domainManager;
+ domainManager = null;
+ stopDomainManager(dm);
+ }
+
+ // Quit
+ if (k == 'q' ) {
+ break;
+ }
+ }
+ } catch (Exception e) {
+ // Stop the domain manager
+ if (domainManager != null) {
+ try {
+ Object dm = domainManager;
+ domainManager = null;
+ stopDomainManager(dm);
+ } catch (Exception e2) {
+ }
+ }
+ throw e;
+
+ } finally {
+
+ // Remove the shutdown hook
+ if (shutdown != null) {
+ Runtime.getRuntime().removeShutdownHook(shutdown);
+ }
+ }
+ }
+
+ /**
+ * Stop the given domain manager.
+ *
+ * @param domainManager
+ * @throws Exception
+ */
+ private static void stopDomainManager(Object domainManager) throws Exception {
+ try {
+ domainManager.getClass().getMethod("stop").invoke(domainManager);
+ logger.info("SCA Domain Manager is now stopped.");
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Domain Manager could not be stopped", e);
+ throw e;
+ }
+ }
+
+ private static class ShutdownThread extends Thread {
+ private Object domainManager;
+
+ public ShutdownThread(Object domainManager) {
+ super();
+ this.domainManager = domainManager;
+ }
+
+ public void run() {
+ try {
+ stopDomainManager(domainManager);
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.java b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.java
new file mode 100644
index 0000000000..39e8d81139
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.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.node.launcher;
+
+
+/**
+ * Denotes an error launching an SCA domain manager or node.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LauncherException extends Exception {
+ private static final long serialVersionUID = 4581189418849190567L;
+
+ public LauncherException() {
+ super();
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public LauncherException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param message
+ */
+ public LauncherException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public LauncherException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java
new file mode 100644
index 0000000000..7cfabfe265
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.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.node.launcher;
+
+import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.nodeDaemon;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A launcher for the SCA Node daemon.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeDaemonLauncher {
+
+ static final Logger logger = Logger.getLogger(NodeDaemonLauncher.class.getName());
+
+ /**
+ * Constructs a new node daemon launcher.
+ */
+ private NodeDaemonLauncher() {
+ }
+
+ /**
+ * Returns a new launcher instance.
+ *
+ * @return a new launcher instance
+ */
+ public static NodeDaemonLauncher newInstance() {
+ return new NodeDaemonLauncher();
+ }
+
+ /**
+ * Creates a new node daemon.
+ *
+ * @param
+ * @return a new node daemon
+ * @throws LauncherException
+ */
+ public <T> T createNodeDaemon() throws LauncherException {
+ return (T)nodeDaemon();
+ }
+
+ public static void main(String[] args) throws Exception {
+ logger.info("Apache Tuscany SCA Node Daemon is starting...");
+
+ // Create a node launcher
+ NodeDaemonLauncher launcher = newInstance();
+
+ Object node = null;
+ ShutdownThread shutdown = null;
+ try {
+ while (true) {
+
+ // Start the node
+ node = launcher.createNodeDaemon();
+ try {
+ node.getClass().getMethod("start").invoke(node);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Node Daemon could not be started", e);
+ throw e;
+ }
+ logger.info("SCA Node Daemon is now started.");
+
+ // Install a shutdown hook
+ shutdown = new ShutdownThread(node);
+ Runtime.getRuntime().addShutdownHook(shutdown);
+
+ logger.info("Press 'q' to quit, 'r' to restart.");
+ int k = 0;
+ try {
+ while ((k != 'q') && (k != 'r')) {
+ k = System.in.read();
+ }
+ } catch (IOException e) {
+
+ // Wait forever
+ Object lock = new Object();
+ synchronized(lock) {
+ lock.wait();
+ }
+ }
+
+ // Stop the node
+ if (node != null) {
+ Object n = node;
+ node = null;
+ stopNode(n);
+ }
+
+ // Quit
+ if (k == 'q' ) {
+ break;
+ }
+ }
+ } catch (Exception e) {
+ // Stop the node
+ if (node != null) {
+ try {
+ Object n = node;
+ node = null;
+ stopNode(n);
+ } catch (Exception e2) {
+ }
+ }
+ throw e;
+
+ } finally {
+
+ // Remove the shutdown hook
+ if (shutdown != null) {
+ Runtime.getRuntime().removeShutdownHook(shutdown);
+ }
+ }
+ }
+
+ /**
+ * Stop the given node.
+ *
+ * @param node
+ * @throws Exception
+ */
+ private static void stopNode(Object node) throws Exception {
+ try {
+ node.getClass().getMethod("stop").invoke(node);
+ logger.info("SCA Node Daemon is now stopped.");
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Node Daemon could not be stopped", e);
+ throw e;
+ }
+ }
+
+ private static class ShutdownThread extends Thread {
+ private Object node;
+
+ public ShutdownThread(Object node) {
+ super();
+ this.node = node;
+ }
+
+ public void run() {
+ try {
+ stopNode(node);
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java
new file mode 100644
index 0000000000..be9bdb15c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.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.node.launcher;
+
+import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.node;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A launcher for SCA nodes.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeLauncher {
+
+ static final Logger logger = Logger.getLogger(NodeLauncher.class.getName());
+
+ /**
+ * Constructs a new node launcher.
+ */
+ private NodeLauncher() {
+ }
+
+ /**
+ * Returns a new launcher instance.
+ *
+ * @return a new launcher instance
+ */
+ public static NodeLauncher newInstance() {
+ return new NodeLauncher();
+ }
+
+ /**
+ * Creates a new SCA node from the configuration URL
+ *
+ * @param configurationURL the URL of the node configuration which is the ATOM feed
+ * that contains the URI of the composite and a collection of URLs for the contributions
+ *
+ * @return a new SCA node.
+ * @throws LauncherException
+ */
+ public <T> T createNodeFromURL(String configurationURL) throws LauncherException {
+ return (T)node(configurationURL, null, null, null, null);
+ }
+
+ /**
+ * Creates a new SCA Node.
+ *
+ * @param compositeURI the URI of the composite to use
+ * @param contributions the URI of the contributions that provides the composites and related
+ * artifacts. If the list is empty, then we will use the thread context classloader to discover
+ * the contribution on the classpath
+ *
+ * @return a new SCA node.
+ * @throws LauncherException
+ */
+ public <T> T createNode(String compositeURI, Contribution...contributions) throws LauncherException {
+ return (T)node(null, compositeURI, null, contributions, null);
+ }
+
+ /**
+ * Creates a new SCA Node.
+ *
+ * @param compositeURI the URI of the composite to use
+ * @param compositeContent the XML content of the composite to use
+ * @param contributions the URI of the contributions that provides the composites and related artifacts
+ * @return a new SCA node.
+ * @throws LauncherException
+ */
+ public <T> T createNode(String compositeURI, String compositeContent, Contribution...contributions) throws LauncherException {
+ return (T)node(null, compositeURI, compositeContent, contributions, null);
+ }
+
+ /**
+ * Create a SCA node based on the discovery of the contribution on the classpath for the
+ * given classloader. This method should be treated a convenient shortcut with the following
+ * assumptions:
+ * <ul>
+ * <li>This is a standalone application and there is a deployable composite file on the classpath.
+ * <li>There is only one contribution which contains the deployable composite file physically in its packaging hierarchy.
+ * </ul>
+ *
+ * @param compositeURI The URI of the composite file relative to the root of the enclosing contribution
+ * @param classLoader The ClassLoader used to load the composite file as a resource. If the value is null,
+ * then thread context classloader will be used
+ * @return A newly created SCA node
+ */
+ public <T> T createNodeFromClassLoader(String compositeURI, ClassLoader classLoader) throws LauncherException {
+ return (T)node(null, compositeURI, null, null, classLoader);
+ }
+
+ public static void main(String[] args) throws Exception {
+ logger.info("Apache Tuscany SCA Node is starting...");
+
+ // Create a node launcher
+ NodeLauncher launcher = newInstance();
+
+ Object node = null;
+ ShutdownThread shutdown = null;
+ try {
+ while (true) {
+ if (args.length ==1) {
+
+ // Create a node from a configuration URI
+ String configurationURI = args[0];
+ logger.info("SCA Node configuration: " + configurationURI);
+ node = launcher.createNodeFromURL(configurationURI);
+ } else {
+
+ // Create a node from a composite URI and a contribution location
+ String compositeURI = args[0];
+ String contributionLocation = args[1];
+ logger.info("SCA composite: " + compositeURI);
+ logger.info("SCA contribution: " + contributionLocation);
+ node = launcher.createNode(compositeURI, new Contribution("default", contributionLocation));
+ }
+
+ // Start the node
+ try {
+ node.getClass().getMethod("start").invoke(node);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Node could not be started", e);
+ throw e;
+ }
+ logger.info("SCA Node is now started.");
+
+ // Install a shutdown hook
+ shutdown = new ShutdownThread(node);
+ Runtime.getRuntime().addShutdownHook(shutdown);
+
+ logger.info("Press 'q' to quit, 'r' to restart.");
+ int k = 0;
+ try {
+ while ((k != 'q') && (k != 'r')) {
+ k = System.in.read();
+ }
+ } catch (IOException e) {
+
+ // Wait forever
+ Object lock = new Object();
+ synchronized(lock) {
+ lock.wait();
+ }
+ }
+
+ // Stop the node
+ if (node != null) {
+ Object n = node;
+ node = null;
+ stopNode(n);
+ }
+
+ // Quit
+ if (k == 'q' ) {
+ break;
+ }
+ }
+ } catch (Exception e) {
+ // Stop the node
+ if (node != null) {
+ try {
+ Object n = node;
+ node = null;
+ stopNode(n);
+ } catch (Exception e2) {
+ }
+ }
+ throw e;
+
+ } finally {
+
+ // Remove the shutdown hook
+ if (shutdown != null) {
+ Runtime.getRuntime().removeShutdownHook(shutdown);
+ }
+ }
+ }
+
+ /**
+ * Stop the given node.
+ *
+ * @param node
+ * @throws Exception
+ */
+ private static void stopNode(Object node) throws Exception {
+ try {
+ node.getClass().getMethod("stop").invoke(node);
+ logger.info("SCA Node is now stopped.");
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Node could not be stopped", e);
+ throw e;
+ }
+ }
+
+ private static class ShutdownThread extends Thread {
+ private Object node;
+
+ public ShutdownThread(Object node) {
+ super();
+ this.node = node;
+ }
+
+ public void run() {
+ try {
+ stopNode(node);
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
new file mode 100644
index 0000000000..7be1e14988
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
@@ -0,0 +1,535 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.node.launcher;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Common functions and constants used by the admin components.
+ *
+ * @version $Rev$ $Date$
+ */
+final class NodeLauncherUtil {
+ private static final Logger logger = Logger.getLogger(NodeLauncherUtil.class.getName());
+
+ private static final String TUSCANY_HOME = "TUSCANY_HOME";
+ private static final String TUSCANY_PATH = "TUSCANY_PATH";
+
+
+ /**
+ * Returns a ClassLoader for the Tuscany runtime JARs for use in a standalone
+ * J2SE environment.
+ *
+ * @param parentClassLoader
+ *
+ * @return
+ */
+ static ClassLoader standAloneRuntimeClassLoader(ClassLoader parentClassLoader) throws FileNotFoundException, URISyntaxException, MalformedURLException {
+ return runtimeClassLoader(parentClassLoader, new StandAloneJARFileNameFilter());
+ }
+
+ /**
+ * Returns a ClassLoader for the Tuscany runtime JARs for use in a Webapp
+ * environment.
+ *
+ * @param parentClassLoader
+ *
+ * @return
+ */
+ static ClassLoader webAppRuntimeClassLoader(ClassLoader parentClassLoader) throws FileNotFoundException, URISyntaxException, MalformedURLException {
+ return runtimeClassLoader(parentClassLoader, new WebAppJARFileNameFilter());
+ }
+
+ /**
+ * Returns a ClassLoader for the Tuscany runtime JARs.
+ *
+ * @param parentClassLoader
+ * @param filter
+ *
+ * @return
+ */
+ private static ClassLoader runtimeClassLoader(ClassLoader parentClassLoader, FilenameFilter filter) throws FileNotFoundException, URISyntaxException, MalformedURLException {
+
+ // Build list of runtime JARs
+ Set<URL> jarDirectoryURLs = new HashSet<URL>();
+ List<URL> jarURLs = new ArrayList<URL>();
+
+ // First determine the path to the launcher class
+ String resource = NodeLauncherUtil.class.getName().replace('.', '/') + ".class";
+ URL url = NodeLauncherUtil.class.getClassLoader().getResource(resource);
+ if (url == null) {
+ throw new FileNotFoundException(resource);
+ }
+ URI uri = url.toURI();
+
+ // If the launcher class is in a JAR, add all runtime JARs from directory containing
+ // that JAR (e.g. the Tuscany modules directory) as well as the ../modules and
+ // ../lib directories
+ String scheme = uri.getScheme();
+ if (scheme.equals("jar")) {
+ String path = uri.toString().substring(4);
+ int i = path.indexOf("!/");
+ if (i != -1) {
+ path = path.substring(0, i);
+ uri = URI.create(path);
+ }
+
+ File file = new File(uri);
+ if (file.exists()) {
+ File jarDirectory = file.getParentFile();
+ if (jarDirectory != null && jarDirectory.exists()) {
+
+ // Collect JAR files from the directory containing the input JAR
+ // (e.g. the Tuscany modules directory)
+ URL jarDirectoryURL = jarDirectory.toURI().toURL();
+ jarDirectoryURLs.add(jarDirectoryURL);
+ collectJARFiles(jarDirectory, jarURLs, filter);
+
+ File homeDirectory = jarDirectory.getParentFile();
+ if (homeDirectory != null && homeDirectory.exists()) {
+
+ // Collect JARs from the ../modules directory
+ File modulesDirectory = new File(homeDirectory, "modules");
+ URL modulesDirectoryURL = modulesDirectory.toURI().toURL();
+ if (!jarDirectoryURLs.contains(modulesDirectoryURL) && modulesDirectory.exists()) {
+ jarDirectoryURLs.add(modulesDirectoryURL);
+ collectJARFiles(modulesDirectory, jarURLs, filter);
+ }
+
+ // Collect JARs from the ../lib directory
+ File libDirectory = new File(homeDirectory, "lib");
+ URL libDirectoryURL = libDirectory.toURI().toURL();
+ if (!jarDirectoryURLs.contains(libDirectoryURL) && libDirectory.exists()) {
+ jarDirectoryURLs.add(libDirectoryURL);
+ collectJARFiles(libDirectory, jarURLs, filter);
+ }
+ }
+ }
+ }
+ }
+
+ // Look for a TUSCANY_HOME system property or environment variable
+ // Add all the JARs found under $TUSCANY_HOME, $TUSCANY_HOME/modules
+ // and $TUSCANY_HOME/lib
+ String home = System.getProperty(TUSCANY_HOME);
+ if (home == null || home.length() == 0) {
+ home = System.getenv(TUSCANY_HOME);
+ }
+ if (home != null && home.length() != 0) {
+ logger.fine(TUSCANY_HOME + ": " + home);
+ collectJARFiles(home, jarDirectoryURLs, jarURLs, filter);
+ }
+
+ // Look for a TUSCANY_PATH system property or environment variable
+ // Add all the JARs found under $TUSCANY_PATH, $TUSCANY_PATH/modules
+ // and $TUSCANY_PATH/lib
+ String ext = System.getProperty(TUSCANY_PATH);
+ if (ext == null || ext.length() == 0) {
+ ext = System.getenv(TUSCANY_PATH);
+ }
+ if (ext != null && ext.length() != 0) {
+ logger.fine(TUSCANY_PATH + ": " + ext);
+ String separator = System.getProperty("path.separator");
+ for (StringTokenizer tokens = new StringTokenizer(ext, separator); tokens.hasMoreTokens(); ) {
+ collectJARFiles(tokens.nextToken(), jarDirectoryURLs, jarURLs, filter);
+ }
+ }
+
+ // Return the runtime class loader
+ if (!jarURLs.isEmpty()) {
+
+ // Return a ClassLoader configured with the runtime JARs
+ ClassLoader classLoader = new RuntimeClassLoader(jarURLs.toArray(new URL[jarURLs.size()]), parentClassLoader);
+ return classLoader;
+
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Collect JAR files under the given directory.
+ *
+ * @param directory
+ * @param jarDirectoryURLs
+ * @param jarURLs
+ * @param filter
+ * @throws MalformedURLException
+ */
+ private static void collectJARFiles(String directory, Set<URL> jarDirectoryURLs, List<URL> jarURLs, FilenameFilter filter)
+ throws MalformedURLException {
+ File directoryFile = new File(directory);
+ URL directoryURL = directoryFile.toURI().toURL();
+ if (!jarDirectoryURLs.contains(directoryURL) && directoryFile.exists()) {
+
+ // Collect files under $TUSCANY_HOME
+ jarDirectoryURLs.add(directoryURL);
+ collectJARFiles(directoryFile, jarURLs, filter);
+
+ // Collect files under $TUSCANY_HOME/modules
+ File modulesDirectory = new File(directoryFile, "modules");
+ URL modulesDirectoryURL = modulesDirectory.toURI().toURL();
+ if (!jarDirectoryURLs.contains(modulesDirectoryURL) && modulesDirectory.exists()) {
+ jarDirectoryURLs.add(modulesDirectoryURL);
+ collectJARFiles(modulesDirectory, jarURLs, filter);
+ }
+
+ // Collect files under $TUSCANY_HOME/lib
+ File libDirectory = new File(directoryFile, "lib");
+ URL libDirectoryURL = libDirectory.toURI().toURL();
+ if (!jarDirectoryURLs.contains(libDirectoryURL) && libDirectory.exists()) {
+ jarDirectoryURLs.add(libDirectoryURL);
+ collectJARFiles(libDirectory, jarURLs, filter);
+ }
+ }
+ }
+
+ /**
+ * Collect JAR files in the given directory
+ * @param directory
+ * @param urls
+ * @param filter
+ * @throws MalformedURLException
+ */
+ private static void collectJARFiles(File directory, List<URL> urls, FilenameFilter filter) throws MalformedURLException {
+ String[] files = directory.list(filter);
+ if (files != null) {
+ URL directoryURL = new URL(directory.toURI().toString() + "/");
+ int count = 0;
+ for (String file: files) {
+ URL url = new URL(directoryURL, file);
+ urls.add(url);
+ count++;
+ }
+ if (count != 0) {
+ logger.fine("Runtime classpath: "+ count + " JAR" + (count > 1? "s":"")+ " from " + directory.toString());
+ }
+ }
+ }
+
+ /**
+ * A file name filter used to filter JAR files.
+ */
+ private static class StandAloneJARFileNameFilter implements FilenameFilter {
+
+ public boolean accept(File dir, String name) {
+ name = name.toLowerCase();
+
+ // Exclude tuscany-sca-all and tuscany-sca-manifest as they duplicate
+ // code in the individual runtime module JARs
+ if (name.startsWith("tuscany-sca-all")) {
+ return false;
+ }
+ if (name.startsWith("tuscany-sca-manifest")) {
+ return false;
+ }
+
+ // Filter out the Tomcat and Webapp hosts
+ if (name.startsWith("tuscany-host-tomcat") ||
+ name.startsWith("tuscany-host-webapp")) {
+ //FIXME This is temporary
+ return false;
+ }
+
+ // Include JAR and MAR files
+ if (name.endsWith(".jar")) {
+ return true;
+ }
+ if (name.endsWith(".mar")) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * A file name filter used to filter JAR files.
+ */
+ private static class WebAppJARFileNameFilter extends StandAloneJARFileNameFilter {
+
+ @Override
+ public boolean accept(File dir, String name) {
+ if (!super.accept(dir, name)) {
+ return false;
+ }
+ name = name.toLowerCase();
+
+ // Exclude servlet-api JARs
+ if (name.startsWith("servlet-api")) {
+ return false;
+ }
+
+ // Exclude the Tomcat and Jetty hosts
+ if (name.startsWith("tuscany-host-tomcat") || name.startsWith("tuscany-host-jetty")) {
+ //FIXME This is temporary
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+
+ /**
+ * Creates a new node.
+ *
+ * @param compositeURI
+ * @param contributions
+ * @throws LauncherException
+ */
+ static Object node(String configurationURI, String compositeURI, String compositeContent, Contribution[] contributions, ClassLoader contributionClassLoader) throws LauncherException {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+
+ // Set up runtime ClassLoader
+ ClassLoader runtimeClassLoader = runtimeClassLoader(Thread.currentThread().getContextClassLoader(),
+ new StandAloneJARFileNameFilter());
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ // Use Java reflection to create the node as only the runtime class
+ // loader knows the runtime classes required by the node
+ String className = "org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationLauncherBootstrap";
+ Class<?> bootstrapClass;
+ if (runtimeClassLoader != null) {
+ bootstrapClass = Class.forName(className, true, runtimeClassLoader);
+ } else {
+ bootstrapClass = Class.forName(className);
+ }
+
+ Object bootstrap;
+ if (configurationURI != null) {
+
+ // Construct the node with a configuration URI
+ bootstrap = bootstrapClass.getConstructor(String.class).newInstance(configurationURI);
+
+ } else if (contributionClassLoader != null) {
+
+ // Construct the node with a compositeURI and a classloader
+ Constructor<?> constructor = bootstrapClass.getConstructor(String.class, ClassLoader.class);
+ bootstrap = constructor.newInstance(compositeURI, contributionClassLoader);
+
+ } else if (compositeContent != null) {
+
+ // Construct the node with a composite URI, the composite content and
+ // the URIs and locations of a list of contributions
+ Constructor<?> constructor = bootstrapClass.getConstructor(String.class, String.class, String[].class, String[].class);
+ String[] uris = new String[contributions.length];
+ String[] locations = new String[contributions.length];
+ for (int i = 0; i < contributions.length; i++) {
+ uris[i] = contributions[i].getURI();
+ locations[i] = contributions[i].getLocation();
+ }
+ bootstrap = constructor.newInstance(compositeURI, compositeContent, uris, locations);
+
+ } else {
+
+ // Construct the node with a composite URI and the URIs and
+ // locations of a list of contributions
+ Constructor<?> constructor = bootstrapClass.getConstructor(String.class, String[].class, String[].class);
+ String[] uris = new String[contributions.length];
+ String[] locations = new String[contributions.length];
+ for (int i = 0; i < contributions.length; i++) {
+ uris[i] = contributions[i].getURI();
+ locations[i] = contributions[i].getLocation();
+ }
+ bootstrap = constructor.newInstance(compositeURI, uris, locations);
+ }
+
+ Object node = bootstrapClass.getMethod("getNode").invoke(bootstrap);
+ return node;
+
+ } catch (Exception e) {
+ NodeLauncher.logger.log(Level.SEVERE, "SCA Node could not be created", e);
+ throw new LauncherException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Creates a new node daemon.
+ *
+ * @throws LauncherException
+ */
+ static Object nodeDaemon() throws LauncherException {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ // Set up runtime ClassLoader
+ ClassLoader runtimeClassLoader = runtimeClassLoader(Thread.currentThread().getContextClassLoader(),
+ new StandAloneJARFileNameFilter());
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ // Use Java reflection to create the node daemon as only the runtime class
+ // loader knows the runtime classes required by the node
+ String className = "org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationDaemonBootstrap";
+ Class<?> bootstrapClass;
+ if (runtimeClassLoader != null) {
+ bootstrapClass = Class.forName(className, true, runtimeClassLoader);
+ } else {
+ bootstrapClass = Class.forName(className);
+ }
+ Object bootstrap = bootstrapClass.getConstructor().newInstance();
+
+ Object nodeDaemon = bootstrapClass.getMethod("getNode").invoke(bootstrap);
+ return nodeDaemon;
+
+ } catch (Exception e) {
+ NodeDaemonLauncher.logger.log(Level.SEVERE, "SCA Node Daemon could not be created", e);
+ throw new LauncherException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Creates a new domain manager.
+ *
+ * @throws LauncherException
+ */
+ static Object domainManager(String rootDirectory) throws LauncherException {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ // Set up runtime ClassLoader
+ ClassLoader runtimeClassLoader = runtimeClassLoader(Thread.currentThread().getContextClassLoader(),
+ new StandAloneJARFileNameFilter());
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ // Use Java reflection to create the node daemon as only the runtime class
+ // loader knows the runtime classes required by the node
+ String className = "org.apache.tuscany.sca.domain.manager.launcher.DomainManagerLauncherBootstrap";
+ Class<?> bootstrapClass;
+ if (runtimeClassLoader != null) {
+ bootstrapClass = Class.forName(className, true, runtimeClassLoader);
+ } else {
+ bootstrapClass = Class.forName(className);
+ }
+ Constructor<?> constructor = bootstrapClass.getConstructor(String.class);
+ Object bootstrap = constructor.newInstance(rootDirectory);
+
+ Object domainManager = bootstrapClass.getMethod("getNode").invoke(bootstrap);
+ return domainManager;
+
+ } catch (Exception e) {
+ DomainManagerLauncher.logger.log(Level.SEVERE, "SCA Domain Manager could not be created", e);
+ throw new LauncherException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Simple URL class loader for the runtime JARs
+ */
+ private static class RuntimeClassLoader extends URLClassLoader {
+ private static final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
+ private ClassLoader parent;
+
+ /**
+ * Constructs a new class loader.
+ * @param urls
+ * @param parent
+ */
+ private RuntimeClassLoader(URL[] urls, ClassLoader parent) {
+ super(urls);
+ this.parent = parent;
+ }
+
+ @Override
+ public URL findResource(String name) {
+ URL url = super.findResource(name);
+ if (url == null) {
+ url = parent.getResource(name);
+ }
+ return url;
+ }
+
+ @Override
+ public Enumeration<URL> findResources(String name) throws IOException {
+ Enumeration<URL> resources = super.findResources(name);
+ Enumeration<URL> parentResources = parent.getResources(name);
+ List<URL> allResources = new ArrayList<URL>();
+ for (; resources.hasMoreElements(); ) {
+ allResources.add(resources.nextElement());
+ }
+ for (; parentResources.hasMoreElements(); ) {
+ allResources.add(parentResources.nextElement());
+ }
+ return Collections.enumeration(allResources);
+ }
+
+ @Override
+ protected Class<?> findClass(String name) throws ClassNotFoundException {
+ Class<?> cl;
+
+ // First try to load the class using the parent classloader
+ try {
+ cl = parent.loadClass(name);
+ ClassLoader loadedBy = cl.getClassLoader();
+
+ // If the class was not loaded directly by the parent classloader
+ // or the system classloader try to load a local version of the class
+ // using our RuntimeClassloader instead
+ if (loadedBy != parent &&
+ loadedBy != systemClassLoader &&
+ loadedBy != null) {
+
+ try {
+ cl = super.findClass(name);
+ } catch (ClassNotFoundException e) {
+ // No class alternative was found in our RuntimeClassloader,
+ // use the class found in the parent classloader hierarchy
+ }
+ }
+ } catch (ClassNotFoundException e) {
+
+ // The class was not found by the parent class loader, try
+ // to load it using our RuntimeClassloader
+ cl = super.findClass(name);
+ }
+
+ return cl;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.java b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.java
new file mode 100644
index 0000000000..eafe4ddaa0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.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.node.launcher;
+
+
+/**
+ * Main class for this JAR.
+ * With no arguments this class launches the SCA Node Daemon.
+ * With a "domain" argument it launches the SCA domain admin node.
+ * With any other argument it launches an SCA Node.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeMain {
+
+ public static void main(String[] args) throws Exception {
+ if (args.length != 0) {
+ if (args[0].equals("domain")) {
+ DomainManagerLauncher.main(args);
+ } else {
+ NodeLauncher.main(args);
+ }
+ } else {
+ NodeDaemonLauncher.main(args);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java
new file mode 100644
index 0000000000..5345363031
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.node.launcher;
+
+import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.webAppRuntimeClassLoader;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * A Servlet filter that forwards service requests to the Servlets registered with
+ * the Tuscany ServletHost.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeServletFilter implements Filter {
+ private static final long serialVersionUID = 1L;
+
+ private static final String NODE_WEB_APP_SERVLET_HOST = "org.apache.tuscany.sca.implementation.node.webapp.NodeWebAppServletHost";
+
+ private static final Logger logger = Logger.getLogger(NodeServletFilter.class.getName());
+
+ private ClassLoader runtimeClassLoader;
+ private Class<?> servletHostClass;
+ private Object servletHost;
+ private Filter filter;
+
+ public void init(FilterConfig filterConfig) throws ServletException {
+ logger.info("Apache Tuscany SCA WebApp Node is starting...");
+
+ try {
+ // Get the Tuscany runtime ClassLoader
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ runtimeClassLoader = webAppRuntimeClassLoader(getClass().getClassLoader());
+
+ try {
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ // Load the Tuscany WebApp Servlet host and get the host instance
+ // for the current webapp
+ String className = NODE_WEB_APP_SERVLET_HOST;
+ if (runtimeClassLoader != null) {
+ servletHostClass = Class.forName(className, true, runtimeClassLoader);
+ } else {
+ servletHostClass = Class.forName(className);
+ }
+ servletHost = servletHostClass.getMethod("servletHost").invoke(null);
+
+ // Initialize the Servlet host
+ servletHostClass.getMethod("init", FilterConfig.class).invoke(servletHost, filterConfig);
+
+ // The Servlet host also implements the filter interface
+ filter = (Filter)servletHost;
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "Error Starting SCA WebApp Node", e);
+ throw new ServletException(e);
+ }
+
+ logger.info("SCA WebApp Node started.");
+ }
+
+ public void destroy() {
+ logger.info("Apache Tuscany WebApp Node stopping...");
+ if (servletHost != null) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ servletHostClass.getMethod("destroy").invoke(servletHost);
+
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "Error Stopping SCA WebApp Node", e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+ logger.info("SCA WebApp Node stopped.");
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
+ throws IOException, ServletException {
+
+ // Delegate to the Servlet host filter
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ filter.doFilter(request, response, chain);
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/LICENSE b/sca-java-1.x/branches/sca-android/modules/policy-xml/LICENSE
new file mode 100644
index 0000000000..6e529a25c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-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-android/modules/policy-xml/META-INF/README b/sca-java-1.x/branches/sca-android/modules/policy-xml/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/NOTICE b/sca-java-1.x/branches/sca-android/modules/policy-xml/NOTICE
new file mode 100644
index 0000000000..1325efd8bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/policy-xml/pom.xml b/sca-java-1.x/branches/sca-android/modules/policy-xml/pom.xml
new file mode 100644
index 0000000000..178648c7a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/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-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <name>Apache Tuscany SCA Policy XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.policy.xml</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.policy.xml*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java
new file mode 100644
index 0000000000..d47cbd7dbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.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.policy.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
+
+
+/**
+ * Processor for handling XML models of BindingType meta data definitions
+ *
+ * @version $Rev$ $Date$
+ */
+public class BindingTypeProcessor extends IntentAttachPointTypeProcessor {
+
+ public BindingTypeProcessor(PolicyFactory policyFactory, IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
+ super(policyFactory, intentAttachPointTypeFactory, extensionProcessor, monitor);
+ }
+
+ public BindingTypeProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ Monitor monitor) {
+ super(modelFactories.getFactory(PolicyFactory.class),
+ modelFactories.getFactory(IntentAttachPointTypeFactory.class), extensionProcessor, monitor);
+ }
+
+ public QName getArtifactType() {
+ return BINDING_TYPE_QNAME;
+ }
+
+ @Override
+ protected IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
+ if ( extnType instanceof BindingTypeImpl ) {
+ BindingTypeImpl bindingType = (BindingTypeImpl)extnType;
+ return resolver.resolveModel(BindingTypeImpl.class, bindingType);
+ } else {
+ return extnType;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java
new file mode 100644
index 0000000000..119afa3473
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.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.policy.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
+
+
+/**
+ * Processor for handling XML models of ImplementationType meta data definitions
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImplementationTypeProcessor extends IntentAttachPointTypeProcessor {
+
+ public ImplementationTypeProcessor(PolicyFactory policyFactory, IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
+ super(policyFactory, intentAttachPointTypeFactory, extensionProcessor, monitor);
+ }
+
+ public ImplementationTypeProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ Monitor monitor) {
+ super(modelFactories.getFactory(PolicyFactory.class),
+ modelFactories.getFactory(IntentAttachPointTypeFactory.class), extensionProcessor, monitor);
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_TYPE_QNAME;
+ }
+
+ @Override
+ protected IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
+ if ( extnType instanceof ImplementationTypeImpl ) {
+ ImplementationTypeImpl implType = (ImplementationTypeImpl)extnType;
+ return resolver.resolveModel(ImplementationTypeImpl.class, implType);
+ } else {
+ return extnType;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java
new file mode 100644
index 0000000000..ec357aea93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.xml;
+
+import java.util.ArrayList;
+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.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
+import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
+
+
+/**
+ * Processor for handling XML models of ExtensionType meta data definitions
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class IntentAttachPointTypeProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<IntentAttachPointType>, PolicyConstants {
+
+ private IntentAttachPointTypeFactory attachPointTypeFactory;
+ private PolicyFactory policyFactory;
+ private Monitor monitor;
+
+ protected abstract IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException;
+
+ public IntentAttachPointTypeProcessor(PolicyFactory policyFactory,
+ IntentAttachPointTypeFactory attachPointTypeFactory,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ Monitor monitor) {
+ this.policyFactory = policyFactory;
+ this.attachPointTypeFactory = attachPointTypeFactory;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "policy-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ public IntentAttachPointType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ QName type = getQName(reader, TYPE);
+
+ if ( type != null ) {
+ if ( type.getLocalPart().startsWith(BINDING) ) {
+ IntentAttachPointType bindingType = attachPointTypeFactory.createBindingType();
+ bindingType.setName(type);
+ bindingType.setUnresolved(true);
+
+ readAlwaysProvidedIntents(bindingType, reader);
+ readMayProvideIntents(bindingType, reader);
+ return bindingType;
+ } else if ( type.getLocalPart().startsWith(IMPLEMENTATION) ) {
+ IntentAttachPointType implType = attachPointTypeFactory.createImplementationType();
+ implType.setName(type);
+ implType.setUnresolved(true);
+
+ readAlwaysProvidedIntents(implType, reader);
+ readMayProvideIntents(implType, reader);
+ return implType;
+ } else {
+ error("UnrecognizedIntentAttachPointType", reader, type);
+ //throw new ContributionReadException("Unrecognized IntentAttachPointType - " + type);
+ }
+ } else {
+ error("RequiredAttributeMissing", reader, TYPE);
+ //throw new ContributionReadException("Required attribute '" + TYPE +
+ //"' missing from BindingType Definition");
+ }
+ return null;
+ }
+
+ private void readAlwaysProvidedIntents(IntentAttachPointType extnType, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, ALWAYS_PROVIDES);
+ if (value != null) {
+ List<Intent> alwaysProvided = extnType.getAlwaysProvidedIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ alwaysProvided.add(intent);
+ }
+ }
+ }
+
+ private void readMayProvideIntents(IntentAttachPointType extnType, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, MAY_PROVIDE);
+ if (value != null) {
+ List<Intent> mayProvide = extnType.getMayProvideIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ mayProvide.add(intent);
+ }
+ }
+ }
+
+ public void write(IntentAttachPointType extnType, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write an <sca:bindingType or sca:implementationType>
+ if ( extnType instanceof BindingTypeImpl ) {
+ writer.writeStartElement(SCA10_NS, BINDING_TYPE);
+ } else if ( extnType instanceof ImplementationTypeImpl ) {
+ writer.writeStartElement(SCA10_NS, IMPLEMENTATION_TYPE);
+ }
+
+ writeAlwaysProvidesIntentsAttribute(extnType, writer);
+ writeMayProvideIntentsAttribute(extnType, writer);
+
+ writer.writeEndElement();
+ }
+
+ private void writeMayProvideIntentsAttribute(IntentAttachPointType extnType, XMLStreamWriter writer) throws XMLStreamException {
+ StringBuffer sb = new StringBuffer();
+ for ( Intent intent : extnType.getMayProvideIntents() ) {
+ writer.writeNamespace(intent.getName().getPrefix(), intent.getName().getNamespaceURI());
+ sb.append(intent.getName().getPrefix() + COLON + intent.getName().getLocalPart());
+ sb.append(WHITE_SPACE);
+ }
+
+ if ( sb.length() > 0 ) {
+ writer.writeAttribute(MAY_PROVIDE, sb.toString());
+ }
+ }
+
+ private void writeAlwaysProvidesIntentsAttribute(IntentAttachPointType extnType, XMLStreamWriter writer) throws XMLStreamException {
+ StringBuffer sb = new StringBuffer();
+ for ( Intent intent : extnType.getAlwaysProvidedIntents() ) {
+ writer.writeNamespace(intent.getName().getPrefix(), intent.getName().getNamespaceURI());
+ sb.append(intent.getName().getPrefix() + COLON + intent.getName().getLocalPart());
+ sb.append(WHITE_SPACE);
+ }
+
+ if ( sb.length() > 0 ) {
+ writer.writeAttribute(ALWAYS_PROVIDES, sb.toString());
+
+ }
+ }
+
+ public void resolve(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
+
+ if (extnType != null && extnType.isUnresolved()) {
+ resolveAlwaysProvidedIntents(extnType, resolver);
+ resolveMayProvideIntents(extnType, resolver);
+ extnType.setUnresolved(false);
+ //resolveExtensionType(extnType, resolver);
+ }
+ }
+
+ private void resolveAlwaysProvidedIntents(IntentAttachPointType extensionType,
+ ModelResolver resolver) throws ContributionResolveException {
+ if (extensionType != null) {
+ // resolve all provided intents
+ List<Intent> alwaysProvided = new ArrayList<Intent>();
+ for (Intent providedIntent : extensionType.getAlwaysProvidedIntents()) {
+ if (providedIntent.isUnresolved()) {
+ providedIntent = resolver.resolveModel(Intent.class, providedIntent);
+ if (!providedIntent.isUnresolved()) {
+ alwaysProvided.add(providedIntent);
+ } else {
+ error("AlwaysProvidedIntentNotFound", resolver, providedIntent, extensionType);
+ //throw new ContributionResolveException("Always Provided Intent - " + providedIntent
+ //+ " not found for ExtensionType "
+ //+ extensionType);
+ }
+ } else {
+ alwaysProvided.add(providedIntent);
+ }
+ }
+ extensionType.getAlwaysProvidedIntents().clear();
+ extensionType.getAlwaysProvidedIntents().addAll(alwaysProvided);
+ }
+ }
+
+ private void resolveMayProvideIntents(IntentAttachPointType extensionType,
+ ModelResolver resolver) throws ContributionResolveException {
+ if (extensionType != null) {
+ // resolve all provided intents
+ List<Intent> mayProvide = new ArrayList<Intent>();
+ for (Intent providedIntent : extensionType.getMayProvideIntents()) {
+ if (providedIntent.isUnresolved()) {
+ providedIntent = resolver.resolveModel(Intent.class, providedIntent);
+ if (!providedIntent.isUnresolved()) {
+ mayProvide.add(providedIntent);
+ } else {
+ error("MayProvideIntentNotFound", resolver, providedIntent, extensionType);
+ //throw new ContributionResolveException("May Provide Intent - " + providedIntent
+ //+ " not found for ExtensionType "
+ //+ extensionType);
+ }
+ } else {
+ mayProvide.add(providedIntent);
+ }
+ }
+ extensionType.getMayProvideIntents().clear();
+ extensionType.getMayProvideIntents().addAll(mayProvide);
+ }
+ }
+
+ public Class<IntentAttachPointType> getModelType() {
+ return IntentAttachPointType.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
new file mode 100644
index 0000000000..3f1008e9a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.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.policy.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * constants related to policy framework
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PolicyConstants {
+ String WHITE_SPACE = " ";
+ String COLON = ":";
+ String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ String TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+ String INTENT = "intent";
+ String POLICY_SET = "policySet";
+ String POLICY_SET_REFERENCE = "policySetReference";
+ String INTENT_MAP = "intentMap";
+ String NAME = "name";
+ String TARGET_NAMESPACE = "targetNamespace";
+ String SCA_DEFINITIONS = "definitions";
+ String CONSTRAINS = "constrains";
+ String DESCRIPTION = "description";
+ String PROVIDES = "provides";
+ String APPLIES_TO = "appliesTo";
+ String ALWAYS_APPLIES_TO = "alwaysAppliesTo";
+ String QUALIFIER = ".";
+ String INTENT_MAP_QUALIFIER = "qualifier";
+ String REQUIRES = "requires";
+ String EXCLUDES = "excludes";
+ String DEFAULT = "default";
+
+ String ALWAYS_PROVIDES = "alwaysProvides";
+ String MAY_PROVIDE = "mayProvide";
+ String TYPE = "type";
+ String IMPLEMENTATION_TYPE = "implementationType";
+ String BINDING_TYPE = "bindingType";
+ QName IMPLEMENTATION_TYPE_QNAME = new QName(SCA10_NS, IMPLEMENTATION_TYPE);
+ QName BINDING_TYPE_QNAME = new QName(SCA10_NS, BINDING_TYPE);
+ String BINDING = "binding";
+ String IMPLEMENTATION = "implementation";
+
+ QName POLICY_INTENT_QNAME = new QName(SCA10_NS, INTENT);
+ QName POLICY_SET_QNAME = new QName(SCA10_NS, POLICY_SET);
+ QName POLICY_INTENT_MAP_QNAME = new QName(SCA10_NS, INTENT_MAP);
+ QName SCA_DEFINITIONS_QNAME = new QName(SCA10_NS, SCA_DEFINITIONS);
+ QName DESCRIPTION_QNAME = new QName(SCA10_NS, DESCRIPTION);
+ QName POLICY_INTENT_MAP_QUALIFIER_QNAME = new QName(SCA10_NS, INTENT_MAP_QUALIFIER);
+ QName POLICY_SET_REFERENCE_QNAME = new QName(SCA10_NS, POLICY_SET_REFERENCE);
+
+ String QUALIFIED_INTENT_CONSTRAINS_ERROR = " - Qualified Intents must not specify 'constrains' attribute";
+
+
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
new file mode 100644
index 0000000000..76ef8df298
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
@@ -0,0 +1,417 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.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 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.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Processor for handling XML models of PolicyIntent definitions
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class PolicyIntentProcessor<T extends Intent> extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<T>, PolicyConstants {
+
+ private PolicyFactory policyFactory;
+ private Monitor monitor;
+
+ public PolicyIntentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.monitor = monitor;
+ }
+
+ public PolicyIntentProcessor(PolicyFactory policyFactory, Monitor monitor) {
+ this.policyFactory = policyFactory;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "policy-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ public T read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ Intent policyIntent = null;
+ String policyIntentName = reader.getAttributeValue(null, NAME);
+ if (policyIntentName == null) {
+ error("IntentNameMissing", reader);
+ return (T)policyIntent;
+ }
+
+ // Read an <sca:intent>
+ if (reader.getAttributeValue(null, REQUIRES) != null) {
+ policyIntent = policyFactory.createProfileIntent();
+ } else if ( policyIntentName != null && policyIntentName.indexOf(QUALIFIER) != -1) {
+ policyIntent = policyFactory.createQualifiedIntent();
+
+ int qualifierIndex = policyIntentName.lastIndexOf(QUALIFIER);
+ Intent qualifiableIntent = policyFactory.createIntent();
+ qualifiableIntent.setUnresolved(true);
+ qualifiableIntent.setName(new QName(policyIntentName.substring(0, qualifierIndex)));
+
+ ((QualifiedIntent)policyIntent).setQualifiableIntent(qualifiableIntent);
+ } else {
+ policyIntent = policyFactory.createIntent();
+ }
+ policyIntent.setName(new QName(policyIntentName));
+
+ if ( policyIntent instanceof ProfileIntent ) {
+ readRequiredIntents((ProfileIntent)policyIntent, reader);
+ }
+ else {
+ readExcludedIntents(policyIntent, reader);
+ }
+
+ readConstrainedArtifacts(policyIntent, reader);
+
+ int event = reader.getEventType();
+ QName name = null;
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if (DESCRIPTION_QNAME.equals(name)) {
+ policyIntent.setDescription(reader.getElementText());
+ }
+ break;
+ }
+ }
+ if (event == END_ELEMENT && POLICY_INTENT_QNAME.equals(reader.getName())) {
+ break;
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return (T)policyIntent;
+ }
+
+ public void write(T policyIntent, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ // Write an <sca:intent>
+ writer.writeStartElement(PolicyConstants.SCA10_NS, INTENT);
+ writer.writeNamespace(policyIntent.getName().getPrefix(), policyIntent.getName().getNamespaceURI());
+ writer.writeAttribute(PolicyConstants.NAME,
+ policyIntent.getName().getPrefix() + COLON + policyIntent.getName().getLocalPart());
+ if (policyIntent instanceof ProfileIntent) {
+ ProfileIntent profileIntent = (ProfileIntent)policyIntent;
+ if (profileIntent.getRequiredIntents() != null &&
+ profileIntent.getRequiredIntents().size() > 0) {
+ StringBuffer sb = new StringBuffer();
+ for (Intent requiredIntents : profileIntent.getRequiredIntents()) {
+ sb.append(requiredIntents.getName());
+ sb.append(" ");
+ }
+ writer.writeAttribute(PolicyConstants.REQUIRES, sb.toString());
+ }
+ }
+ else {
+ if (policyIntent.getExcludedIntents() != null &&
+ policyIntent.getExcludedIntents().size() > 0) {
+ StringBuffer sb = new StringBuffer();
+ for (Intent excludedIntents : policyIntent.getExcludedIntents()) {
+ sb.append(excludedIntents.getName());
+ sb.append(" ");
+ }
+ writer.writeAttribute(PolicyConstants.EXCLUDES, sb.toString());
+ }
+ }
+
+ if (!(policyIntent instanceof QualifiedIntent) ) {
+ if (policyIntent.getConstrains() != null &&
+ policyIntent.getConstrains().size() > 0) {
+ StringBuffer sb = new StringBuffer();
+ for (QName contrainedArtifact : policyIntent.getConstrains()) {
+ sb.append(contrainedArtifact.toString());
+ sb.append(" ");
+ }
+ writer.writeAttribute(CONSTRAINS, sb.toString());
+ } else {
+ error("ContrainsAttributeMissing", policyIntent, policyIntent.getName());
+ //throw new ContributionWriteException("Contrains attribute missing from " +
+ //"Policy Intent Definition" + policyIntent.getName());
+ }
+ }
+
+ if ( policyIntent.getDescription() != null && policyIntent.getDescription().length() > 0) {
+ writer.writeStartElement(PolicyConstants.SCA10_NS, DESCRIPTION);
+ writer.writeCData(policyIntent.getDescription());
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ }
+
+ //FIXME This method is never used
+// private Intent resolveRequiredIntents(ProfileIntent policyIntent, ModelResolver resolver) throws ContributionResolveException {
+// boolean isUnresolved = false;
+// //FIXME: Need to check for cyclic references first i.e an A requiring B and then B requiring A...
+// if (policyIntent != null && policyIntent.isUnresolved()) {
+//
+// //resolve all required intents
+// List<Intent> requiredIntents = new ArrayList<Intent>();
+// for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
+// if ( requiredIntent.isUnresolved() ) {
+// //policyIntent.getRequiredIntents().remove(requiredIntent);
+// requiredIntent = resolver.resolveModel(Intent.class, requiredIntent);
+// requiredIntents.add(requiredIntent);
+// if (requiredIntent.isUnresolved()) {
+// isUnresolved = true;
+// }
+// }
+// }
+// policyIntent.getRequiredIntents().clear();
+// policyIntent.getRequiredIntents().addAll(requiredIntents);
+// }
+// policyIntent.setUnresolved(isUnresolved);
+//
+// return policyIntent;
+// }
+
+ //FIXME This method is never used
+// private Intent resolveQualifiableIntent(QualifiedIntent policyIntent, ModelResolver resolver) throws ContributionResolveException {
+// boolean isUnresolved = false;
+//
+// if (policyIntent != null && policyIntent.isUnresolved()) {
+// //resolve the qualifiable intent
+// Intent qualifiableIntent =
+// resolver.resolveModel(Intent.class, policyIntent.getQualifiableIntent());
+// policyIntent.setQualifiableIntent(qualifiableIntent);
+// isUnresolved = qualifiableIntent.isUnresolved();
+// }
+// policyIntent.setUnresolved(isUnresolved);
+//
+// return policyIntent;
+// }
+
+ private void resolveContrainedArtifacts(Intent policyIntent, ModelResolver resolver) {
+ //FIXME : need to figure out this resolution.
+ policyIntent.setUnresolved(false);
+ }
+
+ private void resolveProfileIntent(ProfileIntent policyIntent, ModelResolver resolver)
+ throws ContributionResolveException {
+ // FIXME: Need to check for cyclic references first i.e an A requiring B
+ // and then B requiring A...
+ if (policyIntent != null) {
+ // resolve all required intents
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
+ if (requiredIntent.isUnresolved()) {
+ Intent resolvedRequiredIntent = resolver.resolveModel(Intent.class, requiredIntent);
+ // At this point, when the required intent is not resolved, it does not mean
+ // its undeclared, chances are that their dependency are not resolved yet.
+ // Lets try to resolve them first.
+ if (resolvedRequiredIntent.isUnresolved()) {
+ if (resolvedRequiredIntent instanceof ProfileIntent) {
+ if ((((ProfileIntent)resolvedRequiredIntent).getRequiredIntents()).contains(policyIntent)) {
+ error("CyclicReferenceFound", resolver, requiredIntent, policyIntent);
+ return;
+ }
+ resolveDependent(resolvedRequiredIntent, resolver);
+ }
+ }
+
+ if (!resolvedRequiredIntent.isUnresolved()) {
+ requiredIntents.add(resolvedRequiredIntent);
+ } else {
+ error("RequiredIntentNotFound", resolver, requiredIntent, policyIntent);
+ return;
+ //throw new ContributionResolveException("Required Intent - " + requiredIntent
+ //+ " not found for ProfileIntent " + policyIntent);
+ }
+ } else {
+ requiredIntents.add(requiredIntent);
+ }
+ }
+ policyIntent.getRequiredIntents().clear();
+ policyIntent.getRequiredIntents().addAll(requiredIntents);
+ }
+ }
+
+ private void resolveQualifiedIntent(QualifiedIntent policyIntent, ModelResolver resolver)
+ throws ContributionResolveException {
+ if (policyIntent != null) {
+ //resolve the qualifiable intent
+ Intent qualifiableIntent = policyIntent.getQualifiableIntent();
+ if (qualifiableIntent.isUnresolved()) {
+ Intent resolvedQualifiableIntent = resolver.resolveModel(Intent.class, qualifiableIntent);
+ // At this point, when the qualifiable intent is not resolved, it does not mean
+ // its undeclared, chances are that their dependency are not resolved yet.
+ // Lets try to resolve them first.
+ if (resolvedQualifiableIntent.isUnresolved()) {
+ if (resolvedQualifiableIntent instanceof QualifiedIntent) {
+ resolveDependent(resolvedQualifiableIntent, resolver);
+ }
+ }
+
+ if (!resolvedQualifiableIntent.isUnresolved()) {
+ policyIntent.setQualifiableIntent(resolvedQualifiableIntent);
+ } else {
+ error("QualifiableIntentNotFound", resolver, qualifiableIntent, policyIntent);
+ //throw new ContributionResolveException("Qualifiable Intent - " + qualifiableIntent
+ //+ " not found for QualifiedIntent " + policyIntent);
+ }
+ }
+ }
+ }
+
+ public void resolveDependent(Intent policyIntent, ModelResolver resolver) throws ContributionResolveException {
+ if (policyIntent instanceof ProfileIntent)
+ resolveProfileIntent((ProfileIntent)policyIntent, resolver);
+
+ if (policyIntent instanceof QualifiedIntent)
+ resolveQualifiedIntent((QualifiedIntent)policyIntent, resolver);
+
+ resolveContrainedArtifacts(policyIntent, resolver);
+ }
+
+ public void resolve(T policyIntent, ModelResolver resolver) throws ContributionResolveException {
+ if (policyIntent instanceof ProfileIntent) {
+ resolveProfileIntent((ProfileIntent)policyIntent, resolver);
+ }
+ else {
+ resolveExcludedIntents(policyIntent, resolver);
+ }
+
+ if (policyIntent instanceof QualifiedIntent) {
+ resolveQualifiedIntent((QualifiedIntent)policyIntent, resolver);
+ }
+
+ resolveContrainedArtifacts(policyIntent, resolver);
+
+ /* This is too late in the processing
+ if ( !policyIntent.isUnresolved() ) {
+ resolver.addModel(policyIntent);
+ }
+ */
+ }
+
+ public QName getArtifactType() {
+ return POLICY_INTENT_QNAME;
+ }
+
+ private void readConstrainedArtifacts(Intent policyIntent, XMLStreamReader reader) throws ContributionReadException {
+ String value = reader.getAttributeValue(null, CONSTRAINS);
+ if ( policyIntent instanceof QualifiedIntent && value != null) {
+ error("ErrorInPolicyIntentDefinition", policyIntent, policyIntent.getName(), QUALIFIED_INTENT_CONSTRAINS_ERROR);
+ //String errorMsg = "Error in PolicyIntent Definition - " + policyIntent.getName() + QUALIFIED_INTENT_CONSTRAINS_ERROR;
+ //throw new ContributionReadException(errorMsg);
+ } else {
+ if (value != null) {
+ List<QName> constrainedArtifacts = policyIntent.getConstrains();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ constrainedArtifacts.add(qname);
+ }
+ }
+ }
+ }
+
+ private void readRequiredIntents(ProfileIntent policyIntent, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, REQUIRES);
+ if (value != null) {
+ List<Intent> requiredIntents = policyIntent.getRequiredIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ intent.setUnresolved(true);
+ requiredIntents.add(intent);
+ }
+ }
+ }
+
+ private void readExcludedIntents(Intent policyIntent, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, "excludes");
+ if (value != null) {
+ List<Intent> excludedIntents = policyIntent.getExcludedIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ intent.setUnresolved(true);
+ excludedIntents.add(intent);
+ }
+ }
+ }
+
+ private void resolveExcludedIntents(Intent policyIntent, ModelResolver resolver)
+ throws ContributionResolveException {
+ if (policyIntent != null) {
+ // resolve all excluded intents
+ List<Intent> excludedIntents = new ArrayList<Intent>();
+ for (Intent excludedIntent : policyIntent.getExcludedIntents()) {
+ if (excludedIntent.isUnresolved()) {
+ Intent resolvedExcludedIntent = resolver.resolveModel(Intent.class, excludedIntent);
+ if (!resolvedExcludedIntent.isUnresolved()) {
+ excludedIntents.add(resolvedExcludedIntent);
+ } else {
+ error("ExcludedIntentNotFound", resolver, excludedIntent, policyIntent);
+ return;
+ //throw new ContributionResolveException("Excluded Intent " + excludedIntent
+ //+ " not found for intent " + policyIntent);
+ }
+ } else {
+ excludedIntents.add(excludedIntent);
+ }
+ }
+ policyIntent.getExcludedIntents().clear();
+ policyIntent.getExcludedIntents().addAll(excludedIntents);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
new file mode 100644
index 0000000000..81ca27a085
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
@@ -0,0 +1,487 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+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 javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+
+/**
+ * Processor for handling XML models of PolicySet definitions
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<PolicySet>, PolicyConstants {
+
+ private PolicyFactory policyFactory;
+ private StAXArtifactProcessor<Object> extensionProcessor;
+ private XPathFactory xpathFactory = XPathFactory.newInstance();
+ private Monitor monitor;
+
+ public PolicySetProcessor(ModelFactoryExtensionPoint modelFactories,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ Monitor monitor) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.extensionProcessor = extensionProcessor;
+ this.monitor = monitor;
+ }
+
+ public PolicySetProcessor(PolicyFactory policyFactory,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ Monitor monitor) {
+ this.policyFactory = policyFactory;
+ this.extensionProcessor = extensionProcessor;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "policy-xml-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "policy-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ public PolicySet read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ PolicySet policySet = null;
+
+ String policySetName = reader.getAttributeValue(null, NAME);
+ String appliesTo = reader.getAttributeValue(null, APPLIES_TO);
+ if (policySetName == null || appliesTo == null) {
+ if (policySetName == null)
+ error("PolicySetNameMissing", reader);
+ if (appliesTo == null)
+ error("PolicySetAppliesToMissing", reader);
+ return policySet;
+ }
+
+ policySet = policyFactory.createPolicySet();
+ policySet.setName(new QName(policySetName));
+ String alwaysAppliesTo = reader.getAttributeValue(TUSCANY_NS, ALWAYS_APPLIES_TO);
+
+ //TODO: with 1.0 version of specs the applies to xpath is given related to the immediate
+ //parent whereas the runtime evaluates the xpath aginst the composite element. What the runtime
+ //is doing is what the future version of the specs could be tending towards. When that happens
+ //this 'if' must be deleted
+ if ( appliesTo != null && !appliesTo.startsWith("/") ) {
+ appliesTo = "//" + appliesTo;
+ }
+
+ if ( alwaysAppliesTo != null && !alwaysAppliesTo.startsWith("/") ) {
+ alwaysAppliesTo = "//" + alwaysAppliesTo;
+ }
+
+ policySet.setAppliesTo(appliesTo);
+ policySet.setAlwaysAppliesTo(alwaysAppliesTo);
+
+ XPath path = xpathFactory.newXPath();
+ path.setNamespaceContext(reader.getNamespaceContext());
+ try {
+ if (appliesTo != null) {
+ policySet.setAppliesToXPathExpression(path.compile(appliesTo));
+ }
+ if (alwaysAppliesTo != null) {
+ policySet.setAlwaysAppliesToXPathExpression(path.compile(alwaysAppliesTo));
+ }
+ } catch (XPathExpressionException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", policySet, ce);
+ //throw ce;
+ }
+
+ readProvidedIntents(policySet, reader);
+
+ int event = reader.getEventType();
+ QName name = null;
+ reader.next();
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
+ Intent mappedIntent = policyFactory.createIntent();
+ String provides = reader.getAttributeValue(null, PROVIDES);
+ if (provides != null) {
+ mappedIntent.setName(getQName(reader, PROVIDES));
+ if ( policySet.getProvidedIntents().contains(mappedIntent) ) {
+ readIntentMap(reader, policySet, mappedIntent);
+ } else {
+ error("IntentNotSpecified", policySet, policySetName);
+ //throw new ContributionReadException("Intent Map provides for Intent not specified as provided by parent PolicySet - " + policySetName);
+ }
+ } else {
+ error("IntentMapProvidesMissing", reader, policySetName);
+ }
+ } else if ( POLICY_SET_REFERENCE_QNAME.equals(name) ) {
+ PolicySet referredPolicySet = policyFactory.createPolicySet();
+ String referencename = reader.getAttributeValue(null, NAME);
+ if (referencename != null) {
+ referredPolicySet.setName(getQName(reader, NAME));
+ policySet.getReferencedPolicySets().add(referredPolicySet);
+ } else {
+ error("PolicySetReferenceNameMissing", reader, policySetName);
+ }
+ } /*else if ( WS_POLICY_QNAME.equals(name) ) {
+ OMElement policyElement = loadElement(reader);
+ org.apache.neethi.Policy wsPolicy = PolicyEngine.getPolicy(policyElement);
+ policySet.getPolicies().add(wsPolicy);
+ } */ else {
+ Object extension = extensionProcessor.read(reader);
+ if ( extension != null ) {
+ policySet.getPolicies().add(extension);
+ }
+ }
+ break;
+ }
+ }
+ if ( event == END_ELEMENT ) {
+ if ( POLICY_SET_QNAME.equals(reader.getName()) ) {
+ break;
+ }
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return policySet;
+ }
+
+
+ public void readIntentMap(XMLStreamReader reader, PolicySet policySet, Intent mappedIntent) throws ContributionReadException {
+ QName name = reader.getName();
+ Map<Intent, List<Object>> mappedPolicies = policySet.getMappedPolicies();
+ if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
+ //Intent mappedIntent = policyFactory.createIntent();
+ //mappedIntent.setName(getQName(reader, PROVIDES));
+ String defaultQualifier = getString(reader, DEFAULT);
+
+ String qualifierName = null;
+ String qualfiedIntentName = null;
+ Intent qualifiedIntent = null;
+
+ int event = reader.getEventType();
+ try {
+ reader.next();
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if ( POLICY_INTENT_MAP_QUALIFIER_QNAME.equals(name)) {
+ qualifierName = getString(reader, NAME);
+ if (qualifierName != null) {
+ qualfiedIntentName = mappedIntent.getName().getLocalPart() +
+ QUALIFIER + qualifierName;
+ qualifiedIntent = policyFactory.createIntent();
+ qualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
+ qualfiedIntentName));
+ } else {
+ error("QualifierNameMissing", reader, policySet.getName());
+ }
+ } else if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
+ QName providedIntent = getQName(reader, PROVIDES);
+ if ( qualifierName.equals(providedIntent.getLocalPart()) ) {
+ readIntentMap(reader, policySet, qualifiedIntent);
+ } else {
+ error("IntentMapDoesNotMatch", providedIntent, providedIntent, qualifierName, policySet);
+ //throw new ContributionReadException("Intent provided by IntentMap " +
+ //providedIntent + " does not match parent qualifier " + qualifierName +
+ //" in policyset - " + policySet);
+ }
+ }/* else if ( WS_POLICY_QNAME.equals(name) ) {
+ OMElement policyElement = loadElement(reader);
+ Policy wsPolicy = PolicyEngine.getPolicy(policyElement);
+ policySet.getPolicies().add(wsPolicy);
+
+ List<Object> policyList = mappedPolicies.get(qualifiedIntent);
+ if ( policyList == null ) {
+ policyList = new ArrayList<Object>();
+ mappedPolicies.put(qualifiedIntent, policyList);
+
+ if (qualifierName.equals(defaultQualifier)) {
+ mappedPolicies.put(mappedIntent, policyList);
+ }
+ }
+ policyList.add((Policy)wsPolicy);
+ }*/ else {
+ Object extension = extensionProcessor.read(reader);
+ if ( extension != null && qualifiedIntent != null) {
+ List<Object> policyList = mappedPolicies.get(qualifiedIntent);
+ if ( policyList == null ) {
+ policyList = new ArrayList<Object>();
+ mappedPolicies.put(qualifiedIntent, policyList);
+
+ if (qualifierName.equals(defaultQualifier)) {
+ mappedPolicies.put(mappedIntent, policyList);
+ }
+ }
+ policyList.add(extension);
+ }
+ }
+ break;
+ }
+ case END_ELEMENT : {
+ if ( POLICY_INTENT_MAP_QNAME.equals(reader.getName()) ) {
+ if ( defaultQualifier != null ) {
+ String qualifiedIntentName = mappedIntent.getName().getLocalPart() + QUALIFIER + defaultQualifier;
+ Intent defaultQualifiedIntent = policyFactory.createIntent();
+ defaultQualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
+ qualifiedIntentName));
+ List<Object> policyList = mappedPolicies.get(defaultQualifiedIntent);
+ if ( policyList != null ) {
+ mappedPolicies.put(mappedIntent, policyList);
+ } else {
+ error("UnableToMapPolicies", mappedPolicies, mappedIntent, policySet);
+ //throw new ContributionReadException("Unable to map policies for default qualifier in IntentMap for - " +
+ //mappedIntent + " in policy set - " + policySet);
+ }
+ defaultQualifier = null;
+ }
+ }
+ break;
+ }
+ }
+ if ( event == END_ELEMENT && POLICY_INTENT_MAP_QNAME.equals(reader.getName()) ) {
+ break;
+ }
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ } catch (XMLStreamException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ error("ContributionReadException", reader, ce);
+ throw ce;
+ }
+ }
+ }
+
+ public void write(PolicySet policySet, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write an <sca:policySet>
+ writer.writeStartElement(SCA10_NS, POLICY_SET);
+ writer.writeNamespace(policySet.getName().getPrefix(), policySet.getName().getNamespaceURI());
+ writer.writeAttribute(NAME,
+ policySet.getName().getPrefix() + COLON + policySet.getName().getLocalPart());
+ writer.writeAttribute(APPLIES_TO, policySet.getAppliesTo());
+ writer.writeAttribute(TUSCANY_NS, ALWAYS_APPLIES_TO, policySet.getAlwaysAppliesTo());
+
+ writeProvidedIntents(policySet, writer);
+
+ writer.writeEndElement();
+ }
+
+ private void readProvidedIntents(PolicySet policySet, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, PROVIDES);
+ if (value != null) {
+ List<Intent> providedIntents = policySet.getProvidedIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ providedIntents.add(intent);
+ }
+ }
+ }
+
+ private void writeProvidedIntents(PolicySet policySet, XMLStreamWriter writer) throws XMLStreamException {
+ if (policySet.getProvidedIntents() != null &&
+ policySet.getProvidedIntents().size() > 0) {
+ StringBuffer sb = new StringBuffer();
+ for (Intent providedIntents : policySet.getProvidedIntents()) {
+ sb.append(providedIntents.getName());
+ sb.append(" ");
+ }
+ writer.writeAttribute(PolicyConstants.PROVIDES, sb.toString());
+ }
+ }
+
+ private void resolvePolicies(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+ boolean unresolved = false;
+ if (policySet != null) {
+ for ( Object o : policySet.getPolicies() ) {
+ extensionProcessor.resolve(o, resolver);
+ /*if ( o instanceof Policy && ((Policy)o).isUnresolved() ) {
+ unresolved = true;
+ }*/
+ }
+ policySet.setUnresolved(unresolved);
+ }
+ }
+
+
+
+ public QName getArtifactType() {
+ return POLICY_SET_QNAME;
+ }
+
+ public Class<PolicySet> getModelType() {
+ return PolicySet.class;
+ }
+
+ private void resolveProvidedIntents(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+ if (policySet != null) {
+ //resolve all provided intents
+ List<Intent> providedIntents = new ArrayList<Intent>();
+ for (Intent providedIntent : policySet.getProvidedIntents()) {
+ if (providedIntent.isUnresolved()) {
+ Intent resolvedProvidedIntent = resolver.resolveModel(Intent.class, providedIntent);
+ if (!resolvedProvidedIntent.isUnresolved()) {
+ providedIntents.add(resolvedProvidedIntent);
+ } else {
+ error("ProvidedIntentNotFound", policySet, providedIntent, policySet);
+ return;
+ //throw new ContributionResolveException("Provided Intent - " + providedIntent
+ //+ " not found for PolicySet " + policySet);
+ }
+ } else {
+ providedIntents.add(providedIntent);
+ }
+ }
+ policySet.getProvidedIntents().clear();
+ policySet.getProvidedIntents().addAll(providedIntents);
+ }
+ }
+
+ private void resolveIntentsInMappedPolicies(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+ Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
+ for (Map.Entry<Intent, List<Object>> entry : policySet.getMappedPolicies().entrySet()) {
+ Intent mappedIntent = entry.getKey();
+ if (mappedIntent.isUnresolved()) {
+ Intent resolvedMappedIntent = resolver.resolveModel(Intent.class, mappedIntent);
+ if (!resolvedMappedIntent.isUnresolved()) {
+ mappedPolicies.put(resolvedMappedIntent, entry.getValue());
+ } else {
+ error("MappedIntentNotFound", policySet, mappedIntent, policySet);
+ return;
+ //throw new ContributionResolveException("Mapped Intent - " + mappedIntent
+ //+ " not found for PolicySet " + policySet);
+ }
+ } else {
+ mappedPolicies.put(mappedIntent, entry.getValue());
+ }
+ }
+
+ policySet.getMappedPolicies().clear();
+ policySet.getMappedPolicies().putAll(mappedPolicies);
+ }
+
+ private void resolveReferredPolicySets(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+
+ List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
+ for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
+ if (referredPolicySet.isUnresolved()) {
+ PolicySet resolvedReferredPolicySet = resolver.resolveModel(PolicySet.class, referredPolicySet);
+ if (!resolvedReferredPolicySet.isUnresolved()) {
+ referredPolicySets.add(resolvedReferredPolicySet);
+ } else {
+ error("ReferredPolicySetNotFound", policySet, referredPolicySet, policySet);
+ return;
+ //throw new ContributionResolveException("Referred PolicySet - " + referredPolicySet
+ //+ "not found for PolicySet - " + policySet);
+ }
+ } else {
+ referredPolicySets.add(referredPolicySet);
+ }
+ }
+ policySet.getReferencedPolicySets().clear();
+ policySet.getReferencedPolicySets().addAll(referredPolicySets);
+ }
+
+ private void includeReferredPolicySets(PolicySet policySet, PolicySet referredPolicySet) {
+ for (PolicySet furtherReferredPolicySet : referredPolicySet.getReferencedPolicySets()) {
+ includeReferredPolicySets(referredPolicySet, furtherReferredPolicySet);
+ }
+ policySet.getPolicies().addAll(referredPolicySet.getPolicies());
+ policySet.getMappedPolicies().putAll(referredPolicySet.getMappedPolicies());
+ }
+
+ public void resolve(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+ resolveProvidedIntents(policySet, resolver);
+ resolveIntentsInMappedPolicies(policySet, resolver);
+ resolveReferredPolicySets(policySet, resolver);
+
+ for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
+ includeReferredPolicySets(policySet, referredPolicySet);
+ }
+
+ if ( policySet.isUnresolved() ) {
+ //resolve the policy attachments
+ resolvePolicies(policySet, resolver);
+
+ /*if ( !policySet.isUnresolved() ) {
+ resolver.addModel(policySet);
+ }*/
+ }
+ }
+ }
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.java
new file mode 100644
index 0000000000..7c205292b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.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.xml;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+
+/**
+ * Processor for handling XML models of PolicyIntent definitions that are ProfileIntents
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProfileIntentProcessor extends PolicyIntentProcessor<ProfileIntent> {
+
+ public ProfileIntentProcessor(PolicyFactory policyFactory, Monitor monitor) {
+ super(policyFactory, monitor);
+ }
+
+ public ProfileIntentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ super(modelFactories, monitor);
+ }
+
+ public Class<ProfileIntent> getModelType() {
+ return ProfileIntent.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.java
new file mode 100644
index 0000000000..abe80e2a54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.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.xml;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Processor for handling XML models of PolicyIntent definitions that are QualifiedIntents
+ *
+ * @version $Rev$ $Date$
+ */
+public class QualifiedIntentProcessor extends PolicyIntentProcessor<QualifiedIntent> {
+
+ public QualifiedIntentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ super(modelFactories, monitor);
+ }
+
+ public QualifiedIntentProcessor(PolicyFactory policyFactory, Monitor monitor) {
+ super(policyFactory, monitor);
+ }
+
+ public Class<QualifiedIntent> getModelType() {
+ return QualifiedIntent.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.java
new file mode 100644
index 0000000000..73795349c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.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.xml;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Processor for handling XML models of PolicyIntent definitions
+ *
+ * @version $Rev$ $Date$
+ */
+public class SimpleIntentProcessor extends PolicyIntentProcessor<Intent> {
+
+ public SimpleIntentProcessor(PolicyFactory policyFactory, Monitor monitor) {
+ super(policyFactory, monitor);
+ }
+
+ public SimpleIntentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ super(modelFactories, monitor);
+ }
+
+ public Class<Intent> getModelType() {
+ return Intent.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..c41a0cd01f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -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.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.policy.xml.BindingTypeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#bindingType,model=org.apache.tuscany.sca.policy.IntentAttachPointType
+org.apache.tuscany.sca.policy.xml.ImplementationTypeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementationType,model=org.apache.tuscany.sca.policy.IntentAttachPointType
+org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#intent,model=org.apache.tuscany.sca.policy.Intent
+org.apache.tuscany.sca.policy.xml.PolicySetProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#policySet,model=org.apache.tuscany.sca.policy.PolicySet
+org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#intent,model=org.apache.tuscany.sca.policy.ProfileIntent
+org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#intent,model=org.apache.tuscany.sca.policy.QualifiedIntent
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
new file mode 100644
index 0000000000..40107bb11e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
@@ -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.
+#
+#
+ReferredPolicySetNotFound = Referred PolicySet - {0} not found for PolicySet - {1}
+MappedIntentNotFound = Mapped Intent - {0} not found for PolicySet {1}
+ProvidedIntentNotFound = Provided Intent - {0} not found for PolicySet {1}
+UnableToMapPolicies = Unable to map policies for default qualifier in IntentMap for - {0} in policy set - {1}
+IntentMapDoesNotMatch = Intent provided by IntentMap {0} does not match parent qualifier {1} in policyset - {2}
+IntentNotSpecified = Intent Map provides for Intent not specified as provided by parent PolicySet - {0}
+ContrainsAttributeMissing = Constrains attribute missing from Policy Intent Definition {0}
+RequiredIntentNotFound = Required Intent - {0} not found for ProfileIntent {1}
+QualifiableIntentNotFound = Qualifiable Intent - {0} not found for QualifiedIntent {1}
+ErrorInPolicyIntentDefinition = Error in PolicyIntent Definition - {0} {1}
+ExcludedIntentNotFound = Excluded Intent {0} not found for intent {1}
+UnrecognizedIntentAttachPointType = Unrecognized IntentAttachPointType - {0}
+RequiredAttributeMissing = Required attribute {0} missing from BindingType Definition
+AlwaysProvidedIntentNotFound = Always Provided Intent - {0} not found for ExtensionType {1}
+MayProvideIntentNotFound = May Provide Intent - {0} not found for ExtensionType {1}
+ContributionReadException = ContributionReadException occurred due to: {0}
+CyclicReferenceFound = Cyclic reference detected in required attributes of ProfileIntents {0} and {1}
+IntentNameMissing = Required attribute "name" missing for Intent Definition
+PolicySetReferenceNameMissing = Required attribute "name" missing for PolicySetReference in PolicySet : {0}
+PolicySetNameMissing = Required attribute "name" missing for PolicySet Definition
+PolicySetAppliesToMissing = Required attribute "appliesTo" missing for PolicySet Definition
+IntentMapProvidesMissing = Required attribute "provides" missing for IntentMap in PolicySet : {0}
+QualifierNameMissing = Required attribute "name" missing for qualifier definition in PolicySet : {0}
+
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
new file mode 100644
index 0000000000..c9fad18157
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
@@ -0,0 +1,280 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.xml;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
+import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev: 551296 $ $Date: 2007-06-28 01:18:35 +0530 (Thu, 28 Jun 2007) $
+ */
+public class ReadDocumentTestCase extends TestCase {
+
+ private ModelResolver resolver;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private Monitor monitor;
+
+ private static final QName elementToProcess = new QName("http://www.osoa.org/xmlns/sca/1.0", "implementationType");
+
+ private Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
+ private Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
+ private Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
+ private Map<QName, IntentAttachPointType> implTypesTable = new Hashtable<QName, IntentAttachPointType>();
+ private static final String scaNamespace = "http://www.osoa.org/xmlns/sca/1.0";
+ private static final String namespace = "http://test";
+
+ private static final QName confidentiality = new QName(namespace, "confidentiality");
+ private static final QName integrity = new QName(namespace, "integrity");
+ private static final QName messageProtection = new QName(namespace, "messageProtection");
+ private static final QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
+ private static final QName confidentiality_message = new QName(namespace, "confidentiality.message");
+ private static final QName secureReliablePolicy = new QName(namespace, "SecureReliablePolicy");
+ private static final QName secureMessagingPolicies = new QName(namespace, "SecureMessagingPolicies");
+ private static final QName securityPolicy = new QName(namespace, "SecurityPolicy");
+ private static final QName basicAuthMsgProtSecurity = new QName(namespace, "BasicAuthMsgProtSecurity");
+ private static final QName wsBinding = new QName(scaNamespace, "binding.ws");
+ private static final QName javaImpl = new QName(scaNamespace, "implementation.java");
+
+
+ @Override
+ public void setUp() throws Exception {
+ DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+ resolver = new DefaultModelResolver();
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ if (monitorFactory != null) {
+ monitor = monitorFactory.createMonitor();
+ utilities.addUtility(monitorFactory);
+ }
+ StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
+ staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
+
+ URL url = getClass().getResource("test_definitions.xml");
+ InputStream urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+ reader.next();
+
+ //position on the right element qname to get processed
+ while(reader.hasNext()) {
+ reader.next();
+ int event = reader.getEventType();
+ if(event == START_ELEMENT && reader.getName().equals(elementToProcess)) {
+ break;
+ }
+ }
+ while ( true ) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT: {
+ Object artifact = staxProcessor.read(reader);
+ if ( artifact instanceof PolicySet ) {
+ PolicySet policySet = (PolicySet)artifact;
+ policySet.setName(new QName(namespace, policySet.getName().getLocalPart()));
+ policySetTable.put(policySet.getName(), policySet);
+ } else if ( artifact instanceof Intent ) {
+ Intent intent = (Intent)artifact;
+ intent.setName(new QName(namespace, intent.getName().getLocalPart()));
+ if ( intent instanceof QualifiedIntent ) {
+ ((QualifiedIntent)intent).getQualifiableIntent().
+ setName(new QName(namespace,
+ ((QualifiedIntent)intent).getQualifiableIntent().getName().getLocalPart()));
+ }
+ intentTable.put(intent.getName(), intent);
+ } else if ( artifact instanceof BindingTypeImpl ) {
+ IntentAttachPointType bindingType = (IntentAttachPointType)artifact;
+ bindingTypesTable.put(bindingType.getName(), bindingType);
+ } else if ( artifact instanceof ImplementationTypeImpl ) {
+ IntentAttachPointType implType = (IntentAttachPointType)artifact;
+ implTypesTable.put(implType.getName(), implType);
+ }
+
+ if ( artifact != null ) {
+ resolver.addModel(artifact);
+ }
+
+ break;
+ }
+ }
+ if ( reader.hasNext() ) {
+ reader.next();
+ } else {
+ break;
+ }
+ }
+ urlStream.close();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadSCADefinitions() throws Exception {
+ assertNotNull(intentTable.get(confidentiality));
+ assertNotNull(intentTable.get(messageProtection));
+ assertNotNull(intentTable.get(confidentiality_transport));
+ assertTrue(intentTable.get(confidentiality).getDescription().length() > 0 );
+
+ assertNotNull(policySetTable.get(secureReliablePolicy));
+ assertTrue(policySetTable.get(secureReliablePolicy).getProvidedIntents().size() == 2);
+ assertTrue(policySetTable.get(secureReliablePolicy).getPolicies().size() == 2);
+
+ assertNotNull(policySetTable.get(secureMessagingPolicies));
+ assertEquals(policySetTable.get(secureMessagingPolicies).getMappedPolicies().size(), 3);
+
+ assertEquals(bindingTypesTable.size(), 1);
+ assertNotNull(bindingTypesTable.get(wsBinding));
+ assertEquals(implTypesTable.size(), 1);
+ assertNotNull(implTypesTable.get(javaImpl));
+ }
+
+ public void testResolution() throws Exception {
+ assertTrue(intentTable.get(messageProtection) instanceof ProfileIntent);
+ ProfileIntent profileIntent = (ProfileIntent)intentTable.get(new QName(namespace, "messageProtection"));
+ assertNull(profileIntent.getRequiredIntents().get(0).getDescription());
+
+ QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
+ assertTrue(intentTable.get(confidentiality_transport) instanceof QualifiedIntent);
+ QualifiedIntent qualifiedIntent = (QualifiedIntent)intentTable.get(new QName(namespace, "confidentiality.transport"));
+ assertNull(qualifiedIntent.getQualifiableIntent().getDescription());
+
+ PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
+ PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
+ PolicySet securityPolicySet = policySetTable.get(securityPolicy);
+
+ assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
+ assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
+ assertTrue(secureMessagingPolicySet.isUnresolved());
+ assertEquals(securityPolicySet.getMappedPolicies().size(), 5);
+
+ //testing to ensure that inclusion of referred policy sets has not happened
+ PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
+ assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
+ assertTrue(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
+
+ IntentAttachPointType wsBindingType = bindingTypesTable.get(wsBinding);
+ assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
+
+ IntentAttachPointType javaImplType = implTypesTable.get(javaImpl);
+ assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
+
+ List<Intent> simpleIntents = new ArrayList<Intent>();
+ List<ProfileIntent> profileIntents = new ArrayList<ProfileIntent>();
+ List<QualifiedIntent> qualifiedIntents = new ArrayList<QualifiedIntent>();
+
+ for (Intent intent : intentTable.values()) {
+ if (intent instanceof ProfileIntent)
+ profileIntents.add((ProfileIntent)intent);
+ else if (intent instanceof QualifiedIntent)
+ qualifiedIntents.add((QualifiedIntent)intent);
+ else simpleIntents.add(intent);
+ }
+
+ for (Intent intent : simpleIntents)
+ staxProcessor.resolve(intent, resolver);
+
+ for (ProfileIntent intent : profileIntents)
+ staxProcessor.resolve(intent, resolver);
+
+ for (QualifiedIntent intent : qualifiedIntents)
+ staxProcessor.resolve(intent, resolver);
+
+ for ( PolicySet policySet : policySetTable.values() ) {
+ if (policySet.getReferencedPolicySets().isEmpty())
+ staxProcessor.resolve(policySet, resolver);
+ }
+
+ for ( PolicySet policySet : policySetTable.values() ) {
+ if (!policySet.getReferencedPolicySets().isEmpty())
+ staxProcessor.resolve(policySet, resolver);
+ }
+
+ for ( IntentAttachPointType bindingType : bindingTypesTable.values() ) {
+ staxProcessor.resolve(bindingType, resolver);
+ }
+
+ for ( IntentAttachPointType implType : implTypesTable.values() ) {
+ staxProcessor.resolve(implType, resolver);
+ }
+
+ //testing if policy intents have been linked have property been linked up
+ assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
+ assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
+ assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
+ assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
+
+ //testing if policysets have been properly linked up with intents
+ assertFalse(secureMessagingPolicySet.isUnresolved());
+ assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
+ assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
+
+ //testing if intent maps have been properly mapped to policies
+ assertFalse(securityPolicySet.isUnresolved());
+ assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
+ assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_message)));
+
+ //testing for inclusion of referred policysets
+ assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
+ assertFalse(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
+ assertNotNull(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
+
+ assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNotNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
+
+ assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNotNull(javaImplType.getMayProvideIntents().get(0).getDescription());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java
new file mode 100644
index 0000000000..ce5b204787
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.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.policy.xml;
+
+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.sca.policy.Policy;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestPolicyProcessor implements StAXArtifactProcessor<Policy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
+ return new MockPolicyImplOne();
+ }
+
+ public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<Policy> getModelType() {
+ // TODO Auto-generated method stub
+ return Policy.class;
+ }
+
+ public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+
+ public class MockPolicyImplOne implements Policy {
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
new file mode 100644
index 0000000000..b51a6fba98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
@@ -0,0 +1,255 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- Extension Types Metadata -->
+<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
+ mayProvide="test:integrity"/>
+
+<!-- Intents and Policysets to assume targetnamespace -->
+<intent name="TestIntentOne"
+ constrains="sca:binding">
+ <description>
+ Test Intent
+ </description>
+ </intent>
+
+ <intent name="TestIntentTwo"
+ constrains="sca:binding"
+ requires="test:TestIntentOne">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <policySet name="TestPolicySetOne"
+ provides="test:TestIntentOne"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+
+ <!-- qualified intents -->
+ <intent name="confidentiality.transport" />
+ <intent name="confidentiality.message" />
+ <intent name="confidentiality.message.whole" />
+ <intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <policySet name="SecureReliablePolicy"
+ provides="test:confidentiality.transport test:integrity"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+ <policySet name="SecureMessagingPolicies"
+ provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="test:confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport" alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message" alternative" -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="SecurityPolicy"
+ provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <intentMap provides="test:confidentiality" default="message">
+ <qualifier name="message">
+ <intentMap provides="message" default="whole">
+ <qualifier name="body">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for body encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="whole">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for whole message encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+ </qualifier>
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for transport encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="BasicAuthMsgProtSecurity"
+ provides="test:authentication test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <policySetReference name="test:AuthenticationPolicies"/>
+ <policySetReference name="test:ConfidentialityPolicies"/>
+</policySet>
+
+<policySet name="AuthenticationPolicies"
+ provides="test:authentication"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</policySet>
+
+<policySet name="ConfidentialityPolicies"
+ provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="test:confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="SecureWSPolicy"
+ provides="test:confidentiality"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SecurityToken>
+ <sp:TokenType>sp:X509v3</sp:TokenType>
+ </sp:SecurityToken>
+ <sp:UsernameToken />
+ <sp:SignedParts />
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:TransportBinding>
+ <sp:IncludeTimeStamp />
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </policySet>
+
+<!-- profile intent -->
+ <intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="test:messageProtection">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <intent name="messageProtection"
+ constrains="sca:binding"
+ requires="test:confidentiality test:integrity">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/LICENSE b/sca-java-1.x/branches/sca-android/modules/policy/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/policy/META-INF/README b/sca-java-1.x/branches/sca-android/modules/policy/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/NOTICE b/sca-java-1.x/branches/sca-android/modules/policy/NOTICE
new file mode 100644
index 0000000000..b3e4797aaa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/NOTICE
@@ -0,0 +1,5 @@
+Copyright (c) 2005 - 2008 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-android/modules/policy/pom.xml b/sca-java-1.x/branches/sca-android/modules/policy/pom.xml
new file mode 100644
index 0000000000..2c76db7f89
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/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>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy</artifactId>
+ <name>Apache Tuscany SCA Policy Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.policy</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.policy*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.java
new file mode 100644
index 0000000000..6ca4fe72ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.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.policy;
+
+import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
+
+/**
+ * Default implementation for IntentAttachPointTypeFactory
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultIntentAttachPointTypeFactory extends IntentAttachPointTypeFactoryImpl implements IntentAttachPointTypeFactory{
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java
new file mode 100644
index 0000000000..22f328f643
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.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.policy;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a policy intent. See the Policy Framework specification for a
+ * description of this element.
+ *
+ * @version $Rev$ $Date$
+ */
+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);
+
+ /**
+ * Get the intent domain (the root intent name before any qualifiers)
+ * @return the domain
+ */
+ String getDomain();
+
+ /**
+ * Get the intent qualifiers
+ * @return the domain
+ */
+ String[] getQualifiedNames();
+
+ /**
+ * 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 intents which are mutually exclusive with this intent.
+ *
+ * @return the list of mutually exclusive intents.
+ */
+ List<Intent> getExcludedIntents();
+
+ /**
+ * 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-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java
new file mode 100644
index 0000000000..bf2cfca924
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.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.policy;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects that can be have policy intents
+ * attached to them.
+ *
+ * @version $Rev$ $Date$
+ */
+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();
+
+
+ /**
+ * Returns the type of the attach point such as a BindingType or an ImplementationType and so on
+ * @return
+ */
+ IntentAttachPointType getType();
+
+ /**
+ *
+ * Sets the type of the attach point such as a BindingType or an ImplementationType and so on
+ * @param type
+ */
+ void setType(IntentAttachPointType type);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.java
new file mode 100644
index 0000000000..6db529c7f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.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.policy;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Base interface for representing the model type of assembly model objects that can be have policy intents
+ * attached to them.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface IntentAttachPointType {
+
+ /**
+ * Returns the name of the extension type defined by this instance e.g. implementation.java, binding.ws
+ * @return the extension type QName
+ */
+ QName getName();
+
+ /**
+ * Sets the name of the extension type
+ * @param type the name of the extension type
+ */
+ void setName(QName type);
+
+ /**
+ * Returns the list of names of policy intents that will always be provided by this Extension Type
+ * @return list of Policy Intent names
+ */
+ List<Intent> getAlwaysProvidedIntents();
+
+ /**
+ * Returns the list of names of policy intents that may be provided by this Extension Type thro
+ * appropriate configuration
+ * @return list of Policy Intent names
+ */
+ List<Intent> getMayProvideIntents();
+
+ /**
+ * 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-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.java
new file mode 100644
index 0000000000..ee67006875
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.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.policy;
+
+/**
+ * Factory interface for creating extension types meta data
+ *
+ * @version $Rev$ $Date$
+ */
+public interface IntentAttachPointTypeFactory {
+
+ /**
+ * Creates an ImplementationTypeImpl instance to hold metadata related to
+ * a particular implementation extension in the SCA Domain
+ *
+ * @return an instance of IntentAttachPointType
+ */
+ IntentAttachPointType createImplementationType();
+
+ /**
+ * Creates an BindingTypeImpl instance to hold metadata related to
+ * a particular binding extension in the SCA Domain
+ *
+ * @return an instance of IntentAttachPointType
+ */
+ IntentAttachPointType createBindingType();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java
new file mode 100644
index 0000000000..1b225bc918
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.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.policy;
+
+import java.util.List;
+
+/**
+ * Represents a policy intent map. See the Policy Framework specification for a
+ * description of this element.
+ *
+ * @version $Rev$ $Date$
+ */
+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-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.java
new file mode 100644
index 0000000000..c6393e2ada
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.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.policy;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface that will abstract various types of policy specifications
+ * and attachments for example WS-Policy
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Policy {
+ QName getSchemaName();
+ void setUnresolved(boolean unresolved);
+ boolean isUnresolved();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java
new file mode 100644
index 0000000000..65c39803d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.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.policy;
+
+import java.util.List;
+
+/**
+ * A context container for policies.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PolicyContext {
+ List<Intent> getIntents(Object key);
+ List<PolicySet> getPolicySets(Object key);
+ void addIntents(Object key, List<Intent> intents);
+ void addPolicySets(Object key, List<PolicySet> policySets);
+ void addIntent(Object key, Intent intent);
+ void addPolicySet(Object key, PolicySet policySet);
+ void clearIntents(Object key);
+ void clearPolicySets(Object key);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java
new file mode 100644
index 0000000000..49bcbae1ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.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.policy;
+
+/**
+ * A factory for the policy model.
+ *
+ * @version $Rev$ $Date$
+ */
+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();
+
+ /**
+ * create a new Profile Intent
+ *
+ * @return a ProfileIntent instance
+ */
+ ProfileIntent createProfileIntent();
+
+ /**
+ * create a new QualifiedIntent
+ *
+ * @return a QualifiedIntent instance
+ */
+ QualifiedIntent createQualifiedIntent();
+
+ /**
+ * create a new PolicySetReference
+ *
+ * @return a PolicySetReference instance
+ */
+ PolicySetReference createPolicySetReference();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
new file mode 100644
index 0000000000..b16072c214
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.policy;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathExpression;
+
+/**
+ * Represents a policy set. See the Policy Framework specification for a
+ * description of this element.
+ *
+ * @version $Rev$ $Date$
+ */
+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 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);
+
+ /**
+ * Returns the XPath expression that is to be used to evaluate
+ * if this PolicySet applies to specific attachment point
+ *
+ * @return the XPath expression
+ */
+ String getAppliesTo();
+
+ /**
+ * Sets the XPath expression that is to be used to evaluate
+ * if this PolicySet applies to specific attachment point
+ *
+ */
+ void setAppliesTo(String xpath);
+
+ /**
+ * Returns the policies / policy attachments provided thro intent maps
+ *
+ * @return
+ */
+ Map<Intent, List<Object>> getMappedPolicies();
+
+ /**
+ * Gets the XPath expression that is to be used to evaluate
+ * the SCA Artifacts that this policyset will always apply to
+ * immaterial of an intent declared on the SCA Artifact
+ *
+ * @return the XPath expression
+ */
+ String getAlwaysAppliesTo();
+
+ /**
+ * Sets the XPath expression that is to be used to evaluate
+ * the SCA Artifacts that this policyset will always apply to
+ * immaterial of an intent declared on the SCA Artifact
+ *
+ */
+ void setAlwaysAppliesTo(String xpath);
+
+ /**
+ * Get the XPath expression for the appliesTo attribute
+ * @return the XPath expression for the appliesTo attribute
+ */
+ XPathExpression getAppliesToXPathExpression();
+
+ /**
+ * Set the XPath expression for the appliesTo attribute
+ * @param xpathExpression the XPath expression for the appliesTo attribute
+ */
+ void setAppliesToXPathExpression(XPathExpression xpathExpression);
+
+ /**
+ * Get the XPath expression for the alwaysAppliesTo attribute
+ * @return the XPath expression for the alwaysAppliesTo attribute
+ */
+ XPathExpression getAlwaysAppliesToXPathExpression();
+
+ /**
+ * Set the XPath expression for the alwaysAppliesTo attribute
+ * @param xpathExpression the XPath expression for the alwaysAppliesTo attribute
+ */
+ void setAlwaysAppliesToXPathExpression(XPathExpression xpathExpression);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java
new file mode 100644
index 0000000000..f4156fc2e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.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.policy;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects that can have policy sets
+ * attached to them.
+ *
+ * @version $Rev$ $Date$
+ */
+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();
+
+
+ /**
+ * Returns a list of policy sets defined in the domain, that are applicable to this
+ * PolicySetAttachPoint. An applicable PolicySet is one that include this PolicySetAttachPoint
+ * as part of its 'appliesTo' XPath attribute.
+ *
+ * @return a list of policy sets applicable to this PolicySetAttachPoint
+ */
+ List<PolicySet> getApplicablePolicySets();
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.java
new file mode 100644
index 0000000000..caa0d04fe3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.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.policy;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface that abstracts a PolicySet Reference
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PolicySetReference {
+
+ /**
+ * Returns the name of the policyset being referred to
+ *
+ * @return the QName of the referred policyset
+ */
+ QName getReferredPolicySetName();
+
+ /**
+ * @param refPolicySetName the name of the policyset being referred to
+ *
+ */
+ void setReferredPolicySetName(QName refPolicySetName);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.java
new file mode 100644
index 0000000000..28ff9d09d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.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.policy;
+
+import java.util.List;
+
+/**
+ * Interface that abstracts a profile intent
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProfileIntent extends Intent {
+ /**
+ * Returns the list of required intents.
+ *
+ * @return the list of required intents
+ */
+ List<Intent> getRequiredIntents();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.java
new file mode 100644
index 0000000000..0f43221dd6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.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.policy;
+
+/**
+ * Abstracts a qualified policy intent
+ *
+ * @version $Rev$ $Date$
+ */
+public interface QualifiedIntent extends Intent {
+
+ /**
+ * Returns the intent qualified by this intent
+ *
+ * @return
+ */
+ Intent getQualifiableIntent();
+
+ /**
+ * sets the qualifiable intent for this Qualified intent instance
+ *
+ * @param qualifiableIntent
+ */
+ void setQualifiableIntent(Intent qualifiableIntent);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java
new file mode 100644
index 0000000000..dbdef38324
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+/**
+ * Concrete implementation for a BindingType
+ *
+ * @version $Rev$ $Date$
+ */
+public class BindingTypeImpl implements IntentAttachPointType {
+
+ private List<Intent> alwaysProvides = new ArrayList<Intent>();
+ private List<Intent> mayProvides = new ArrayList<Intent>();
+ private QName typeName;
+ private boolean unResolved = true;
+
+ public List<Intent> getAlwaysProvidedIntents() {
+ return alwaysProvides;
+ }
+
+ public List<Intent> getMayProvideIntents() {
+ return mayProvides;
+ }
+
+ public QName getName() {
+ return typeName;
+ }
+
+ public void setName(QName type) {
+ this.typeName = type;
+ }
+
+ public boolean isUnresolved() {
+ return unResolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unResolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof BindingTypeImpl ) {
+ if (getName() != null) {
+ return getName().equals(((BindingTypeImpl)obj).getName());
+ } else {
+ return ((BindingTypeImpl)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName().toString();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java
new file mode 100644
index 0000000000..fa95d84c4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+/**
+ * Concrete implementation for a Implementation Type
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImplementationTypeImpl implements IntentAttachPointType {
+ private List<Intent> alwaysProvides = new ArrayList<Intent>();
+ private List<Intent> mayProvides = new ArrayList<Intent>();
+ private QName typeName;
+ private boolean unResolved = true;
+
+ public List<Intent> getAlwaysProvidedIntents() {
+ return alwaysProvides;
+ }
+
+ public List<Intent> getMayProvideIntents() {
+ return mayProvides;
+ }
+
+ public QName getName() {
+ return typeName;
+ }
+
+ public void setName(QName type) {
+ this.typeName = type;
+ }
+
+ public boolean isUnresolved() {
+ return unResolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unResolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof ImplementationTypeImpl ) {
+ if (getName() != null) {
+ return getName().equals(((ImplementationTypeImpl)obj).getName());
+ } else {
+ return ((ImplementationTypeImpl)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName().toString();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java
new file mode 100644
index 0000000000..aa6e27c240
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.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.policy.impl;
+
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Default implementation for IntentAttachPointTypeFactory
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentAttachPointTypeFactoryImpl implements IntentAttachPointTypeFactory {
+
+ public IntentAttachPointType createBindingType() {
+ return new BindingTypeImpl();
+ }
+
+ public IntentAttachPointType createImplementationType() {
+ return new ImplementationTypeImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java
new file mode 100644
index 0000000000..2d6bd0eb6f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+
+/**
+ * Represents a policy intent.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentImpl implements Intent {
+
+ private static final String QUALIFIED_SEPARATOR = ".";
+ private static final String DOMAIN_SEPARATOR = ".";
+ private QName name;
+ //private List<Operation> operations = new ArrayList<Operation>();
+ private List<QName> constrains = new ArrayList<QName>();
+ private String description;
+ private List<Intent> qualifiedIntents = new ArrayList<Intent>();
+ // private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<Intent> excludedIntents = new ArrayList<Intent>();
+ private boolean unresolved = true;
+ private String domain;
+ private String[] qualifiedNames;
+
+ protected IntentImpl() {
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ String iname = name.getLocalPart();
+ int domainIdx = iname.indexOf(DOMAIN_SEPARATOR);
+ if (domainIdx > -1) {
+ domain = iname.substring(0, domainIdx);
+ String qualifNamesStr = iname.substring(domainIdx + 1);
+ String pattern = "\\" + QUALIFIED_SEPARATOR;
+ qualifiedNames = qualifNamesStr.split(pattern);
+ } else
+ domain = iname;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public String[] getQualifiedNames() {
+ String[] results = new String[qualifiedNames.length];
+ System.arraycopy(qualifiedNames, 0, results, 0, qualifiedNames.length);
+ return results;
+ }
+
+ /*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> getExcludedIntents() {
+ return excludedIntents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ QName intentName = getName();
+ result = prime * result + ((intentName == null) ? 0 : intentName.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 (!(obj instanceof IntentImpl)) {
+ return false;
+ }
+ final IntentImpl other = (IntentImpl)obj;
+ if (getName() == null) {
+ if (other.getName() != null) {
+ return false;
+ }
+ } else if (!getName().equals(other.getName())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(getName());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.java
new file mode 100644
index 0000000000..a0e2f10f56
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyContext;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyContextImpl implements PolicyContext {
+ private Map<Object, List<Intent>> intents = new Hashtable<Object , List<Intent>>();
+ private Map<Object, List<PolicySet>> policySets = new Hashtable<Object, List<PolicySet>>();
+
+ public void addIntent(Object key, Intent intent) {
+ if ( intents.get(key) == null ) {
+ intents.put(key, new ArrayList<Intent>());
+ }
+ intents.get(key).add(intent);
+ }
+
+ public void addIntents(Object key, List<Intent> intents) {
+ if ( this.intents.get(key) == null ) {
+ this.intents.put(key, new ArrayList<Intent>());
+ }
+ this.intents.get(key).addAll(intents);
+ }
+
+ public void addPolicySet(Object key, PolicySet policySet) {
+ if ( policySets.get(key) == null ) {
+ policySets.put(key, new ArrayList<PolicySet>());
+ }
+ policySets.get(key).add(policySet);
+ }
+
+ public void addPolicySets(Object key, List<PolicySet> policySets) {
+ if ( this.policySets.get(key) == null ) {
+ this.policySets.put(key, new ArrayList<PolicySet>());
+ }
+ this.policySets.get(key).addAll(policySets);
+ }
+
+ public List<Intent> getIntents(Object key) {
+ if ( intents.get(key) == null ) {
+ intents.put(key, new ArrayList<Intent>());
+ }
+ return intents.get(key);
+ }
+
+ public List<PolicySet> getPolicySets(Object key) {
+ if ( policySets.get(key) == null ) {
+ policySets.put(key, new ArrayList<PolicySet>());
+ }
+ return policySets.get(key);
+ }
+
+ public void clearIntents(Object key) {
+ if ( intents.get(key) != null ) {
+ intents.clear();
+ }
+ }
+
+ public void clearPolicySets(Object key) {
+ if ( policySets.get(key) != null ) {
+ policySets.clear();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java
new file mode 100644
index 0000000000..1db29b835e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.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.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;
+import org.apache.tuscany.sca.policy.PolicySetReference;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * A factory for the policy model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class PolicyFactoryImpl implements PolicyFactory {
+
+ public Intent createIntent() {
+ return new IntentImpl();
+ }
+
+ public PolicySetReference createPolicySetReference() {
+ return new PolicySetReferenceImpl();
+ }
+
+ public PolicySet createPolicySet() {
+ return new PolicySetImpl();
+ }
+
+ public IntentMap createIntentMap() {
+ return new IntentMapImpl();
+ }
+
+ public ProfileIntent createProfileIntent() {
+ return new ProfileIntentImpl();
+ }
+
+ public QualifiedIntent createQualifiedIntent() {
+ return new QualifiedIntentImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
new file mode 100644
index 0000000000..4bd9d5b7c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathExpression;
+
+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 String appliesTo;
+ private List<Intent> providedIntents = new ArrayList<Intent>();
+ private List<PolicySet> referencedPolicySets = new ArrayList<PolicySet>();
+ private List<Object> policies = new ArrayList<Object>();
+ Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
+ private boolean unresolved = true;
+ private String alwaysAppliesTo;
+
+ private XPathExpression appliesToXPathExpression;
+ private XPathExpression alwaysAppliesToXPathExpression;
+
+ public String getAlwaysAppliesTo() {
+ return alwaysAppliesTo;
+ }
+
+ public void setAlwaysAppliesTo(String alwaysAppliesTo) {
+ this.alwaysAppliesTo = alwaysAppliesTo;
+ }
+
+ protected PolicySetImpl() {
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ /*public List<Operation> getOperations() {
+ return operations;
+ }*/
+
+ public String getAppliesTo() {
+ return appliesTo;
+ }
+
+ public void setAppliesTo(String appliesTo) {
+ this.appliesTo = 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;
+ }
+
+ public Map<Intent, List<Object>> getMappedPolicies() {
+ return mappedPolicies;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof PolicySet) {
+ if (getName() != null) {
+ return getName().equals(((PolicySet)obj).getName());
+ } else {
+ return ((PolicySet)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName().toString();
+ }
+
+ public XPathExpression getAppliesToXPathExpression() {
+ return appliesToXPathExpression;
+ }
+
+ public void setAppliesToXPathExpression(XPathExpression appliesToXPathExpression) {
+ this.appliesToXPathExpression = appliesToXPathExpression;
+ }
+
+ public XPathExpression getAlwaysAppliesToXPathExpression() {
+ return alwaysAppliesToXPathExpression;
+ }
+
+ public void setAlwaysAppliesToXPathExpression(XPathExpression alwaysAppliesToXPathExpression) {
+ this.alwaysAppliesToXPathExpression = alwaysAppliesToXPathExpression;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java
new file mode 100644
index 0000000000..98a116fe7b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.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.policy.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.PolicySetReference;
+
+/**
+ * Concrete implementation for a PolicySetReference
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicySetReferenceImpl implements PolicySetReference {
+
+ private QName referredPolicySetName = null;
+
+ /*
+ * @see org.apache.tuscany.sca.policy.PolicySetReference#getReferredPolicySetName()
+ */
+ public QName getReferredPolicySetName() {
+ return referredPolicySetName;
+ }
+
+ /*
+ * @see org.apache.tuscany.sca.policy.PolicySetReference#setReferredPolicySetName(javax.xml.namespace.QName)
+ */
+ public void setReferredPolicySetName(QName refPolicySetName) {
+ referredPolicySetName = refPolicySetName;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java
new file mode 100644
index 0000000000..e5002d2cdc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+
+/**
+ * Concrete implementation for Profile Intent
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProfileIntentImpl extends IntentImpl implements ProfileIntent {
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java
new file mode 100644
index 0000000000..d6f65b1788
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.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.policy.impl;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Models a concrete implementation of a Qualified Intent
+ *
+ * @version $Rev$ $Date$
+ */
+public class QualifiedIntentImpl extends IntentImpl implements QualifiedIntent {
+ private Intent qualifiableIntent = null;
+
+ public Intent getQualifiableIntent() {
+ return qualifiableIntent;
+ }
+
+ public void setQualifiableIntent(Intent qualifiableIntent) {
+ this.qualifiableIntent = qualifiableIntent;
+ }
+
+ @Override
+ public List<QName> getConstrains() {
+ return getQualifiableIntent().getConstrains();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java
new file mode 100644
index 0000000000..2e4c6a9d78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java
@@ -0,0 +1,418 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.util;
+
+import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Utility methods used during computation of PolicyIntents and PolicySets sets
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyComputationUtils {
+ private static final String POLICYSET_PREFIX = "tp_";
+ private static final String APPLICABLE_POLICYSET_ATTR_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+ private static final String APPLICABLE_POLICYSET_ATTR = "applicablePolicySets";
+ private static final String POLICY_SETS_ATTR = "policySets";
+ private static final String APPLICABLE_POLICYSET_ATTR_PREFIX = "tuscany";
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ /**
+ * This method unconditionally adds intents from the source list to the target list.
+ * It is used for intermediate intent inheritance between promotion levels
+ * (e.g. between a composite service and a component service). It does not check
+ * whether there are conflicting (mutually exclusive) intents. This is because
+ * promotion cannot override intents. If the resulting target list has conflicting
+ * intents, this will be detected later during policy computation.
+ */
+ public static void addInheritedIntents(List<Intent> sourceList, List<Intent> targetList) {
+ if (sourceList != null) {
+ targetList.addAll(sourceList);
+ }
+ }
+
+ public static void addInheritedPolicySets(List<PolicySet> sourceList,
+ List<PolicySet> targetList,
+ boolean checkOverrides) {
+ // check overrides is true when policysets are to be copied from
+ // componentType to component level
+ if (checkOverrides) {
+ // aggregate all the provided intents present in the target
+ List<Intent> targetProvidedIntents = new ArrayList<Intent>();
+ for (PolicySet policySet : targetList) {
+ targetProvidedIntents.addAll(policySet.getProvidedIntents());
+ }
+
+ // for every policy set in the source check if it provides one of
+ // the intents that is
+ // already provided by the policysets in the destination and do not
+ // copy them.
+ for (PolicySet policySet : sourceList) {
+ for (Intent sourceProvidedIntent : policySet.getProvidedIntents()) {
+ if (!targetProvidedIntents.contains(sourceProvidedIntent)) {
+ targetList.add(policySet);
+ }
+ }
+ }
+ } else {
+ targetList.addAll(sourceList);
+ }
+ }
+
+ /**
+ * This method is used to inherit intents and policy sets between hierarchical levels
+ * within the same composite (e.g. between a component and its services and references).
+ * In this case the source intents and policy sets provide defaults which are inherited
+ * into the target lists only when there is no conflict. For example consider a component
+ * with 3 references. The component level requires intent 'propagatesTransaction'.
+ * Reference 1 and 2 do not specify an intent, but reference 3 requires 'suspendsTransaction'.
+ * In this case the 'propagatesTransaction' intent is inherited by reference 1 and 2
+ * but not by reference 3.
+ */
+ public static void addDefaultPolicies(List<Intent> sourceIntents,
+ List<PolicySet> sourcePolicySets,
+ List<Intent> targetIntents,
+ List<PolicySet> targetPolicySets)
+ {
+ // form a list of all intents required by the target
+ List<Intent> combinedTargetIntents = new ArrayList<Intent>();
+ combinedTargetIntents.addAll(findAndExpandProfileIntents(targetIntents));
+ for (PolicySet targetPolicySet : targetPolicySets) {
+ combinedTargetIntents.addAll(findAndExpandProfileIntents(targetPolicySet.getProvidedIntents()));
+ }
+
+ // inherit intents in the source list that do not conflict with intents already in the target list
+ for (Intent sourceIntent : findAndExpandProfileIntents(sourceIntents)) {
+ boolean conflict = false;
+ for (Intent excluded : sourceIntent.getExcludedIntents()) {
+ if (combinedTargetIntents.contains(excluded)) {
+ conflict = true;
+ break;
+ }
+ }
+ if (!conflict) {
+ targetIntents.add(sourceIntent);
+ }
+ }
+
+ // inherit policy sets in the source list that do not conflict with policy sets or intents
+ // in the target list
+ for (PolicySet sourcePolicySet : sourcePolicySets) {
+ boolean conflict = false;
+ List<Intent> providedIntents = findAndExpandProfileIntents(sourcePolicySet.getProvidedIntents());
+ checkConflict: for (Intent intent : providedIntents) {
+ for (Intent excluded : intent.getExcludedIntents()) {
+ if (combinedTargetIntents.contains(excluded)) {
+ conflict = true;
+ break checkConflict;
+ }
+ }
+ }
+ if (!conflict)
+ targetPolicySets.add(sourcePolicySet);
+ }
+
+ }
+
+ public static void checkForMutuallyExclusiveIntents(
+ List<Intent> intents,
+ List<PolicySet> policySets,
+ IntentAttachPointType intentAttachPointType,
+ String id) throws PolicyValidationException
+ {
+ // gather all intents (keeping track of where they come from)
+ Map<Intent, PolicySet> combinedIntents = new HashMap<Intent,PolicySet>();
+ for (PolicySet policySet : policySets) {
+ for (Intent providedIntent : findAndExpandProfileIntents(policySet.getProvidedIntents())) {
+ combinedIntents.put(providedIntent, policySet);
+ }
+ }
+ for (Intent intent : intents) {
+ combinedIntents.put(intent, null);
+ }
+
+ // check for conflicts
+ for (Intent intent : combinedIntents.keySet()) {
+ for (Intent excluded : intent.getExcludedIntents()) {
+ if (combinedIntents.keySet().contains(excluded)) {
+ String sIntent1, sIntent2;
+ if (combinedIntents.get(intent) == null)
+ sIntent1 = intent.getName().toString();
+ else
+ sIntent1 = intent.getName().toString() + " in policy set " + combinedIntents.get(intent).getName().toString();
+ if (combinedIntents.get(excluded) == null)
+ sIntent2 = excluded.getName().toString();
+ else
+ sIntent2 = excluded.getName().toString() + " in policy set " + combinedIntents.get(excluded).getName().toString();
+ throw new PolicyValidationException(
+ intentAttachPointType.getName() + " for " + id +
+ " uses mutually-exclusive intents " + sIntent1 + " and " + sIntent2);
+ }
+ }
+ }
+ }
+
+ public static void expandProfileIntents(List<Intent> intents) {
+ List<Intent> expandedIntents = null;
+ if ( intents.size() > 0 ) {
+ expandedIntents = findAndExpandProfileIntents(intents);
+ intents.clear();
+ intents.addAll(expandedIntents);
+ }
+ }
+
+ public static List<Intent> findAndExpandProfileIntents(List<Intent> intents) {
+ List<Intent> expandedIntents = new ArrayList<Intent>();
+ for ( Intent intent : intents ) {
+ if ( intent instanceof ProfileIntent ) {
+ ProfileIntent profileIntent = (ProfileIntent)intent;
+ List<Intent> requiredIntents = profileIntent.getRequiredIntents();
+ expandedIntents.addAll(findAndExpandProfileIntents(requiredIntents));
+ } else {
+ expandedIntents.add(intent);
+ }
+ }
+ return expandedIntents;
+ }
+
+ private static byte[] addApplicablePolicySets(Document doc, Collection<PolicySet> policySets)
+ throws XPathExpressionException, TransformerConfigurationException, TransformerException {
+
+ for (PolicySet policySet : policySets) {
+ if (policySet.getAppliesTo() != null) {
+ addApplicablePolicySets(policySet, doc);
+ }
+
+ if (policySet.getAlwaysAppliesTo() != null) {
+ addAlwaysApplicablePolicySets(policySet, doc);
+ }
+ }
+
+ StringWriter sw = new StringWriter();
+ final Source domSource = new DOMSource(doc);
+ final Result finalResult = new StreamResult(sw);
+ final Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ // transformer.setOutputProperty("omit-xml-declaration", "yes");
+ // Allow priviledged access to let transformers read property files. Requires
+ // PropertyPermission in security policy.
+ try {
+ AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
+ public Object run() throws TransformerException {
+ transformer.transform(domSource, finalResult);
+ return null;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (TransformerException)e.getException();
+ }
+
+ return sw.toString().getBytes();
+ }
+
+ private static void addAlwaysApplicablePolicySets(PolicySet policySet,
+ Document doc) throws XPathExpressionException {
+ XPathExpression expression = policySet.getAlwaysAppliesToXPathExpression();
+ NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);
+
+ if (result != null) {
+ for (int counter = 0; counter < result.getLength(); ++counter) {
+ Node aResultNode = result.item(counter);
+
+ String alwaysApplicablePolicySets = null;
+
+ String policySetPrefix =
+ declareNamespace((Element)aResultNode, policySet.getName().getNamespaceURI());
+ String policySetsAttrPrefix =
+ declareNamespace((Element)aResultNode, SCA10_NS);
+ if (aResultNode.getAttributes().getNamedItem(POLICY_SETS_ATTR) != null) {
+ alwaysApplicablePolicySets =
+ aResultNode.getAttributes().getNamedItem(POLICY_SETS_ATTR).getNodeValue();
+ }
+
+ if (alwaysApplicablePolicySets != null && alwaysApplicablePolicySets.length() > 0) {
+ alwaysApplicablePolicySets =
+ alwaysApplicablePolicySets + " "
+ + policySetPrefix
+ + ":"
+ + policySet.getName().getLocalPart();
+ } else {
+ alwaysApplicablePolicySets =
+ policySetPrefix + ":" + policySet.getName().getLocalPart();
+ }
+
+ ((Element)aResultNode).setAttribute(POLICY_SETS_ATTR, alwaysApplicablePolicySets);
+ }
+ }
+ }
+
+ private static void addApplicablePolicySets(PolicySet policySet,
+ Document doc) throws XPathExpressionException {
+ XPathExpression expression = policySet.getAppliesToXPathExpression();
+ NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);
+
+ if (result != null) {
+ for (int counter = 0; counter < result.getLength(); ++counter) {
+ Node aResultNode = result.item(counter);
+
+ String applicablePolicySets = null;
+
+ String policySetPrefix =
+ declareNamespace((Element)aResultNode, policySet.getName().getNamespaceURI());
+ String appPolicyAttrPrefix =
+ declareNamespace((Element)aResultNode,
+ APPLICABLE_POLICYSET_ATTR_NS);
+ if (aResultNode.getAttributes().getNamedItemNS(APPLICABLE_POLICYSET_ATTR_NS,
+ APPLICABLE_POLICYSET_ATTR) != null) {
+ applicablePolicySets =
+ aResultNode.getAttributes().getNamedItemNS(APPLICABLE_POLICYSET_ATTR_NS,
+ APPLICABLE_POLICYSET_ATTR)
+ .getNodeValue();
+ }
+
+ if (applicablePolicySets != null && applicablePolicySets.length() > 0) {
+ applicablePolicySets =
+ applicablePolicySets + " "
+ + policySetPrefix
+ + ":"
+ + policySet.getName().getLocalPart();
+ } else {
+ applicablePolicySets =
+ policySetPrefix + ":" + policySet.getName().getLocalPart();
+ }
+
+ ((Element)aResultNode).setAttributeNS(APPLICABLE_POLICYSET_ATTR_NS,
+ appPolicyAttrPrefix + ":"
+ + APPLICABLE_POLICYSET_ATTR,
+ applicablePolicySets);
+ }
+ }
+ }
+
+ public static byte[] addApplicablePolicySets(InputStream is, Collection<PolicySet> domainPolicySets, DocumentBuilderFactory documentBuilderFactory) throws Exception {
+ documentBuilderFactory.setNamespaceAware(true);
+ DocumentBuilder db = documentBuilderFactory.newDocumentBuilder();
+ Document doc = db.parse(is);
+ is.close();
+ return addApplicablePolicySets(doc, domainPolicySets);
+ }
+
+ 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;
+ }
+
+ }
+
+ private static String declareNamespace(Element element, String ns) {
+ if (ns == null) {
+ ns = "";
+ }
+ Node node = element;
+ String prefix = "";
+ boolean declared = false;
+ while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
+ if ( node.lookupPrefix(ns) != null ) {
+ prefix = node.lookupPrefix(ns);
+ declared = true;
+ break;
+ } else {
+ /*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) {
+ // Find an available prefix
+ for (int i=1; ; i++) {
+ prefix = POLICYSET_PREFIX + i;
+ if (element.lookupNamespaceURI(prefix) == null) {
+ break;
+ }
+ }
+ String qname = "xmlns:" + prefix;
+ org.w3c.dom.Attr attr = element.getOwnerDocument().createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, qname);
+ attr.setValue(ns);
+ element.setAttributeNodeNS(attr);
+ }
+ return prefix;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java
new file mode 100644
index 0000000000..1f91710f95
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.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.policy.util;
+
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * @deprecated This interface is replaced by PolicyProviderFactory/PolicyProvider SPIs
+ * Handler interface for handling policies defined in policysets
+ *
+ * @version $Rev$ $Date$
+ */
+@Deprecated
+public interface PolicyHandler {
+ PolicySet getApplicablePolicySet();
+ void setApplicablePolicySet(PolicySet policySet);
+ void setUp(Object... context);
+ void cleanUp(Object... context);
+ void beforeInvoke(Object... context);
+ void afterInvoke(Object... context);
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java
new file mode 100644
index 0000000000..3a37ed3c41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.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.util;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Utility class for loading policy handler definitions from META-INF/services directories
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyHandlerDefinitionsLoader {
+
+ public static List<PolicyHandlerTuple> loadPolicyHandlerClassnames() {
+ // Get the processor service declarations
+ Set<ServiceDeclaration> sds;
+ try {
+ sds = ServiceDiscovery.getInstance().getServiceDeclarations(PolicyHandler.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ List<PolicyHandlerTuple> handlerTupleList = new ArrayList<PolicyHandlerTuple>();
+
+ Map<Object, List<PolicyHandlerTuple>> handlerTuples = new Hashtable<Object, List<PolicyHandlerTuple>>();
+ for (ServiceDeclaration sd : sds) {
+ Map<String, String> attributes = sd.getAttributes();
+ String intentName = attributes.get("intent");
+ QName intentQName = getQName(intentName);
+ String policyModelClassName = attributes.get("model");
+ String appliesTo = attributes.get("appliesTo");
+ if ( appliesTo != null && !appliesTo.startsWith("/") ) {
+ appliesTo = "//" + appliesTo;
+ }
+ handlerTupleList.add(new PolicyHandlerTuple(sd, sd.getClassName(), intentQName, policyModelClassName, appliesTo));
+ }
+
+ return handlerTupleList;
+ }
+
+ private static QName getQName(String qname) {
+ if (qname == null) {
+ return null;
+ }
+ qname = qname.trim();
+ if (qname.startsWith("{")) {
+ int h = qname.indexOf('}');
+ if (h != -1) {
+ return new QName(qname.substring(1, h), qname.substring(h + 1));
+ }
+ } else {
+ int h = qname.indexOf('#');
+ if (h != -1) {
+ return new QName(qname.substring(0, h), qname.substring(h + 1));
+ }
+ }
+ throw new IllegalArgumentException("Invalid qname: " + qname);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.java
new file mode 100644
index 0000000000..c80e68a0be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.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.policy.util;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+
+/**
+ * PolicyHanlder tuples stored in policy handler services files
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyHandlerTuple {
+ private ServiceDeclaration declaration;
+ private String policyHandlerClassName;
+ private QName providedIntentName;
+ private String policyModelClassName;
+ private String appliesTo;
+
+ public PolicyHandlerTuple(ServiceDeclaration declaration,
+ String handlerClassName,
+ QName providedIntentName,
+ String policyModelClassName,
+ String appliesTo) {
+ this.declaration = declaration;
+ this.policyHandlerClassName = handlerClassName;
+ this.providedIntentName = providedIntentName;
+ this.policyModelClassName = policyModelClassName;
+ this.appliesTo = appliesTo;
+ }
+
+ public ServiceDeclaration getDeclaration() {
+ return declaration;
+ }
+
+ public void setDeclaration(ServiceDeclaration declaration) {
+ this.declaration = declaration;
+ }
+
+ public String getAppliesTo() {
+ return appliesTo;
+ }
+
+ public void setAppliesTo(String appliesTo) {
+ this.appliesTo = appliesTo;
+ }
+
+
+ public String getPolicyHandlerClassName() {
+ return policyHandlerClassName;
+ }
+ public void setPolicyHandlerClassName(String policyHandlerClassName) {
+ this.policyHandlerClassName = policyHandlerClassName;
+ }
+ public String getPolicyModelClassName() {
+ return policyModelClassName;
+ }
+ public void setPolicyModelClassName(String policyModelClassName) {
+ this.policyModelClassName = policyModelClassName;
+ }
+ public QName getProvidedIntentName() {
+ return providedIntentName;
+ }
+ public void setProvidedIntentName(QName providedIntentName) {
+ this.providedIntentName = providedIntentName;
+ }
+
+ @Override
+ public String toString() {
+ return policyHandlerClassName + ", " + providedIntentName + ", " + policyModelClassName + ", " + appliesTo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java
new file mode 100644
index 0000000000..6d6420017f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.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.policy.util;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Utility methods to deal with PolicyHandlers
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyHandlerUtils {
+ public static PolicyHandler findPolicyHandler(PolicySet policySet, List<PolicyHandlerTuple> policyHandlerClassNames)
+ throws IllegalAccessException, ClassNotFoundException, InstantiationException {
+
+ PolicyHandler handler = null;
+
+ for (PolicyHandlerTuple handlerTuple : policyHandlerClassNames) {
+ //System.out.println(handlerTuple);
+ for (Intent intent : policySet.getProvidedIntents()) {
+ if (intent.getName().equals(handlerTuple.getProvidedIntentName())) {
+ for (Object policy : policySet.getPolicies()) {
+ if (policy.getClass().getName().equals(handlerTuple.getPolicyModelClassName())) {
+ if (handlerTuple.getAppliesTo() != null) {
+ if (handlerTuple.getAppliesTo().equals(policySet.getAppliesTo())) {
+ handler = (PolicyHandler)handlerTuple.getDeclaration().loadClass().newInstance();
+ handler.setApplicablePolicySet(policySet);
+ return handler;
+ }
+ } else {
+ handler = (PolicyHandler)handlerTuple.getDeclaration().loadClass().newInstance();
+ handler.setApplicablePolicySet(policySet);
+ return handler;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return handler;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java
new file mode 100644
index 0000000000..eb97818042
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.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.policy.util;
+
+/**
+ * Exception to be throw for invalid policy intents / policysets
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyValidationException extends Exception {
+ private static final long serialVersionUID = 506979037642587755L;
+
+ public PolicyValidationException(String message) {
+ super(message);
+ }
+
+ public PolicyValidationException(Throwable e) {
+ super(e);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java
new file mode 100644
index 0000000000..afb3c035ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.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.policy.util;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PolicyValidationUtils {
+
+ public static boolean isConstrained(QName constrained, IntentAttachPointType attachPointType) {
+ return (attachPointType != null && attachPointType.getName().getNamespaceURI()
+ .equals(constrained.getNamespaceURI()) && attachPointType.getName().getLocalPart()
+ .startsWith(constrained.getLocalPart()));
+ }
+
+ public static void validateIntents(IntentAttachPoint attachPoint,
+ IntentAttachPointType attachPointType)
+ throws PolicyValidationException {
+ boolean found = false;
+ if (attachPointType != null) {
+ // validate intents specified against the parent (binding /
+ // implementation)
+ found = false;
+ for (Intent intent : attachPoint.getRequiredIntents()) {
+ if (!intent.isUnresolved()) {
+ for (QName constrained : intent.getConstrains()) {
+ if (isConstrained(constrained, attachPointType)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName()
+ + "' does not constrain extension type "
+ + attachPointType.getName());
+ }
+ } else {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName()
+ + "' is not defined in this domain ");
+ }
+ }
+ }
+ }
+
+ public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint)
+ throws PolicyValidationException {
+ validatePolicySets(policySetAttachPoint,
+ policySetAttachPoint.getType(),
+ policySetAttachPoint.getApplicablePolicySets());
+ }
+
+ public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
+ IntentAttachPointType attachPointType)
+ throws PolicyValidationException {
+ validatePolicySets(policySetAttachPoint,
+ attachPointType,
+ policySetAttachPoint.getApplicablePolicySets());
+ }
+
+ public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
+ IntentAttachPointType attachPointType,
+ List<PolicySet> applicablePolicySets)
+ throws PolicyValidationException {
+ // Since the applicablePolicySets in a policySetAttachPoint will already
+ // have the list of policysets that might ever be applicable to this attachPoint,
+ // just check if the defined policysets feature in the list of applicable
+ // policysets
+ for (PolicySet definedPolicySet : policySetAttachPoint.getPolicySets()) {
+ if (!definedPolicySet.isUnresolved()) {
+ if (!applicablePolicySets.contains(definedPolicySet)) {
+ throw new PolicyValidationException("Policy Set '" + definedPolicySet
+ .getName()
+ + "' does not apply to extension type "
+ + attachPointType.getName());
+ }
+ } else {
+ throw new PolicyValidationException("Policy Set '" + definedPolicySet.getName()
+ + "' is not defined in this domain ");
+
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory b/sca-java-1.x/branches/sca-android/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory
new file mode 100644
index 0000000000..a0e56c1822
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory
@@ -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.
+
+org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory b/sca-java-1.x/branches/sca-android/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory
new file mode 100644
index 0000000000..846b3b24a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory
@@ -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.
+
+org.apache.tuscany.sca.policy.DefaultPolicyFactory \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java b/sca-java-1.x/branches/sca-android/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java
new file mode 100644
index 0000000000..636ff5ab45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.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.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;
+
+ @Override
+ public void setUp() throws Exception {
+ factory = new DefaultPolicyFactory();
+ }
+
+ 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-android/modules/pom.xml b/sca-java-1.x/branches/sca-android/modules/pom.xml
new file mode 100644
index 0000000000..fffe442b51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/pom.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-modules</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Implementation Modules</name>
+
+ <properties>
+ <tuscany.version>1.4</tuscany.version>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>assembly</module>
+ <module>assembly-xml</module>
+ <module>assembly-xsd</module>
+ <module>contribution</module>
+ <module>contribution-java</module>
+ <module>contribution-impl</module>
+ <module>contribution-xml</module>
+ <module>core</module>
+ <module>core-databinding</module>
+ <module>core-spi</module>
+ <module>databinding</module>
+ <module>definitions</module>
+ <module>definitions-xml</module>
+ <module>endpoint</module>
+ <module>extensibility</module>
+ <module>host-embedded</module>
+ <module>interface</module>
+ <module>interface-java</module>
+ <module>interface-java-xml</module>
+ <module>implementation-java</module>
+ <module>implementation-java-xml</module>
+ <module>implementation-java-runtime</module>
+ <module>implementation-node</module>
+ <module>implementation-node-runtime</module>
+ <module>monitor</module>
+ <module>node-api</module>
+ <module>node-impl</module>
+ <module>node-launcher</module>
+ <module>policy</module>
+ <module>policy-xml</module>
+ <module>sca-api</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>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <buildcommands>
+ <buildcommand>org.eclipse.pde.ManifestBuilder</buildcommand>
+ <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
+ </buildcommands>
+ <projectnatures>
+ <projectnature>org.eclipse.jdt.core.javanature</projectnature>
+ <projectnature>org.eclipse.pde.PluginNature</projectnature>
+ </projectnatures>
+ <classpathContainers>
+ <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+ <!--
+ <classpathContainer>org.eclipse.pde.core.requiredPlugins</classpathContainer>
+ -->
+ </classpathContainers>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.3</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>bundle-manifest</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ <configuration>
+ <manifestLocation>${basedir}/META-INF</manifestLocation>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>${basedir}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/sca-api/LICENSE b/sca-java-1.x/branches/sca-android/modules/sca-api/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/modules/sca-api/META-INF/README b/sca-java-1.x/branches/sca-android/modules/sca-api/META-INF/README
new file mode 100644
index 0000000000..009570154d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/sca-api/META-INF/README
@@ -0,0 +1 @@
+This directory contains a generated MANIFEST.MF file.
diff --git a/sca-java-1.x/branches/sca-android/modules/sca-api/NOTICE b/sca-java-1.x/branches/sca-android/modules/sca-api/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/sca-api/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/modules/sca-api/pom.xml b/sca-java-1.x/branches/sca-android/modules/sca-api/pom.xml
new file mode 100644
index 0000000000..54e43ce91c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/modules/sca-api/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <name>Apache Tuscany SCA API</name>
+
+ <description>API classes for the Service Component Architecture</description>
+ <packaging>jar</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.4</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.api</Bundle-SymbolicName>
+ <Bundle-Description>${pom.description}</Bundle-Description>
+ <Export-Package>org.osoa.sca*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/Constants.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java b/sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java
new file mode 100644
index 0000000000..1484d4ac77
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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
+ */
+ 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
+ */
+ 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
+ */
+ boolean singlePrincipal() default false;
+}
diff --git a/sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java b/sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java
new file mode 100644
index 0000000000..768429cd91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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
+ */
+ String name() default "";
+
+ /**
+ * Indicates if a reference must be specified.
+ *
+ * @return true if a reference must be specified
+ */
+ boolean required() default true;
+}
+
diff --git a/sca-java-1.x/branches/sca-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java b/sca-java-1.x/branches/sca-android/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-android/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-android/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java b/sca-java-1.x/branches/sca-android/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-android/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-android/pom.xml b/sca-java-1.x/branches/sca-android/pom.xml
new file mode 100644
index 0000000000..8626814873
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/pom.xml
@@ -0,0 +1,469 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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</groupId>
+ <artifactId>apache</artifactId>
+ <version>4</version>
+ </parent>
+
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Implementation Project</name>
+ <url>http://tuscany.apache.org</url>
+ <version>1.4-SNAPSHOT</version>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/tuscany/java/sca</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/tuscany/java/sca</developerConnection>
+ <url>http://svn.apache.org/repos/asf/tuscany/java/sca</url>
+ </scm>
+
+ <prerequisites>
+ <maven>2.0.6</maven>
+ </prerequisites>
+
+ <properties>
+ <notice.dir>.</notice.dir>
+ </properties>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://issues.apache.org/jira/browse/TUSCANY</url>
+ </issueManagement>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <!-- Apache SNAPSHOT repository for unreleased artifacts -->
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache SNAPSHOT Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.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>
+ <repository>
+ <id>indiana</id>
+ <url>http://ftp.ussg.iu.edu/eclipse/modeling/emf/emf/maven2/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>osuosl.org</id>
+ <url>http://ftp.osuosl.org/pub/eclipse/tools/emf/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <!-- Apache repository for artifacts released by Apache TLP projects -->
+ <pluginRepository>
+ <id>apache</id>
+ <name>Apache Repository</name>
+ <url>http://people.apache.org/repo/m2-ibiblio-rsync-repository</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+
+ <!-- Apache Incubator repository for artifacts released by Incubator projects -->
+ <pluginRepository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+
+ <!-- Apache SNAPSHOT repository for unreleased artifacts -->
+ <pluginRepository>
+ <id>apache.snapshots</id>
+ <name>Apache SNAPSHOT Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+
+ <!-- Codehaus SNAPSHOT repository -->
+ <pluginRepository>
+ <id>codehaus-snapshot</id>
+ <name>Codehaus Snapshot Repository</name>
+ <url>http://snapshots.repository.codehaus.org</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <distributionManagement>
+ <repository>
+ <id>apache.releases</id>
+ <name>Apache Release Distribution Repository</name>
+ <url>scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository</url>
+ </repository>
+ <snapshotRepository>
+ <id>apache.snapshots</id>
+ <name>Apache Development Snapshot Repository</name>
+ <url>scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>modules</module>
+ <module>tools</module>
+ <module>samples</module>
+ <module>itest</module>
+ <module>vtest</module>
+ <module>tutorials</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>distribution</id>
+ <modules>
+ <module>modules</module>
+ <module>tools</module>
+ <module>samples</module>
+ <module>itest</module>
+ <module>vtest</module>
+ <module>tutorials</module>
+ <module>demos</module>
+ <module>distribution</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>sources</id>
+ <modules>
+ <module>modules</module>
+ <module>tools</module>
+ <module>samples</module>
+ <module>itest</module>
+ <module>vtest</module>
+ <module>tutorials</module>
+ </modules>
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>eclipse</id>
+ <properties>
+ <notice.dir>src/main/resources</notice.dir>
+ </properties>
+ <modules>
+ <module>modules</module>
+ <module>tools</module>
+ <module>samples</module>
+ <module>itest</module>
+ <module>vtest</module>
+ <module>tutorials</module>
+ <module>demos</module>
+ <module>distribution</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>osgi</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <modules>
+ <module>calculator</module>
+ </modules>
+ <properties>
+ <maven.test.skip.exec>true</maven.test.skip.exec>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-osgi-junit</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>osgi-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>dependencies</id>
+ <modules>
+ <module>modules</module>
+ <module>samples</module>
+ <module>tutorials</module>
+ <module>demos</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-dependency-lister</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>security</id>
+ <modules>
+ <!-- <module>demos</module> -->
+ <module>itest</module>
+ <module>vtest</module>
+ </modules>
+ <activation>
+ <property>
+ <name>tuscany.policy.file</name>
+ </property>
+ </activation>
+ <properties>
+ <tuscany.policy.file>file:///${java.home}/lib/security/tuscany.policy</tuscany.policy.file>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ <forkMode>once</forkMode>
+ <!-- Place tuscany.policy in your Java home security directory. Alternatively, hardcode the file location here. -->
+ <argLine>-Djava.security.manager -Djava.security.policy=${tuscany.policy.file} -Dpolicy.allowSystemProperty=true -Djava.security.debug=policy</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- profile for verifying source code correctness -->
+ <profile>
+ <id>sourcecheck</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked,deprecation,fallthrough,finally</compilerArgument>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </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>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>
+<!-- <compilerId>eclipse</compilerId> -->
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+<!--
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-eclipse</artifactId>
+ </dependency>
+ </dependencies>
+-->
+ </plugin>
+
+ <!-- surefire plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ <forkMode>once</forkMode>
+ <argLine>-ea -Xmx256m</argLine>
+ </configuration>
+ </plugin>
+
+ <!-- jar plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ <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>
+ </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-android/samples/README b/sca-java-1.x/branches/sca-android/samples/README
new file mode 100644
index 0000000000..2646fbb73a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/README
@@ -0,0 +1,306 @@
+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 test cases, as tests in the Maven build.
+
+In the binary distribution of Apache Tuscany most samples can also
+be run using the provided Ant build.xml files. These show 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 your own text at that point.
+
+These simple samples have been created with the intention of illustrating the
+usage of the SCA API and annotations and certainly not to levels of SCA component
+abstraction. In real life situations you should use SCA to assemble real and
+usually bigger components, and when you do that you'll get all the benefits of
+SCA, bindings, policies, integration in an SOA environment etc..
+
+Sample Overview
+---------------
+The samples generally show off different features of the SCA runtime
+and the extensions that come packaged with it.
+
+binding-notification-broker - A broker for notificatione
+binding-notification-consumer - A consumer of notifications
+binding-notification-producer - A producer of notifications
+
+calculator - Calculator built with java components and
+ local wires.
+calculator-distributed - A calculator built using SCA nodes running
+ on multiple JVMs
+calculator-implementation-policies - Shows logging policites associated with
+ SCA implementations
+calculator-rmi-reference - The calculator configured to talk RMI to
+ the calculator-rmi-service sample
+calculator-rmi-service - The calculator configured to accept RMI
+ requests from calculator-rmi-reference
+calculator-script - Calculator built using various script languages
+calculator-webapp - Calculator running inside a web app
+calculator-ws-webapp - Calculator running inside a web app also
+ showing webservices binding
+
+callbck-ws-client - The client for showing callbacks across web services
+callback-ws-service - The server for showing callbacks across web serviced
+
+chat-webapp - A simple chat style web app demonstrating
+ use of AJAX binding
+
+databinding-echo - An SCA application that shows how databindings
+ transform data
+
+feed-aggregator - Demonstrates using the ATOM binding
+feed-aggregator-webapp - feed-aggregator running in webapp
+
+helloworld-bpel - Demonstrates an SCA component invoking a BPEL
+ process in a composition
+
+helloworld-dojo-webapp - An SCA application that exposes a service using
+ JSONRPC and a client using the Dojo toolkit
+helloworld-jsonrpc-webapp - helloworld using jsonrpc binding
+helloworld-ws-reference - The client side of a hello world sample that uses a
+ web service binding (requires helloworld-ws-service)
+helloworld-ws-service - The server side of a hello world sample that uses a
+ web service binding
+helloworld-ws-reference-jms - The client side of a hello world sample that uses a
+ web service binding with SOAP/JMS (requires
+ helloworld-ws-service)
+helloworld-ws-service-jms - The server side of a hello world sample that
+ uses a web service binding with SOAP/JMS
+helloworld-ws-reference-secure - The client side of a hello world sample that
+ shows how policy intent can be used.
+helloworld-ws-service-secure - The client side of a hello world sample that
+ shows how policy intent can be used.
+helloworld-ws-sdo - helloworld using ws binding and SDO
+helloworld-ws-sdo-webapp - helloworld using ws binding and SDO within a webapp
+
+implementation-composite - Shows how SCA composites are used
+
+osgi-supplychain - SCA asynchronous API with OSGi and Java
+ implementation types
+
+simple-bigbank - A banking application built with java components
+ and local wire
+simple-bigbank-spring - A banking application showing how SCA works with Spring
+
+simple-callback - demonstrates the callback interface
+simple-callback-ws - demonstrates use of callback interface across WS binding
+
+store - Step by step guide for creating an online store
+
+supplychain - shows how asynchronous callbacks can be used
+
+web-resource - Demonstrates using an SCA Web resource component
+
+quote-xquery - Demonstrate SCA components using XQuery
+
+Samples for building extensions
+-------------------------------
+There are 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 not 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-extension - Shows how to build new implementation type
+ extensions
+implementation-crud - A sample application that exercises the new
+ implementation extensions
+binding-echo-extension - Shows how to build new binding extensions
+binding-echo - A sample application that exercises the new
+ binding extension
+implementation-notifiaction- Illustrates the use of <implementation.notification/>
+implementation-pojo-extension - shows how new implementation types are constructed
+
+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
+ test-classes/ - classes from src/test and other test 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 jar file> <sample runnable class>
+
+for example : java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient
+
+on *nix
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/<sample jar file> <sample runnable class>
+
+for example : 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 <sample runnable class>
+
+for example : java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes calculator.CalculatorClient
+
+on *nix
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/classes <sample runnable class>
+
+for example : 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 the examples we have used 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
+---------------------------------------------
+The easiest way to use the samples in an IDE is to use Maven 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.
+
+Using The Samples In An IDE Without Maven
+-----------------------------------------
+We don't provide any IDE project files with our distributions 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-1.0-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.
+
+
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/README b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/README
new file mode 100644
index 0000000000..94716b151f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/README
@@ -0,0 +1,74 @@
+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 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-extension/
+ src/
+ main/
+ java/
+ echo/ - The binding interfaces
+ impl/ - The bindings model classes
+ provider/ - The bindings runtime classes
+ server/ - A dummy server that the binding is plugged into
+ resources/
+ META-INF/
+ services/ - The extension declaration
+ test/
+ java/
+ echo/ - test code
+ 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-extension
+ant compile
+
+See the binding-echo sample 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-extension
+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.EchoServiceTestCase
+Returned message: oof
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.011 sec
+Running echo.EchoReferenceTestCase
+Returned message: oof
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 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-android/samples/binding-echo-extension/build.xml b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/build.xml
new file mode 100644
index 0000000000..5df5981bea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/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="binding-echo-extension" default="compile">
+ <property name="test.jar" value="sample-binding-echo-extension.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-android/samples/binding-echo-extension/pom.xml b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/pom.xml
new file mode 100644
index 0000000000..2d516f2101
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-echo-extension</artifactId>
+ <name>Apache Tuscany SCA Echo Binding 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>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-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-android/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
new file mode 100644
index 0000000000..3fe1598e0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBinding.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;
+
+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-android/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java
new file mode 100644
index 0000000000..0f6fee82be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/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 Echo binding
+ */
+ EchoBinding createEchoBinding();
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java
new file mode 100644
index 0000000000..af759dbf93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.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 echo.impl;
+
+import echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public class EchoBindingFactoryImpl implements EchoBindingFactory {
+
+ public EchoBinding createEchoBinding() {
+ return new EchoBindingImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
new file mode 100644
index 0000000000..19c9271bb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.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 echo.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+import echo.EchoBinding;
+
+/**
+ * Implementation of the Echo binding model.
+ */
+public class EchoBindingImpl implements EchoBinding, PolicySetAttachPoint {
+
+ private String name;
+ private String uri;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType bindingType = null;
+
+ public IntentAttachPointType getType() {
+ return bindingType;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.bindingType = type;
+ }
+
+ 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() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public boolean isUnresolved() {
+ // The sample binding is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample binding is always resolved
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return this.applicablePolicySets;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
new file mode 100644
index 0000000000..45fdb73f67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.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 echo.impl;
+
+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.xml.PolicyAttachPointProcessor;
+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;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
+
+import echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A processor for <binding.echo> elements.
+ */
+public class EchoBindingProcessor implements StAXArtifactProcessor<EchoBinding> {
+
+ private QName BINDING_ECHO = new QName("http://echo", "binding.echo");
+
+ private final EchoBindingFactory factory;
+ private PolicyAttachPointProcessor policyProcessor;
+
+ public EchoBindingProcessor(EchoBindingFactory factory, PolicyFactory policyFactory) {
+ this.factory = factory;
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ public QName getArtifactType() {
+ return BINDING_ECHO;
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+
+ public EchoBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ EchoBinding echoBinding = factory.createEchoBinding();
+ IntentAttachPointType bindingType = new IntentAttachPointTypeFactoryImpl().createBindingType();
+ bindingType.setName(getArtifactType());
+ bindingType.setUnresolved(true);
+ ((PolicySetAttachPoint)echoBinding).setType(bindingType);
+
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null) {
+ echoBinding.setName(name);
+ }
+
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null) {
+ echoBinding.setURI(uri);
+ }
+
+ policyProcessor.readPolicies(echoBinding, reader);
+
+ return echoBinding;
+ }
+
+ public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ policyProcessor.writePolicyPrefixes(echoBinding, writer);
+ writer.writeStartElement(BINDING_ECHO.getNamespaceURI(), BINDING_ECHO.getLocalPart());
+ policyProcessor.writePolicyAttributes(echoBinding, writer);
+
+ if (echoBinding.getName() != null) {
+ writer.writeAttribute("name", echoBinding.getName());
+ }
+
+ if (echoBinding.getURI() != null) {
+ writer.writeAttribute("uri", echoBinding.getURI());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(EchoBinding echoBinding, ModelResolver resolver) throws ContributionResolveException {
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)echoBinding;
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ Intent resolvedIntent = null;
+ for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) {
+ resolvedIntent = resolver.resolveModel(Intent.class, intent);
+ requiredIntents.add(resolvedIntent);
+ }
+ policySetAttachPoint.getRequiredIntents().clear();
+ policySetAttachPoint.getRequiredIntents().addAll(requiredIntents);
+
+ List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
+ PolicySet resolvedPolicySet = null;
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
+ resolvedPolicySets.add(resolvedPolicySet);
+ }
+ policySetAttachPoint.getPolicySets().clear();
+ policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
new file mode 100644
index 0000000000..91697fcd9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/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 org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Invoker for the sample echo binding.
+ */
+class EchoBindingInvoker implements Invoker {
+
+ EchoBindingInvoker() {
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ System.out.println("Passing thro invoker...");
+ Object[] args = msg.getBody();
+
+ // echo back the first parameter, a real binding would invoke some API for flowing the request
+ Object result = args[0];
+
+ msg.setBody(result);
+
+ } catch (Exception e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java
new file mode 100644
index 0000000000..4877bade7f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.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 echo.provider;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+import echo.provider.policy.PolicyHandler;
+import echo.provider.policy.EncryptionPolicyHandler;
+
+/**
+ * Invoker that applies policies before invocation for the sample echo binding.
+ */
+public class EchoBindingPoliciedInvoker implements Invoker {
+ List<PolicySet> policies = null;
+ Map<QName, PolicyHandler> policyHandlers = new HashMap<QName, PolicyHandler>();
+
+ public EchoBindingPoliciedInvoker(List<PolicySet> policies) {
+ this.policies = policies;
+ policyHandlers.put(new QName("http://test","EncryptionPolicy"),
+ new EncryptionPolicyHandler());
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+
+ applyPolicies(args);
+
+ // echo back the first parameter, a real binding would invoke some API for flowing the request
+ Object result = args[0];
+
+ msg.setBody(result);
+
+ } catch (Exception e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ private void applyPolicies(Object[] args) throws Exception {
+ for ( PolicySet policySet : policies ) {
+ PolicyHandler policyHandler = policyHandlers.get(policySet.getName());
+ policyHandler.applyPolicy(args, policySet);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java
new file mode 100644
index 0000000000..ba74d8f99a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.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 echo.provider;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+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(ExtensionPointRegistry extensionPoints) {
+ ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = factories.getFactory(MessageFactory.class);
+ }
+
+ 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-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
new file mode 100644
index 0000000000..0efc319af9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.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 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.policy.PolicySetAttachPoint;
+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.
+ */
+class EchoReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private EchoBinding binding;
+
+ EchoReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ EchoBinding binding) {
+ this.reference = reference;
+ this.binding = binding;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ if (binding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)binding;
+ if ( !policySetAttachPoint.getPolicySets().isEmpty() ){
+ return new EchoBindingPoliciedInvoker(policySetAttachPoint.getPolicySets());
+ }
+ }
+ return new EchoBindingInvoker();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
new file mode 100644
index 0000000000..1cd1e5af4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.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 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.EchoServiceListener;
+
+/**
+ * Implementation of the Echo binding provider.
+ */
+class EchoServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private EchoBinding binding;
+ private MessageFactory messageFactory;
+
+ 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 boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ 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 = binding.getURI();
+ EchoServer.getServer().register(uri, new EchoServiceListener(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-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java
new file mode 100644
index 0000000000..33dc761aa4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.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 echo.provider.policy;
+
+/**
+ */
+public class EchoBindingEncryptionPolicy extends EchoBindingPolicy {
+
+ private String encryptionStrategyClassName;
+ private Class<? extends EncryptionStrategy> strategyClass;
+
+ public String getEncryptionStrategyClassName() {
+ return encryptionStrategyClassName;
+ }
+ public void setEncryptionStrategyClassName(String encryptionStrategyClassName) {
+ this.encryptionStrategyClassName = encryptionStrategyClassName;
+ }
+ public Class<? extends EncryptionStrategy> getStrategyClass() {
+ return strategyClass;
+ }
+ public void setStrategyClass(Class<? extends EncryptionStrategy> strategy) {
+ this.strategyClass = strategy;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java
new file mode 100644
index 0000000000..c847d088a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.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 echo.provider.policy;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+
+/**
+ *
+ */
+public class EchoBindingEncryptionPolicyProcessor extends EchoBindingPolicyProcessor<EchoBindingEncryptionPolicy> {
+
+ public EchoBindingEncryptionPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ }
+
+ public Class<EchoBindingEncryptionPolicy> getModelType() {
+ return EchoBindingEncryptionPolicy.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java
new file mode 100644
index 0000000000..7d38e3b7a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.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 echo.provider.policy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+
+ */
+public class EchoBindingPolicy implements Policy {
+ private boolean unresolved = true;
+
+ public QName getSchemaName() {
+ return new QName("http://sample/policy","echoBindingPolicy");
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java
new file mode 100644
index 0000000000..72b8002238
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.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 echo.provider.policy;
+
+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.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;
+
+/**
+ *
+ */
+public abstract class EchoBindingPolicyProcessor<T extends EchoBindingPolicy> implements StAXArtifactProcessor<T> {
+ public static final String ENCRYPTION = "Encryption";
+
+ public QName getArtifactType() {
+ return new QName("http://sample/policy", "echoBindingPolicy");
+ }
+
+ public T read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.equals(ENCRYPTION)) {
+ EchoBindingEncryptionPolicy policy = new EchoBindingEncryptionPolicy();
+ policy.setEncryptionStrategyClassName(reader.getAttributeValue(null, "strategy"));
+ return (T)policy;
+ }
+ return null;
+ }
+
+ public void write(T arg0, XMLStreamWriter arg1) throws ContributionWriteException, XMLStreamException {
+ }
+
+ public void resolve(T policy, ModelResolver resolver) throws ContributionResolveException {
+ if (policy instanceof EchoBindingEncryptionPolicy) {
+ EchoBindingEncryptionPolicy ePolicy = (EchoBindingEncryptionPolicy)policy;
+
+ ClassReference classReference = new ClassReference(ePolicy.getEncryptionStrategyClassName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class javaClass = classReference != null ? classReference.getJavaClass() : null;
+ if (javaClass == null) {
+ //throw new ContributionResolveException(new ClassNotFoundException(ePolicy.getEncryptionStrategyClass()));
+ }
+ //ePolicy.setStrategyClass(javaClass);
+ //FIXME: need to resolve this thro resolver
+ try {
+ ePolicy.setStrategyClass((Class<? extends EncryptionStrategy>)Class.forName(ePolicy
+ .getEncryptionStrategyClassName()));
+ } catch (Exception e) {
+ throw new ContributionResolveException(e);
+ }
+ ePolicy.setStrategyClass(ePolicy.getStrategyClass());
+ ePolicy.setUnresolved(false);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java
new file mode 100644
index 0000000000..deda8d9744
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.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.policy;
+
+import org.apache.tuscany.sca.policy.Policy;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Sample policy handler
+ */
+public class EncryptionPolicyHandler implements PolicyHandler {
+
+ public void applyPolicy(Object msg, PolicySet policySet) throws Exception {
+ for ( Object aPolicy : policySet.getPolicies() ) {
+ if ( aPolicy instanceof EchoBindingEncryptionPolicy ) {
+ encrypt(msg, (EchoBindingEncryptionPolicy)aPolicy);
+ }
+ }
+ }
+
+ private void encrypt(Object msg, EchoBindingEncryptionPolicy policy) throws Exception {
+ if ( !policy.isUnresolved() && msg instanceof Object[] ) {
+ EncryptionStrategy strategy = policy.getStrategyClass().newInstance();
+ Object[] msgArgs = (Object[])msg;
+ for ( int count = 0 ; count < msgArgs.length ; ++count ) {
+ msgArgs[count] = strategy.encryptMessage(msgArgs[count]);
+ }
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java
new file mode 100644
index 0000000000..ffadfc7fff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.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 echo.provider.policy;
+
+/**
+
+ */
+public interface EncryptionStrategy {
+ Object encryptMessage(Object msg);
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java
new file mode 100644
index 0000000000..6fa5f26977
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.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.provider.policy;
+
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Sample Policy Handler Interface
+ *
+ */
+public interface PolicyHandler {
+ void applyPolicy(Object msg, PolicySet policySet) throws Exception;
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java
new file mode 100644
index 0000000000..cf55b36fc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.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.provider.policy;
+
+/**
+ */
+public class ReverseEncryptionStrategy implements EncryptionStrategy {
+
+ public Object encryptMessage(Object msg) {
+ if ( msg instanceof String ) {
+ StringBuffer sb = new StringBuffer((String)msg);
+ msg = sb.reverse().toString();
+ }
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java
new file mode 100644
index 0000000000..ac610cfb51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.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 echo.provider.policy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+
+ */
+public class WSPolicy implements Policy {
+ private boolean unresolved = true;
+
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java
new file mode 100644
index 0000000000..fcb250b444
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.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 echo.provider.policy;
+
+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;
+
+public class WSPolicyProcessor implements StAXArtifactProcessor<WSPolicy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public WSPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ //FIXME Implement this method
+ return new WSPolicy();
+ }
+
+ public void write(WSPolicy wsPolicy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ //FIXME Implement this method
+ }
+
+ public Class<WSPolicy> getModelType() {
+ return WSPolicy.class;
+ }
+
+ public void resolve(WSPolicy wsPolicy, ModelResolver modelResolver) throws ContributionResolveException {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java
new file mode 100644
index 0000000000..8ea2395d04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.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 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, EchoServiceListener> services = new HashMap<String, EchoServiceListener>();
+
+ public static void start() {
+ }
+
+ public static void stop() {
+ }
+
+ public static EchoServer getServer() {
+ if (server == null)
+ server = new EchoServer();
+ return server;
+ }
+
+ /**
+ * Register a service under the given name.
+ *
+ * @param service
+ * @param name
+ */
+ public void register(String uri, EchoServiceListener service) {
+ if (services.isEmpty()) {
+ start();
+ }
+ services.put(uri, service);
+ }
+
+ public void unregister(String uri) {
+ services.remove(uri);
+ if (services.isEmpty()) {
+ stop();
+ }
+ }
+
+ /**
+ * 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-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java
new file mode 100644
index 0000000000..32336dd94f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.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.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;
+
+public class EchoServiceListener {
+ private Invoker invoker;
+ private MessageFactory messageFactory;
+
+ public EchoServiceListener(Invoker invoker, MessageFactory messageFactory) {
+ super();
+ this.invoker = invoker;
+ this.messageFactory = messageFactory;
+ }
+
+ public String sendReceive(String input) throws InvocationTargetException {
+
+ // Create a request message
+ 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-android/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory
new file mode 100644
index 0000000000..55be293862
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 binding model factory
+echo.impl.EchoBindingFactoryImpl
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..06d53250c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -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.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://echo#binding.echo,model=echo.EchoBinding,factory=echo.EchoBindingFactory
+echo.provider.policy.EchoBindingEncryptionPolicyProcessor;qname=http://sample/policy#echoBindingPolicy,model=echo.provider.policy.EchoBindingEncryptionPolicy
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#PolicyAttachment,model=echo.provider.policy.WSPolicy
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..4ad61f573d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# URI of the XML schema to be used for validation
+sample-binding-echo.xsd
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..efa475ef92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 binding provider extension
+echo.provider.EchoBindingProviderFactory;model=echo.EchoBinding
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd
new file mode 100644
index 0000000000..9b64df4871
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/main/resources/sample-binding-echo.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://echo"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:e="http://echo"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0"/>
+
+ <element name="binding.echo" type="e:EchoBinding"/>
+
+ <complexType name="EchoBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/Echo.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/Echo.java
new file mode 100644
index 0000000000..1d5e973f33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/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-android/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java
new file mode 100644
index 0000000000..ba68dfe908
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/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-android/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java
new file mode 100644
index 0000000000..7383077f18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.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 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;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ service = scaDomain.getService(Echo.class, "EchoComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() {
+ String result = service.echo("foo");
+ assertEquals(result, "oof");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java
new file mode 100644
index 0000000000..ab05516622
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.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 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;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() throws Exception {
+ String result = EchoServer.getServer().sendReceive("http://tempuri.org", "foo");
+ assertEquals(result, "oof");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/resources/EchoBinding.composite b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
new file mode 100644
index 0000000000..176d67cc4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/resources/EchoBinding.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"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/echo"
+ xmlns:se="http://sample/echo"
+ xmlns:e="http://echo"
+ xmlns:p="http://sample/policy"
+ xmlns:t="http://test"
+ name="EchoBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="echo.Echo"/>
+ <e: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"/>
+ <e:binding.echo uri="http://tempuri.org" policySets="t:EncryptionPolicy" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/resources/definitions.xml b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/resources/definitions.xml
new file mode 100644
index 0000000000..1cb1d1c9ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo-extension/src/test/resources/definitions.xml
@@ -0,0 +1,39 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:e="http://echo"
+ xmlns:p="http://sample/policy">
+ <!-- POLICY SETS -->
+ <sca:policySet name="EncryptionPolicy"
+ provides="confidentiality"
+ appliesTo="e:binding.echo">
+ <p:echoBindingPolicy name="Encryption" strategy="echo.provider.policy.ReverseEncryptionStrategy" />
+ </sca:policySet>
+
+ <sca:intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </sca:intent>
+</sca:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo/README b/sca-java-1.x/branches/sca-android/samples/binding-echo/README
new file mode 100644
index 0000000000..2772460cc6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo/README
@@ -0,0 +1,104 @@
+Binding Echo Sample Application
+===============================
+This sample demonstrates how to use the new binding extension
+binding-echo-extension.
+
+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-extension\target\sample-binding-echo-extension.jar;target\sample-binding-echo.jar echo.EchoBindingClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo-extension/target/sample-binding-echo-extension.jar:target/sample-binding-echo.jar echo.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-extension.jar - the new echo binding extension implementation
+sample-binding-echo - the application that uses the echo binding
+
+Note: this sample currently is not working on Linux
+
+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/
+ src/
+ main/
+ java/
+ echo/
+ Echo.java - interface definition for the sample
+ reference and service
+ EchoComponentImpl.java - sample component implementation with
+ echo binding reference
+ EchoBindingClient.java - sample client
+ resources/
+ EchoBinding.composite - the SCA assembly for this sample
+ test/
+ java/
+ echo
+ EchoBindingTestCase.java - sample JUnit test case for the sample
+ client
+ binding-echo.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
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Passing thro invoker...
+ [java] Returned message: foo
+ [java] Echo reference = foo
+ [java] Passing thro invoker...
+ [java] Returned message: bar
+ [java] Echo service = bar
+
+
+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
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running echo.EchoBindingTestCase
+Passing thro invoker...
+Returned message: foo
+Passing thro invoker...
+Returned message: bar
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.811 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-android/samples/binding-echo/binding-echo.png b/sca-java-1.x/branches/sca-android/samples/binding-echo/binding-echo.png
new file mode 100644
index 0000000000..a38d985363
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo/binding-echo.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo/binding-echo.svg b/sca-java-1.x/branches/sca-android/samples/binding-echo/binding-echo.svg
new file mode 100644
index 0000000000..5b5051bef5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo/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-android/samples/binding-echo/build.xml b/sca-java-1.x/branches/sca-android/samples/binding-echo/build.xml
new file mode 100644
index 0000000000..7689ef3a54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-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="binding-echo" default="compile">
+ <property name="test.class" value="echo.EchoBindingClient" />
+ <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="../binding-echo-extension/target/sample-binding-echo-extension.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-extension/target/sample-binding-echo-extension.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-extension/target/sample-binding-echo-extension.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-android/samples/binding-echo/pom.xml b/sca-java-1.x/branches/sca-android/samples/binding-echo/pom.xml
new file mode 100644
index 0000000000..9c14b5d4c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo/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>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-echo</artifactId>
+ <name>Apache Tuscany SCA 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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-binding-echo-extension</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-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-android/samples/binding-echo/src/main/java/echo/Echo.java b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/java/echo/Echo.java
new file mode 100644
index 0000000000..1d5e973f33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/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-android/samples/binding-echo/src/main/java/echo/EchoBindingClient.java b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoBindingClient.java
new file mode 100644
index 0000000000..21bdff4011
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoBindingClient.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 echo;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+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("http://tempuri.org", "bar");
+ System.out.println("Echo service = " + echoString );
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java
new file mode 100644
index 0000000000..ba68dfe908
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/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-android/samples/binding-echo/src/main/resources/EchoBinding.composite b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/resources/EchoBinding.composite
new file mode 100644
index 0000000000..94612fb325
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/main/resources/EchoBinding.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/echo"
+ xmlns:se="http://sample/echo"
+ xmlns:e="http://echo"
+ name="EchoBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="echo.Echo"/>
+ <e: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"/>
+ <e:binding.echo uri="http://tempuri.org" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java
new file mode 100644
index 0000000000..1a597fc80f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.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 echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.Echo;
+import echo.server.EchoServer;
+
+public class EchoBindingTestCase 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("http://tempuri.org", "bar");
+ assertEquals(echoString, "bar");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator-lean/README b/sca-java-1.x/branches/sca-android/samples/calculator-lean/README
new file mode 100644
index 0000000000..a8aff232c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/README
@@ -0,0 +1,87 @@
+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:
+
+java -jar <tuscany-install>/modules/tuscany-node-launcher.jar Calculator.composite target/sample-calculator-lean.jar
+
+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
+ CalculatorServiceImpl.java
+ AddService.java - adds two numbers
+ AddServiceImpl.java
+ SubtractService.java - subtracts one number from another
+ SubtractServiceImpl.java
+ MultiplyService.java - multiplies two numbers
+ MultiplyServiceImpl.java
+ DivideService.java - divides one number by another
+ DivideServiceImpl.java
+ CalculatorClient.java - a client component that calls the
+ Calculator services
+ resources/
+ Calculator.composite - the SCA assembly for this sample
+ test/
+ java/
+ calculator/
+ CalculatorTestCase.java - JUnit test case
+ 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-android/samples/calculator-lean/calculator.png b/sca-java-1.x/branches/sca-android/samples/calculator-lean/calculator.png
new file mode 100644
index 0000000000..995a57b1fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/calculator.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator-lean/calculator.svg b/sca-java-1.x/branches/sca-android/samples/calculator-lean/calculator.svg
new file mode 100644
index 0000000000..0615925c50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/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-android/samples/calculator-lean/pom.xml b/sca-java-1.x/branches/sca-android/samples/calculator-lean/pom.xml
new file mode 100644
index 0000000000..10f4ae110f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/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>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-lean</artifactId>
+ <name>Apache Tuscany SCA 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-node-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-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-android/samples/calculator-lean/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..188451ebac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/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-android/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..7ca8fb04b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..2bb8f96dcf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorClient.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 org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+@Scope("COMPOSITE") @EagerInit
+public class CalculatorClient {
+
+ private CalculatorService calculatorService;
+
+ @Reference
+ public void setCalculatorService(CalculatorService calculatorService) {
+ this.calculatorService = calculatorService;
+ }
+
+ @Init
+ public void calculate() {
+
+ // 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-android/samples/calculator-lean/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/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-android/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..3d861f2018
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/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-android/samples/calculator-lean/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/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-android/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..1323edf55a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/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-android/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..91b803bc9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/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-android/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..58cc4a3547
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/resources/Calculator.composite b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..913081b9be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/resources/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ 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>
+
+ <component name="CalculatorClient">
+ <implementation.java class="calculator.CalculatorClient"/>
+ <reference name="calculatorService" target="CalculatorServiceComponent" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/resources/CalculatorTest.composite b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/resources/CalculatorTest.composite
new file mode 100644
index 0000000000..906e2a3918
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/main/resources/CalculatorTest.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorTest">
+
+ <include name="sample:Calculator"/>
+
+ <component name="CalculatorTestCase">
+ <implementation.java class="calculator.CalculatorTestCase"/>
+ <reference name="calculatorService" target="CalculatorServiceComponent" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..a007a28f21
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.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 calculator;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * This shows how to test the Calculator composition.
+ */
+@Scope("COMPOSITE") @EagerInit
+public class CalculatorTestCase extends TestCase {
+
+ private static CalculatorService calculatorService;
+ private SCANode node;
+
+ @Reference
+ public void setCalculatorService(CalculatorService calculatorService) {
+ CalculatorTestCase.calculatorService = calculatorService;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ node = factory.createSCANodeFromClassLoader("CalculatorTest.composite", getClass().getClassLoader());
+ node.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ 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-android/samples/calculator/README b/sca-java-1.x/branches/sca-android/samples/calculator/README
new file mode 100644
index 0000000000..ceb532faed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/README
@@ -0,0 +1,97 @@
+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
+ CalculatorServiceImpl.java
+ AddService.java - adds two numbers
+ AddServiceImpl.java
+ SubtractService.java - subtracts one number from another
+ SubtractServiceImpl.java
+ MultiplyService.java - multiplies two numbers
+ MultiplyServiceImpl.java
+ DivideService.java - divides one number by another
+ DivideServiceImpl.java
+ 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
+ test/
+ java/
+ calculator/
+ CalculatorTestCase.java - JUnit test case
+ 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-android/samples/calculator/build.xml b/sca-java-1.x/branches/sca-android/samples/calculator/build.xml
new file mode 100644
index 0000000000..c4b755ef94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/calculator/calculator.png b/sca-java-1.x/branches/sca-android/samples/calculator/calculator.png
new file mode 100644
index 0000000000..995a57b1fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/calculator.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator/calculator.svg b/sca-java-1.x/branches/sca-android/samples/calculator/calculator.svg
new file mode 100644
index 0000000000..0615925c50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/calculator/pom.xml b/sca-java-1.x/branches/sca-android/samples/calculator/pom.xml
new file mode 100644
index 0000000000..4a2216c2e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/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>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator</artifactId>
+ <name>Apache Tuscany SCA 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-node-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-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-android/samples/calculator/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..188451ebac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/calculator/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..7ca8fb04b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..3b2966e96d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorClient.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 calculator;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * 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 {
+
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ SCANode node = factory.createSCANodeFromClassLoader("Calculator.composite", CalculatorClient.class.getClassLoader());
+ node.start();
+
+ CalculatorService calculatorService = ((SCAClient)node).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));
+
+ node.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..3d861f2018
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/calculator/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/calculator/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..1323edf55a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/DivideServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..91b803bc9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..58cc4a3547
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractServiceImpl.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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/calculator/src/main/resources/Calculator.composite b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..90872041b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/src/main/resources/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ 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-android/samples/calculator/src/test/java/calculator/CalculatorTestCase.java b/sca-java-1.x/branches/sca-android/samples/calculator/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..1b7476534a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/calculator/src/test/java/calculator/CalculatorTestCase.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 calculator;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCANode node;
+
+ @Override
+ protected void setUp() throws Exception {
+ SCANodeFactory factory = SCANodeFactory.newInstance();
+ node = factory.createSCANodeFromClassLoader("Calculator.composite", getClass().getClassLoader());
+ node.start();
+
+ calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ node.stop();
+ }
+
+ 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-android/samples/databinding-echo/README b/sca-java-1.x/branches/sca-android/samples/databinding-echo/README
new file mode 100644
index 0000000000..67c1aa32d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/databinding-echo/README
@@ -0,0 +1,143 @@
+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-extension\target\sample-binding-echo-extension.jar;target\sample-databinding-echo.jar dbecho.EchoDataBindingClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo-extension/target/sample-binding-echo-extension.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/
+ META-INF/
+ services/
+ org.apache.tuscany.sca.core.ModuleActivator - specifies the module activation class to call
+ 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 dbecho.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-android/samples/databinding-echo/build.xml b/sca-java-1.x/branches/sca-android/samples/databinding-echo/build.xml
new file mode 100644
index 0000000000..7f2483f6fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-extension/target/sample-binding-echo-extension.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-extension/target/sample-binding-echo-extension.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-extension/target/sample-binding-echo-extension.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-android/samples/databinding-echo/databinding-echo.png b/sca-java-1.x/branches/sca-android/samples/databinding-echo/databinding-echo.png
new file mode 100644
index 0000000000..afbbfff285
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/databinding-echo/databinding-echo.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/samples/databinding-echo/databinding-echo.svg b/sca-java-1.x/branches/sca-android/samples/databinding-echo/databinding-echo.svg
new file mode 100644
index 0000000000..87964abf86
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/databinding-echo/pom.xml b/sca-java-1.x/branches/sca-android/samples/databinding-echo/pom.xml
new file mode 100644
index 0000000000..3ef0bcfbf5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/databinding-echo/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-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>sample-databinding-echo</artifactId>
+ <name>Apache Tuscany SCA 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>tuscany-sca-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-binding-echo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.4-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-android/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java b/sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java
new file mode 100644
index 0000000000..5679614164
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.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 dbecho;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentAImpl implements Interface1 {
+
+ private Interface1 componentBReference;
+
+ @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);
+ }
+
+ @Property(name="prefix1")
+ public void setPrefix1(String prefix1) {
+ System.out.println("[Property] prefix1: " + prefix1);
+ }
+
+ /**
+ * @param bar the bar to set
+ */
+ @Property(name="bar")
+ public void setBar(String bar) {
+ System.out.println("[Property] bar: " + bar);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/databinding-echo/src/main/java/dbecho/Echo.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/databinding-echo/src/main/java/dbecho/Interface1.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/databinding-echo/src/main/java/dbecho/Interface2.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/databinding-echo/src/main/resources/EchoDataBinding.composite b/sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/resources/EchoDataBinding.composite
new file mode 100644
index 0000000000..30b77a6152
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/resources/EchoDataBinding.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: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"
+ xmlns:e="http://echo"
+ 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"/>
+ <!-- Replaced interface.wsdl by interface.java because TUSCANY-2324 fix uses the interface specified here
+ <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>
+ -->
+ <e: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> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/implementation-composite/README b/sca-java-1.x/branches/sca-android/samples/implementation-composite/README
new file mode 100644
index 0000000000..27de00e8ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-composite/README
@@ -0,0 +1,116 @@
+Composite Implementation Sample
+===============================
+
+This sample shows how composites 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
+ SourceImpl.java - implementation for the source component
+ SourceCallback.java - source component callback interface
+ Target.java - interface for the target component
+ TargetImpl.java - implementation for the target component
+ CompositeClient.java - starts the SCA Runtime and
+ deploys the OuterComposite.composite.
+ This in turn pulls in the two inner
+ composites
+ resources/
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ OuterComposite.composite - the top level SCA assembly for this sample
+ InnerComposite.composite - included by OuterComposite.composite
+ InnerComposite2.composite - included by OuterComposite.composite
+ test/
+ java/
+ composite/
+ CompositeTestCase.java - JUnit test case
+ 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
+ [java] Work thread Thread[pool-1-thread-2,5,main]
+ [java] Result: Client.main => Source.clientMethod2 -> Target.someMethod
+
+
+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.clientMethod2
+Work thread Thread[pool-1-thread-2,5,main]
+Result: Client.main => Source.clientMethod2 -> Target.someMethod
+Target: Client.main -> Source.clientMethod
+Work thread Thread[pool-1-thread-1,5,main]
+Result: Client.main -> Source.clientMethod -> Target.someMethod
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.973 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-android/samples/implementation-composite/build.xml b/sca-java-1.x/branches/sca-android/samples/implementation-composite/build.xml
new file mode 100644
index 0000000000..7aa31aab8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/implementation-composite/implementation-composite.png b/sca-java-1.x/branches/sca-android/samples/implementation-composite/implementation-composite.png
new file mode 100644
index 0000000000..4c6d71bc03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-composite/implementation-composite.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-composite/implementation-composite.svg b/sca-java-1.x/branches/sca-android/samples/implementation-composite/implementation-composite.svg
new file mode 100644
index 0000000000..0e60354aab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/implementation-composite/pom.xml b/sca-java-1.x/branches/sca-android/samples/implementation-composite/pom.xml
new file mode 100644
index 0000000000..229061acb1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-composite/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-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-composite</artifactId>
+ <name>Apache Tuscany SCA Composite 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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-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-android/samples/implementation-composite/src/main/java/composite/CompositeClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/implementation-composite/src/main/java/composite/Source.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/implementation-composite/src/main/java/composite/SourceCallback.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/implementation-composite/src/main/java/composite/SourceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/implementation-composite/src/main/java/composite/Target.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/implementation-composite/src/main/java/composite/TargetImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/implementation-composite/src/main/resources/InnerComposite.composite b/sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite.composite
new file mode 100644
index 0000000000..3376ac8ff5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/implementation-composite/src/main/resources/InnerComposite2.composite b/sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite2.composite
new file mode 100644
index 0000000000..c9eff4fa9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..e675fd3624
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/implementation-composite/src/main/resources/OuterComposite.composite b/sca-java-1.x/branches/sca-android/samples/implementation-composite/src/main/resources/OuterComposite.composite
new file mode 100644
index 0000000000..cb1c1e13d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java b/sca-java-1.x/branches/sca-android/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java
new file mode 100644
index 0000000000..9e9a4b44a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-composite/src/test/java/composite/CompositeTestCase.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 composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Source source;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance();
+ source = scaDomain.getService(Source.class, "SourceComponent");
+ }
+
+ @Override
+ 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-android/samples/implementation-crud-extension/README b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/README
new file mode 100644
index 0000000000..5e8190648f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/README
@@ -0,0 +1,83 @@
+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 sample that provides the necessary client
+code to bring up an application that uses this implementation extension.
+
+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-extension/
+ src/
+ main/
+ java/
+ crud/ - implementation model interfaces
+ backend/ - fake component implementation
+ impl/ - implementations of the model interfaces
+ provider/ - runtime implementation
+ resources/
+ META-INF/
+ services/ - declares the extension
+ test/
+ java/
+ crud/
+ CRUDTestCase.java - JUnit test case
+ 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-extension
+ant compile
+
+See the implementation-crud sample to run a sample that uses this
+implementation extension.
+
+Building The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built
+using Maven as follows.
+
+cd implementation-crud-extension
+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-android/samples/implementation-crud-extension/build.xml b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/build.xml
new file mode 100644
index 0000000000..88d308e6fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/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-extension" default="compile">
+ <property name="test.jar" value="sample-implementation-crud-extension.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-android/samples/implementation-crud-extension/pom.xml b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/pom.xml
new file mode 100644
index 0000000000..c11953f0ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-crud-extension</artifactId>
+ <name>Apache Tuscany SCA 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>tuscany-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-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-android/samples/implementation-crud-extension/src/main/java/crud/CRUD.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUD.java
new file mode 100644
index 0000000000..b23d85887b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/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-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java
new file mode 100644
index 0000000000..49be844f93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.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 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-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java
new file mode 100644
index 0000000000..fa83c63c1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.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 crud;
+
+import crud.CRUDImplementation;
+
+
+/**
+ * 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-android/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java
new file mode 100644
index 0000000000..cc0795a735
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.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 crud.backend;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A fake resource manager implementation used as a backend by the sample
+ * CRUD component implementation.
+ */
+public class ResourceManager {
+ 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);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java
new file mode 100644
index 0000000000..2f1e5fcba8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.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 crud.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+import crud.CRUDImplementation;
+import crud.CRUDImplementationFactory;
+
+
+/**
+ * A factory for the CRUD implementation model.
+ */
+public class CRUDImplementationFactoryImpl implements CRUDImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ public CRUDImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ }
+
+ public CRUDImplementation createCRUDImplementation() {
+ return new CRUDImplementationImpl(assemblyFactory, javaFactory);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java
new file mode 100644
index 0000000000..383a035e69
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.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 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 crud.CRUD;
+import crud.CRUDImplementation;
+
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ */
+class CRUDImplementationImpl implements CRUDImplementation {
+
+ private Service crudService;
+ private String directory;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ CRUDImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+
+ // 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 = javaFactory.createJavaInterface(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 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-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java
new file mode 100644
index 0000000000..b212ee3c9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.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 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 an invoker for CRUD component implementations.
+ *
+ * The invoker is responsible for handling invocations of a business operation.
+ * Input business data is passed to the invoke method in a Message object.
+ * The invoke method is responsible for handling the invocation and returning a Message with
+ * the output business data.
+ *
+ * In this example we are simply delegating the CRUD operation invocations to the
+ * corresponding methods on our fake resource manager class.
+ *
+ * More sophisticated invokers can delegate the invocation to an implementation artifact directly
+ * (for example a Java class using reflection as in the implementation-pojo sample) or call a runtime
+ * engine like a BPEL engine or an XQuery engine for example (this is what the Tuscany
+ * implementation-bpel and implementation-xquery extensions do).
+ */
+class CRUDImplementationInvoker implements Invoker {
+ private Operation operation;
+ private ResourceManager resourceManager;
+
+ CRUDImplementationInvoker(Operation operation, ResourceManager resourceManager) {
+ this.operation = operation;
+ this.resourceManager = resourceManager;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = null;
+
+ if (operation.getName().equals("create")) {
+ resp = resourceManager.createResource(args[0]);
+
+ } else if (operation.getName().equals("retrieve")) {
+ resp = resourceManager.retrieveResource((String)args[0]);
+
+ } else if (operation.getName().equals("update")) {
+ resp = resourceManager.updateResource((String)args[0], args[1]);
+
+ } else if (operation.getName().equals("delete")) {
+ resourceManager.deleteResource((String)args[0]);
+ }
+
+ msg.setBody(resp);
+ } catch (Exception e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java
new file mode 100644
index 0000000000..8f11f9d910
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.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.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;
+
+
+/**
+ * An implementation provider for sample CRUD implementations.
+ *
+ * The implementation provider is responsible for handling the lifecycle of a component
+ * implementation and creating operation invokers for the service operations provided
+ * by the implementation.
+ *
+ * The start() and stop() methods are called when a component is started
+ * and stopped.
+ *
+ * The createInvoker method is called for each operation provided by the component
+ * implementation. The implementation provider can create an invoker and initialize it
+ * at that time to minimize the amount of work to be performed on each invocation.
+ */
+class CRUDImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private CRUDImplementation implementation;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ CRUDImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ CRUDImplementationInvoker invoker = new CRUDImplementationInvoker(operation, new ResourceManager(implementation.getDirectory()));
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ 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-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java
new file mode 100644
index 0000000000..4566cb7155
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.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.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+import crud.CRUDImplementation;
+import crud.provider.CRUDImplementationProvider;
+
+
+/**
+ * A factory for CRUD implementation providers.
+ *
+ * The factory is called to create an implementation provider for each component using
+ * the CRUD implementation.
+ */
+public class CRUDImplementationProviderFactory implements ImplementationProviderFactory<CRUDImplementation> {
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ 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-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory
new file mode 100644
index 0000000000..3cf5de5fa1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 implementation model factory
+crud.impl.CRUDImplementationFactoryImpl
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..17c98cf706
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://crud#implementation.crud,model=crud.CRUDImplementation,factory=crud.CRUDImplementationFactory
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..527c626418
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# URI of the XML schema to be used for validation
+sample-implementation-crud.xsd
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..6ce605197a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 implementation extension
+crud.provider.CRUDImplementationProviderFactory;model=crud.CRUDImplementation
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd
new file mode 100644
index 0000000000..447e31bf93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.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://crud"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:c="http://crud"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0"/>
+
+ <element name="implementation.crud" type="c:CRUDImplementation"/>
+
+ <complexType name="CRUDImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <attribute name="directory" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java
new file mode 100644
index 0000000000..0bb5cfc361
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.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 crud;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import crud.CRUD;
+
+/**
+ * Tests the CRUD implementation extension.
+ */
+public class CRUDTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CRUD crudService;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("crud.composite");
+ crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
+ }
+
+ @Override
+ 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-android/samples/implementation-crud-extension/src/test/resources/crud.composite b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/src/test/resources/crud.composite
new file mode 100644
index 0000000000..18745033bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud-extension/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-android/samples/implementation-crud/README b/sca-java-1.x/branches/sca-android/samples/implementation-crud/README
new file mode 100644
index 0000000000..50da631c04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud/README
@@ -0,0 +1,113 @@
+Implementation CRUD Sample Client
+=================================
+This sample demonstrates how to use the new implementation extension,
+implementation-crud-extension.
+
+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-extension\target\sample-implementation-crud-extension.jar;target\sample-implementation-crud.jar crud.client.CRUDClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:../implementation-crud-extension/target/sample-implementation-crud-extension.jar:target/sample-implementation-crud.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-extension.jar - the new crud implementation
+ extension
+sample-implementation-crud.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-extension sample for details of this implementation type.
+
+implementation-crud/
+ src/
+ main/
+ java/
+ crud/
+ client/
+ CRUDClient.java - sample client
+ resources/
+ crud.composite - the SCA assembly used by this sample
+
+ test/
+ java/
+ crud/
+ client/
+ CRUDTestCase.java - sample JUnit test case for the sample client
+
+ implementation-crud.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
+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
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running crud.client.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: 0.641 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-android/samples/implementation-crud/build.xml b/sca-java-1.x/branches/sca-android/samples/implementation-crud/build.xml
new file mode 100644
index 0000000000..10b26b5a94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud/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" default="compile">
+ <property name="test.class" value="crud.client.CRUDClient" />
+ <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="../implementation-crud-extension/target/sample-implementation-crud-extension.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-extension/target/sample-implementation-crud-extension.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-extension/target/sample-implementation-crud-extension.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-android/samples/implementation-crud/implementation-crud.png b/sca-java-1.x/branches/sca-android/samples/implementation-crud/implementation-crud.png
new file mode 100644
index 0000000000..a292037e7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud/implementation-crud.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud/implementation-crud.svg b/sca-java-1.x/branches/sca-android/samples/implementation-crud/implementation-crud.svg
new file mode 100644
index 0000000000..dbb37be208
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud/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-android/samples/implementation-crud/pom.xml b/sca-java-1.x/branches/sca-android/samples/implementation-crud/pom.xml
new file mode 100644
index 0000000000..3cc75a6f7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud/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>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-crud</artifactId>
+ <name>Apache Tuscany SCA 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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-implementation-crud-extension</artifactId>
+ <version>1.4-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-android/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java
new file mode 100644
index 0000000000..ea87cb3001
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud/src/main/java/crud/client/CRUDClient.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 crud.client;
+
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import crud.CRUD;
+
+/**
+ * A sample client that shows how to create an SCA domain, get a service, and
+ * invoke service methods of a CRUD component.
+ *
+ * The CRUD component uses an <implementation.crud> implementation extension
+ * from module implementation-crud-extension.
+ *
+ * @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);
+ System.out.println("Result from delete: " + result);
+
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-crud/src/main/resources/crud.composite b/sca-java-1.x/branches/sca-android/samples/implementation-crud/src/main/resources/crud.composite
new file mode 100644
index 0000000000..18745033bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud/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-android/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java b/sca-java-1.x/branches/sca-android/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java
new file mode 100644
index 0000000000..7e0476a8b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.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 crud.client;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import crud.CRUD;
+
+
+/**
+ * Tests the sample crud composite.
+ */
+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-android/samples/implementation-pojo-extension/README b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/README
new file mode 100644
index 0000000000..3b201779e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/README
@@ -0,0 +1,70 @@
+Implementation POJO 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.
+
+Sample Overview
+---------------
+This sample contains a POJO implementation type as an example of how to create
+new implementation types.
+
+implementation-pojo-extension/
+ src/
+ main/
+ java/
+ pojo/ - implementation model interfaces
+ impl/ - implementations of the model interfaces
+ provider/ - runtime implementation
+ resources/
+ META-INF/
+ services/ - declares the extension
+ test/
+ java/
+ helloworld/
+ HelloWorldTestCase.java - JUnit test case
+ resources/
+ helloworld.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-pojo-extension
+ant compile
+
+Building The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built
+using Maven as follows.
+
+cd implementation-pojo-extension
+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 helloworld.HelloWorldTestCase
+Initializing POJO
+Initializing POJO
+Executing POJO sayHello
+Initializing POJO
+Initializing POJO
+Executing POJO sayHello
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.616 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-android/samples/implementation-pojo-extension/build.xml b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/build.xml
new file mode 100644
index 0000000000..78bae79859
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/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-pojo-extension" default="compile">
+ <property name="test.jar" value="sample-implementation-pojo-extension.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-android/samples/implementation-pojo-extension/pom.xml b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/pom.xml
new file mode 100644
index 0000000000..d7bb120e93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-pojo-extension</artifactId>
+ <name>Apache Tuscany SCA POJO 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>tuscany-assembly-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-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-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java
new file mode 100644
index 0000000000..7c2f5d236f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.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 pojo;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+
+/**
+ * Represents a POJO implementation in an SCA assembly.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface POJOImplementation extends Implementation {
+
+ /**
+ * Returns the POJO class name
+ * @return
+ */
+ public String getPOJOName();
+
+ /**
+ * Sets the POJO class name
+ * @param pojoName
+ */
+ public void setPOJOName(String pojoName);
+
+ /**
+ * Returns the POJO class.
+ * @return
+ */
+ public Class<?> getPOJOClass();
+
+ /**
+ * Sets the POJO class.
+ * @param pojoClass
+ */
+ public void setPOJOClass(Class<?> pojoClass);
+
+ /**
+ * Returns the POJO's methods.
+ * @return
+ */
+ public Map<String, Method> getMethods();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java
new file mode 100644
index 0000000000..bbcfb3d0dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.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 pojo;
+
+
+/**
+ * Factory for the POJO implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface POJOImplementationFactory {
+
+ /**
+ * Creates a new POJO implementation model object.
+ * @return a new POJO implementation model object
+ */
+ POJOImplementation createPOJOImplementation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java
new file mode 100644
index 0000000000..0dad270a6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.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 pojo.impl;
+
+import pojo.POJOImplementation;
+import pojo.POJOImplementationFactory;
+
+/**
+ * A factory for the POJO implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class POJOImplementationFactoryImpl implements POJOImplementationFactory {
+
+ public POJOImplementation createPOJOImplementation() {
+ return new POJOImplementationImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java
new file mode 100644
index 0000000000..f2d6871039
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package pojo.impl;
+
+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.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+
+import pojo.POJOImplementation;
+
+
+/**
+ * Represents a POJO implementation in an SCA assembly.
+ *
+ * @version $Rev$ $Date$
+ */
+class POJOImplementationImpl implements POJOImplementation {
+
+ private String pojoName;
+ private Class<?> pojoClass;
+ private String uri;
+ private Map<String, Method> methods;
+ private List<Service> services = new ArrayList<Service>();
+ private List<Reference> references = new ArrayList<Reference>();
+ private List<Property> properties = new ArrayList<Property>();
+ private boolean unresolved;
+
+ POJOImplementationImpl() {
+ }
+
+ /**
+ * Returns the POJO class name
+ * @return
+ */
+ public String getPOJOName() {
+ return pojoName;
+ }
+
+ /**
+ * Sets the POJO class name
+ * @param pojoName
+ */
+ public void setPOJOName(String pojoName) {
+ this.pojoName = pojoName;
+ setURI(pojoName.replace('.', '/'));
+ }
+
+ /**
+ * Returns the POJO class.
+ * @return
+ */
+ public Class<?> getPOJOClass() {
+ return pojoClass;
+ }
+
+ /**
+ * Sets the POJO class.
+ * @param pojoClass
+ */
+ public void setPOJOClass(Class<?> pojoClass) {
+ this.pojoClass = pojoClass;
+ setPOJOName(pojoClass.getName());
+
+ // Index the POJO's methods
+ methods = new HashMap<String, Method>();
+ Method[] m = pojoClass.getMethods();
+ for (int i = 0; i < m.length; i++) {
+ methods.put(m[i].getName(), m[i]);
+ }
+ }
+
+ /**
+ * Returns the POJO's methods.
+ * @return
+ */
+ public Map<String, Method> getMethods() {
+ return methods;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The sample POJO implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The sample POJO implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof POJOImplementationImpl) {
+ return ((POJOImplementationImpl)obj).getURI().equals(uri);
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java
new file mode 100644
index 0000000000..44a2cc0aa8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.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 pojo.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.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.monitor.Monitor;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+import pojo.POJOImplementation;
+import pojo.POJOImplementationFactory;
+
+/**
+ * Implements a STAX based artifact processor for POJO implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.pojo>
+ * elements in SCA assembly XML composite files and populating the POJO
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ */
+public class POJOImplementationProcessor implements StAXArtifactProcessor<POJOImplementation> {
+ private static final QName IMPLEMENTATION_POJO = new QName("http://pojo", "implementation.pojo");
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private POJOImplementationFactory pojoImplementationFactory;
+ private PolicyFactory policyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+
+ public POJOImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+
+ // Get the assembly and Java interface factories as we'll need them to
+ // create model objects
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ pojoImplementationFactory = modelFactories.getFactory(POJOImplementationFactory.class);
+ policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_POJO;
+ }
+
+ public Class<POJOImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return POJOImplementation.class;
+ }
+
+ public POJOImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.pojo> element
+ POJOImplementation implementation = pojoImplementationFactory.createPOJOImplementation();
+
+ // Read policies
+ policyProcessor.readPolicies(implementation, reader);
+
+ // Read the POJO class attribute.
+ String className = reader.getAttributeValue(null, "class");
+ implementation.setPOJOName(className);
+
+ // Mark the POJO model unresolved to track the fact that it's not
+ // completely initialized, its class is not loaded yet and services
+ // and references not initialized either
+ implementation.setUnresolved(true);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_POJO.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(POJOImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the POJO implementation
+
+ // First resolve its class
+ ClassReference classReference = new ClassReference(implementation.getPOJOName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class<?> pojoClass = classReference.getJavaClass();
+ if (pojoClass == null) {
+ throw new ContributionResolveException("Class could not be resolved: " + implementation.getPOJOName());
+ }
+ implementation.setPOJOClass(pojoClass);
+
+ // Check to see if we have a .componentType file describing the POJO class
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ componentType.setURI(implementation.getURI() + ".componentType");
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (!componentType.isUnresolved()) {
+
+ // We have a component type description, merge it into the POJO model
+ implementation.getServices().addAll(componentType.getServices());
+ implementation.getReferences().addAll(componentType.getReferences());
+ implementation.getProperties().addAll(componentType.getProperties());
+
+ } else {
+
+ // We have no component type description, simply introspect the POJO and
+ // create a single Service for it
+ Service service = assemblyFactory.createService();
+ service.setName(pojoClass.getSimpleName());
+ JavaInterface javaInterface;
+ try {
+ javaInterface = javaFactory.createJavaInterface(pojoClass);
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ service.setInterfaceContract(interfaceContract);
+ implementation.getServices().add(service);
+ }
+
+ // Mark the implementation resolved now
+ implementation.setUnresolved(false);
+ }
+
+ public void write(POJOImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <implementation.pojo> element
+ policyProcessor.writePolicyPrefixes(implementation, writer);
+ writer.writeStartElement(IMPLEMENTATION_POJO.getNamespaceURI(), IMPLEMENTATION_POJO.getLocalPart());
+ policyProcessor.writePolicyAttributes(implementation, writer);
+
+ if (implementation.getPOJOName() != null) {
+ writer.writeAttribute("class", implementation.getPOJOName());
+ }
+
+ writer.writeEndElement();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java
new file mode 100644
index 0000000000..87333c61f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.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 pojo.provider;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Implements an invoker for POJO component implementations.
+ *
+ * The invoker is responsible for handling invocations of a business operation.
+ * Input business data is passed to the invoke method in a Message object.
+ * The invoke method is responsible for handling the invocation and returning a Message with
+ * the output business data.
+ *
+ * In this example we are simply delegating the operation invocations to the
+ * corresponding methods on the POJO implementation class using Java reflection.
+ *
+ * Depending on the type of implementation being handled, more sophisticated invokers can
+ * use other techniques to delegate the invocation to the implementation artifact directly, call a
+ * runtime engine like a BPEL engine or an XQuery engine (this is what the Tuscany
+ * implementation-bpel and implementation-xquery extensions do) or just completely handle the
+ * invocation in the invoker itself if the implementation has a fixed behavior for example.
+ */
+class POJOImplementationInvoker implements Invoker {
+
+ private Object pojoInstance;
+ private Method method;
+
+ POJOImplementationInvoker(Object pojoInstance, Operation operation, Method method) {
+ this.pojoInstance = pojoInstance;
+ this.method = method;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ msg.setBody(method.invoke(pojoInstance, (Object[])msg.getBody()));
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java
new file mode 100644
index 0000000000..73a0d22493
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.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 pojo.provider;
+
+import java.lang.reflect.Method;
+
+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 org.osoa.sca.ServiceRuntimeException;
+
+import pojo.POJOImplementation;
+
+/**
+ * An implementation provider for sample CRUD implementations.
+ *
+ * The implementation provider is responsible for handling the lifecycle of a component
+ * implementation and creating operation invokers for the service operations provided
+ * by the implementation.
+ *
+ * The start() and stop() methods are called when a component is started
+ * and stopped. In this example we are using that opportunity to call init and destroy methods
+ * on the POJO instance if these methods exist.
+ *
+ * The createInvoker method is called for each operation provided by the component
+ * implementation. The implementation provider can create an invoker and initialize it
+ * at that time to minimize the amount of work to be performed on each invocation.
+ *
+ * For example here we are looking up the Java method corresponding to the service operation
+ * at passing it to the invoker constructor. This way the invoker won't have to lookup the Java
+ * method on each invocation.
+ */
+class POJOImplementationProvider implements ImplementationProvider {
+
+ private POJOImplementation implementation;
+ private Object pojoInstance;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ POJOImplementationProvider(RuntimeComponent component, POJOImplementation implementation) {
+ this.implementation = implementation;
+
+ // Create a new instance of the POJO
+ try {
+ pojoInstance = implementation.getPOJOClass().newInstance();
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public void start() {
+ try {
+ // Invoke the POJO's init method
+ Method initMethod = implementation.getMethods().get("init");
+ if (initMethod != null) {
+ initMethod.invoke(pojoInstance);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public void stop() {
+ try {
+ // Invoke the POJO's destroy method
+ Method destroyMethod = implementation.getMethods().get("destroy");
+ if (destroyMethod != null) {
+ destroyMethod.invoke(pojoInstance);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ } finally {
+ pojoInstance = null;
+ }
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ Method method = implementation.getMethods().get(operation.getName());
+ POJOImplementationInvoker invoker = new POJOImplementationInvoker(pojoInstance, operation, method);
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java
new file mode 100644
index 0000000000..22f2be09e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.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 pojo.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+import pojo.POJOImplementation;
+
+/**
+ * A factory for POJO implementation providers.
+ */
+public class POJOImplementationProviderFactory implements ImplementationProviderFactory<POJOImplementation> {
+
+ public POJOImplementationProviderFactory(ExtensionPointRegistry registry) {
+ }
+
+ public Class<POJOImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return POJOImplementation.class;
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, POJOImplementation implementation) {
+ return new POJOImplementationProvider(component, implementation);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..8337e81c5f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 artifact processor extension
+pojo.impl.POJOImplementationProcessor;qname=http://pojo#implementation.pojo,model=pojo.POJOImplementation,factory=pojo.POJOImplementationFactory
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..64dd230a15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# URI of the XML schema to be used for validation
+sample-implementation-pojo.xsd
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..b30ea3b9cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 implementation extension
+pojo.provider.POJOImplementationProviderFactory;model=pojo.POJOImplementation
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory
new file mode 100644
index 0000000000..075af98240
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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 implementation model factory
+pojo.impl.POJOImplementationFactoryImpl
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd
new file mode 100644
index 0000000000..c9d170770b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.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://pojo"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:p="http://pojo"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0"/>
+
+ <element name="implementation.pojo" type="p:POJOImplementation"/>
+
+ <complexType name="POJOImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <attribute name="class" type="NCName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..cc32929f09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/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 helloworld;
+
+public interface HelloWorld {
+
+ String sayHello(String name);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0580e30aba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/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;
+
+public class HelloWorldImpl {
+
+ public void init() {
+ System.out.println("Initializing POJO");
+ }
+
+ public void destroy() {
+ System.out.println("Destroying POJO");
+ }
+
+ public String sayHello(String name) {
+ System.out.println("Executing POJO sayHello");
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java
new file mode 100644
index 0000000000..69ab1f567e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.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;
+
+public class HelloWorldImpl2 {
+
+ public void init() {
+ System.out.println("Initializing POJO");
+ }
+
+ public void destroy() {
+ System.out.println("Destroying POJO");
+ }
+
+ public String sayHello(String name) {
+ System.out.println("Executing POJO sayHello");
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..d8b5f41adc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the POJO implementation extension.
+ */
+public class HelloWorldTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testHello() throws Exception {
+ HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent");
+ assertEquals("Hello petra", helloworld.sayHello("petra"));
+ }
+
+ public void testHello2() throws Exception {
+ HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent2/HelloWorld2");
+ assertEquals("Hello petra", helloworld.sayHello("petra"));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType
new file mode 100644
index 0000000000..a92c5ab8db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="HelloWorld2">
+ <interface.java interface="helloworld.HelloWorld"/>
+ </service>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite
new file mode 100644
index 0000000000..c38094dfc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.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://test/helloworld"
+ xmlns:p="http://pojo"
+ name="helloworld">
+
+ <component name="HelloWorldComponent">
+ <p:implementation.pojo class="helloworld.HelloWorldImpl" />
+ </component>
+
+ <component name="HelloWorldComponent2">
+ <p:implementation.pojo class="helloworld.HelloWorldImpl2" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/samples/pom.xml b/sca-java-1.x/branches/sca-android/samples/pom.xml
new file mode 100644
index 0000000000..e7af01dbac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-samples</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Samples</name>
+
+ <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>binding-echo</module>
+ <module>binding-echo-extension</module>
+ <module>calculator</module>
+ <module>calculator-lean</module>
+ <module>databinding-echo</module>
+ <module>implementation-composite</module>
+ <module>implementation-crud</module>
+ <module>implementation-crud-extension</module>
+ <module>implementation-pojo-extension</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-android/samples/simple-bigbank/README b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/README
new file mode 100644
index 0000000000..acbe93a4d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/README
@@ -0,0 +1,101 @@
+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
+---------------
+This sample demonstrates a simple bank summary transaction while using Java components wired together.
+SCA default binding is used.
+
+A request to the AccountComponent results in a request to the AccountDataComponent to get account data
+which is based on a random stock quote price. Therefore result for this sample will vary on each run.
+
+calculator/
+ src/
+ main/
+ java/
+ bigbank/
+ account/ - AccountComponent implementation
+ accountdata/ - AccountDataComponent implementation
+ stockquote/ - generates random stock prices
+ client/ - starts the SCA Runtime and
+ deploys the BigBank.composite.
+ It then calls the deployed AccountService
+ resources/
+ Account.composite - SCA assembly for this sample
+ BigBank.composite - SCA assembly for this sample
+ StockQuote.composite - SCA assembly for this sample
+ test/
+ java/
+ bigbank/
+ BigBankTestCase.java - JUnit test case
+ 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.
+** Please note that the balance amount is dependent on the random sotck quote price and the
+numbers may vary on each run.
+
+run:
+ [java] Getting stock quote for: IBM, value: 104.06
+ [java] Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID
+:Foo_SAA12345, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balanc
+e:10406.0]
+
+
+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.
+** Please note that the balance amount is dependent on the random sotck quote price and the numbers may vary on each run.
+
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running bigbank.BigBankTestCase
+Getting stock quote for: IBM, value: 104.02
+Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID:Foo_SAA1234
+5, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10402.0]
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.502 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-android/samples/simple-bigbank/build.xml b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/build.xml
new file mode 100644
index 0000000000..a814014eae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/simple-bigbank/pom.xml b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/pom.xml
new file mode 100644
index 0000000000..bb99d5cd6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/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.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-simple-bigbank</artifactId>
+ <name>Apache Tuscany SCA 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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-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-android/samples/simple-bigbank/simple-bigbank.png b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/simple-bigbank.png
new file mode 100644
index 0000000000..593c047f6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/simple-bigbank.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-bigbank/simple-bigbank.svg b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/simple-bigbank.svg
new file mode 100644
index 0000000000..c64f6de6b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java
new file mode 100644
index 0000000000..1625ff5b65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.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.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; }
+
+ @Override
+ public String toString() {
+ return "currency: "+ currency + ", " + summaries;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..fa85f309c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.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 bigbank.account;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import bigbank.accountdata.AccountDataService;
+import bigbank.accountdata.CheckingAccount;
+import bigbank.accountdata.SavingsAccount;
+import bigbank.accountdata.StockAccount;
+import bigbank.stockquote.StockQuoteService;
+
+/**
+ * Account service implementation
+ */
+public class AccountServiceImpl implements AccountService {
+
+ @Reference
+ public AccountDataService accountDataService;
+
+ @Reference
+ public StockQuoteService stockQuoteService;
+
+ @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);
+
+ double price = stockQuoteService.getQuote(sk.getSymbol());
+ sk.setBalance(sk.getQuantity() * price);
+
+ summaries.add(sk.getSummary());
+
+ AccountReport report = new AccountReport(currency, summaries);
+
+ return report;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..000acb935c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.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 bigbank.accountdata;
+
+
+/**
+ * Account data service implementation
+ */
+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-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java
new file mode 100644
index 0000000000..86246a3f84
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.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.accountdata;
+
+/**
+ * An account service implementation for a stock account
+ */
+public class StockAccount implements Account {
+ private String accountNumber;
+ private String symbol;
+ private int quantity;
+ private double balance;
+
+ 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 double getBalance() { return balance; }
+ public void setBalance(double balance) { this.balance = balance; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", symbol:" + symbol + ", quantity:" + quantity + ", balance:" + balance; }
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java
new file mode 100644
index 0000000000..0512d40b0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.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 bigbank.stockquote;
+
+
+/**
+ * This class implements the StockQuote service.
+ */
+public class StockQuoteImpl implements StockQuoteService {
+
+ public double getQuote(String symbol) {
+ double price = 104.0 + Math.random();
+ price = ((int)(price * 100)) / 100.0;
+
+ System.out.println("Getting stock quote for: " + symbol + ", value: "+ price);
+
+ return price;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..7961279352
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.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 bigbank.stockquote;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * This is the business interface of the StockQuote service.
+ */
+@Remotable
+public interface StockQuoteService {
+
+ public double getQuote(String symbol);
+}
+
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/Account.composite b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/Account.composite
new file mode 100644
index 0000000000..e71615e27e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/Account.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"
+ targetNamespace="http://account"
+ name="Account">
+
+ <service name="AccountService" promote="AccountServiceComponent"/>
+
+ <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>
+
+ <reference name="stockQuoteService" promote="AccountServiceComponent/stockQuoteService"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/BigBank.composite b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..c870f39cab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/BigBank.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"
+ targetNamespace="http://bigbank"
+ xmlns:a="http://account"
+ xmlns:s="http://stockquote"
+ name="BigBank">
+
+ <component name="AccountServiceComponent">
+ <implementation.composite name="a:Account"/>
+ <reference name="stockQuoteService" target="StockQuoteServiceComponent"/>
+ </component>
+
+ <component name="StockQuoteServiceComponent">
+ <implementation.composite name="s:StockQuote"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/StockQuote.composite b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/StockQuote.composite
new file mode 100644
index 0000000000..4f29c14851
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/main/resources/StockQuote.composite
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://stockquote"
+ name="StockQuote">
+
+ <service name="StockQuoteService" promote="StockQuoteServiceComponent"/>
+
+ <component name="StockQuoteServiceComponent">
+ <implementation.java class="bigbank.stockquote.StockQuoteImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java
new file mode 100644
index 0000000000..ba6c1dd797
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.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 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;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("BigBank.composite");
+ accountService = scaDomain.getService(AccountService.class, "AccountServiceComponent");
+ }
+
+ @Override
+ 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-android/samples/simple-callback/README b/sca-java-1.x/branches/sca-android/samples/simple-callback/README
new file mode 100644
index 0000000000..719376f254
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-callback/README
@@ -0,0 +1,97 @@
+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/
+ MyClient.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
+ MyServiceImpl.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/
+ simplecallback.composite - the SCA assembly for this sample
+ test/
+ java/
+ simplecallback/
+ SimpleCallbackTestCase.java - JUnit test case
+ 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-android/samples/simple-callback/build.xml b/sca-java-1.x/branches/sca-android/samples/simple-callback/build.xml
new file mode 100644
index 0000000000..47d1ea4bc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/simple-callback/pom.xml b/sca-java-1.x/branches/sca-android/samples/simple-callback/pom.xml
new file mode 100644
index 0000000000..3a449dade9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-simple-callback</artifactId>
+ <name>Apache Tuscany SCA 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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-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-android/samples/simple-callback/simple-callback.png b/sca-java-1.x/branches/sca-android/samples/simple-callback/simple-callback.png
new file mode 100644
index 0000000000..1b6353f5cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-callback/simple-callback.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/samples/simple-callback/simple-callback.svg b/sca-java-1.x/branches/sca-android/samples/simple-callback/simple-callback.svg
new file mode 100644
index 0000000000..484b65df9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/simple-callback/src/main/java/simplecallback/MyClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-callback/src/main/java/simplecallback/MyService.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java b/sca-java-1.x/branches/sca-android/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-android/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-android/samples/simple-callback/src/main/resources/simplecallback.composite b/sca-java-1.x/branches/sca-android/samples/simple-callback/src/main/resources/simplecallback.composite
new file mode 100644
index 0000000000..33e6f60601
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java b/sca-java-1.x/branches/sca-android/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java
new file mode 100644
index 0000000000..cbaab8af83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.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 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;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("simplecallback.composite");
+ myClient = scaDomain.getService(MyClient.class, "MyClientComponent");
+ }
+
+ @Override
+ 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-android/samples/supplychain/README b/sca-java-1.x/branches/sca-android/samples/supplychain/README
new file mode 100644
index 0000000000..ea4493fdd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/supplychain/README
@@ -0,0 +1,101 @@
+SupplyChain Sample
+==================
+
+This sample demonstrates 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 separate callback thread.
+
+supplychain/
+ 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
+ test/
+ java/
+ supplychain/
+ SupplyChainClientTestCase.java - JUnit test case
+ 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 supplychain
+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. \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/samples/supplychain/build.xml b/sca-java-1.x/branches/sca-android/samples/supplychain/build.xml
new file mode 100644
index 0000000000..506180b8b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/pom.xml b/sca-java-1.x/branches/sca-android/samples/supplychain/pom.xml
new file mode 100644
index 0000000000..0b5a76be4c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-supplychain</artifactId>
+ <name>Apache Tuscany SCA 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>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-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-android/samples/supplychain/src/main/java/supplychain/Customer.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/Customer.java
new file mode 100644
index 0000000000..8088001898
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java
new file mode 100644
index 0000000000..7a1e8553ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/main/java/supplychain/Retailer.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/Retailer.java
new file mode 100644
index 0000000000..1add63fb4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java
new file mode 100644
index 0000000000..f622052cf8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/main/java/supplychain/Shipper.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/Shipper.java
new file mode 100644
index 0000000000..d4d49a922b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java
new file mode 100644
index 0000000000..4ae52a12a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java
new file mode 100644
index 0000000000..7072f582d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/main/java/supplychain/Warehouse.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/Warehouse.java
new file mode 100644
index 0000000000..0be499f569
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java
new file mode 100644
index 0000000000..b5e256a1e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/main/resources/supplychain.composite b/sca-java-1.x/branches/sca-android/samples/supplychain/src/main/resources/supplychain.composite
new file mode 100644
index 0000000000..301efcaf1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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-android/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/sca-java-1.x/branches/sca-android/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java
new file mode 100644
index 0000000000..88e0eb7ab8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.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 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;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("supplychain.composite");
+ customer = scaDomain.getService(Customer.class, "CustomerComponent");
+ }
+
+ @Override
+ 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-android/samples/supplychain/supplychain.png b/sca-java-1.x/branches/sca-android/samples/supplychain/supplychain.png
new file mode 100644
index 0000000000..51a384e827
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/samples/supplychain/supplychain.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/samples/supplychain/supplychain.svg b/sca-java-1.x/branches/sca-android/samples/supplychain/supplychain.svg
new file mode 100644
index 0000000000..f72e77acab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/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>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/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-android/tools/eclipse34/features/core/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..63215d7c6f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Tools Core Feature
+Bundle-SymbolicName: org.apache.tuscany.sca.feature.core
+Bundle-Version: 1.4.0
+Bundle-Vendor: Apache Software Foundation
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/tools/eclipse34/features/core/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/build.properties
new file mode 100644
index 0000000000..f36e15c5d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/build.properties
@@ -0,0 +1,10 @@
+bin.includes = feature.xml,\
+ NOTICE,\
+ LICENSE,\
+ META-INF/
+src.includes = .project,\
+ LICENSE,\
+ NOTICE,\
+ build.properties,\
+ feature.xml,\
+ META-INF/
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/feature.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/feature.xml
new file mode 100644
index 0000000000..1a20ac1eb1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/feature.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.
+-->
+<feature
+ id="org.apache.tuscany.sca.feature.core"
+ label="Apache Tuscany SCA Core Eclipse Feature"
+ version="1.4.0"
+ provider-name="Apache Software Foundation">
+
+ <description url="http://incubator.apache.org/tuscany">
+ Apache Tuscany SCA Tools Core Feature.
+ </description>
+
+ <license url="http://www.apache.org/licenses/LICENSE-2.0">
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ </license>
+
+ <requires>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.jobs"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jdt.debug.ui"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ <import plugin="org.eclipse.jface"/>
+ <import plugin="org.eclipse.osgi"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.eclipse.ui.workbench"/>
+ </requires>
+
+ <plugin
+ id="org.apache.tuscany.sca.plugin.core"
+ download-size="0"
+ install-size="0"
+ version="1.4.0"/>
+
+</feature>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/pom.xml
new file mode 100644
index 0000000000..953eb9ec77
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/core/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-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.feature.core</artifactId>
+ <name>Apache Tuscany SCA Core Eclipse Feature</name>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/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-android/tools/eclipse34/features/ejava/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..f363ae7b2a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA JEE Eclipse Feature
+Bundle-SymbolicName: org.apache.tuscany.sca.feature.ejava
+Bundle-Version: 1.4.0
+Bundle-Vendor: Apache Software Foundation
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/tools/eclipse34/features/ejava/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/build.properties
new file mode 100644
index 0000000000..f36e15c5d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/build.properties
@@ -0,0 +1,10 @@
+bin.includes = feature.xml,\
+ NOTICE,\
+ LICENSE,\
+ META-INF/
+src.includes = .project,\
+ LICENSE,\
+ NOTICE,\
+ build.properties,\
+ feature.xml,\
+ META-INF/
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/feature.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/feature.xml
new file mode 100644
index 0000000000..ef2ab6c2ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/feature.xml
@@ -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.
+-->
+<feature
+ id="org.apache.tuscany.sca.feature.ejava"
+ label="Apache Tuscany SCA JEE Eclipse Feature"
+ version="1.4.0"
+ provider-name="Apache Software Foundation">
+
+ <description url="http://incubator.apache.org/tuscany">
+ Apache Tuscany SCA JEE Eclipse Feature.
+ </description>
+
+ <license url="http://www.apache.org/licenses/LICENSE-2.0">
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ </license>
+
+ <requires>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.jobs"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jdt.debug.ui"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ <import plugin="org.eclipse.jface"/>
+ <import plugin="org.eclipse.osgi"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.apache.tuscany.sca.plugin.core"/>
+ <import plugin="org.eclipse.ui.workbench"/>
+ <import feature="org.apache.tuscany.sca.feature.core" version="1.4.0"/>
+ </requires>
+
+ <plugin
+ id="org.apache.tuscany.sca.plugin.ejava"
+ download-size="0"
+ install-size="0"
+ version="1.4.0"/>
+
+</feature>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/pom.xml
new file mode 100644
index 0000000000..da67d110b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/ejava/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-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.feature.ejava</artifactId>
+ <name>Apache Tuscany SCA JEE Eclipse Feature</name>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/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-android/tools/eclipse34/features/manager/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..8d8f5b271d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Domain Manager Eclipse Feature
+Bundle-SymbolicName: org.apache.tuscany.sca.feature.manager
+Bundle-Version: 1.4.0
+Bundle-Vendor: Apache Software Foundation
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/tools/eclipse34/features/manager/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/build.properties
new file mode 100644
index 0000000000..f36e15c5d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/build.properties
@@ -0,0 +1,10 @@
+bin.includes = feature.xml,\
+ NOTICE,\
+ LICENSE,\
+ META-INF/
+src.includes = .project,\
+ LICENSE,\
+ NOTICE,\
+ build.properties,\
+ feature.xml,\
+ META-INF/
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/feature.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/feature.xml
new file mode 100644
index 0000000000..189342993d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/feature.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<feature
+ id="org.apache.tuscany.sca.feature.manager"
+ label="Apache Tuscany SCA Domain Manager Eclipse Feature"
+ version="1.4.0"
+ provider-name="Apache Software Foundation">
+
+ <description url="http://incubator.apache.org/tuscany">
+ Apache Tuscany SCA Domain Manager Eclipse Feature.
+ </description>
+
+ <license url="http://www.apache.org/licenses/LICENSE-2.0">
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ </license>
+
+ <includes
+ id="org.apache.tuscany.sca.feature.core"
+ version="1.4.0"/>
+
+ <requires>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.jobs"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jdt.debug.ui"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ <import plugin="org.eclipse.jface"/>
+ <import plugin="org.eclipse.osgi"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.apache.tuscany.sca.plugin.core"/>
+ <import plugin="org.eclipse.ui.workbench"/>
+ <import feature="org.apache.tuscany.sca.feature.core" version="1.4.0"/>
+ </requires>
+
+ <plugin
+ id="org.apache.tuscany.sca.plugin.manager"
+ download-size="0"
+ install-size="0"
+ version="1.4.0"/>
+
+</feature>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/pom.xml
new file mode 100644
index 0000000000..2e4f221ef1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/manager/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-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.feature.manager</artifactId>
+ <name>Apache Tuscany SCA Domain Manager Eclipse Feature</name>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/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-android/tools/eclipse34/features/process/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..7f10d43405
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Process Eclipse Feature
+Bundle-SymbolicName: org.apache.tuscany.sca.feature.process
+Bundle-Version: 1.4.0
+Bundle-Vendor: Apache Software Foundation
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/tools/eclipse34/features/process/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/build.properties
new file mode 100644
index 0000000000..f36e15c5d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/build.properties
@@ -0,0 +1,10 @@
+bin.includes = feature.xml,\
+ NOTICE,\
+ LICENSE,\
+ META-INF/
+src.includes = .project,\
+ LICENSE,\
+ NOTICE,\
+ build.properties,\
+ feature.xml,\
+ META-INF/
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/feature.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/feature.xml
new file mode 100644
index 0000000000..08332be61e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/feature.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<feature
+ id="org.apache.tuscany.sca.feature.process"
+ label="Apache Tuscany SCA Process Eclipse Feature"
+ version="1.4.0"
+ provider-name="Apache Software Foundation">
+
+ <description url="http://incubator.apache.org/tuscany">
+ Apache Tuscany SCA Process Eclipse Feature.
+ </description>
+
+ <license url="http://www.apache.org/licenses/LICENSE-2.0">
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ </license>
+
+ <includes
+ id="org.apache.tuscany.sca.feature.core"
+ version="1.4.0"/>
+
+ <requires>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.jobs"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jdt.debug.ui"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ <import plugin="org.eclipse.jface"/>
+ <import plugin="org.eclipse.osgi"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.apache.tuscany.sca.plugin.core"/>
+ <import plugin="org.eclipse.ui.workbench"/>
+ <import feature="org.apache.tuscany.sca.feature.core" version="1.4.0"/>
+ </requires>
+
+ <plugin
+ id="org.apache.tuscany.sca.plugin.process"
+ download-size="0"
+ install-size="0"
+ version="1.4.0"/>
+
+</feature>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/pom.xml
new file mode 100644
index 0000000000..9ad398109a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/process/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-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.feature.process</artifactId>
+ <name>Apache Tuscany SCA Process Eclipse Feature</name>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/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-android/tools/eclipse34/features/web20/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..2dc129ebaa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Web 2.0 Eclipse Feature
+Bundle-SymbolicName: org.apache.tuscany.sca.feature.web20
+Bundle-Version: 1.4.0
+Bundle-Vendor: Apache Software Foundation
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/tools/eclipse34/features/web20/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/build.properties
new file mode 100644
index 0000000000..f36e15c5d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/build.properties
@@ -0,0 +1,10 @@
+bin.includes = feature.xml,\
+ NOTICE,\
+ LICENSE,\
+ META-INF/
+src.includes = .project,\
+ LICENSE,\
+ NOTICE,\
+ build.properties,\
+ feature.xml,\
+ META-INF/
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/feature.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/feature.xml
new file mode 100644
index 0000000000..8fe97d24a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/feature.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<feature
+ id="org.apache.tuscany.sca.feature.web20"
+ label="Apache Tuscany SCA Web 2.0 Eclipse Feature"
+ version="1.4.0"
+ provider-name="Apache Software Foundation">
+
+ <description url="http://incubator.apache.org/tuscany">
+ Apache Tuscany SCA Web 2.0 Eclipse Feature.
+ </description>
+
+ <license url="http://www.apache.org/licenses/LICENSE-2.0">
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ </license>
+
+ <includes
+ id="org.apache.tuscany.sca.feature.core"
+ version="1.4.0"/>
+
+ <requires>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.jobs"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jdt.debug.ui"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ <import plugin="org.eclipse.jface"/>
+ <import plugin="org.eclipse.osgi"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.apache.tuscany.sca.plugin.core"/>
+ <import plugin="org.eclipse.ui.workbench"/>
+ <import feature="org.apache.tuscany.sca.feature.core" version="1.4.0"/>
+ </requires>
+
+ <plugin
+ id="org.apache.tuscany.sca.plugin.web20"
+ download-size="0"
+ install-size="0"
+ version="1.4.0"/>
+
+</feature>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/pom.xml
new file mode 100644
index 0000000000..9d4b4d50b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/web20/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-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.feature.web20</artifactId>
+ <name>Apache Tuscany SCA Web 2.0 Eclipse Feature</name>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/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-android/tools/eclipse34/features/webservice/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..9fb9f1282b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Web Service Eclipse Feature
+Bundle-SymbolicName: org.apache.tuscany.sca.feature.webservice
+Bundle-Version: 1.4.0
+Bundle-Vendor: Apache Software Foundation
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/tools/eclipse34/features/webservice/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/build.properties
new file mode 100644
index 0000000000..f36e15c5d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/build.properties
@@ -0,0 +1,10 @@
+bin.includes = feature.xml,\
+ NOTICE,\
+ LICENSE,\
+ META-INF/
+src.includes = .project,\
+ LICENSE,\
+ NOTICE,\
+ build.properties,\
+ feature.xml,\
+ META-INF/
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/feature.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/feature.xml
new file mode 100644
index 0000000000..d905b6475c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/feature.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<feature
+ id="org.apache.tuscany.sca.feature.webservice"
+ label="Apache Tuscany SCA Web Service Eclipse Feature"
+ version="1.4.0"
+ provider-name="Apache Software Foundation">
+
+ <description url="http://incubator.apache.org/tuscany">
+ Apache Tuscany SCA Web Service Eclipse Feature.
+ </description>
+
+ <license url="http://www.apache.org/licenses/LICENSE-2.0">
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ </license>
+
+ <includes
+ id="org.apache.tuscany.sca.feature.core"
+ version="1.4.0"/>
+
+ <requires>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.jobs"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jdt.debug.ui"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ <import plugin="org.eclipse.jface"/>
+ <import plugin="org.eclipse.osgi"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.apache.tuscany.sca.plugin.core"/>
+ <import plugin="org.eclipse.ui.workbench"/>
+ <import feature="org.apache.tuscany.sca.feature.core" version="1.4.0"/>
+ </requires>
+
+ <plugin
+ id="org.apache.tuscany.sca.plugin.webservice"
+ download-size="0"
+ install-size="0"
+ version="1.4.0"/>
+
+</feature>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/pom.xml
new file mode 100644
index 0000000000..f42fa8ce48
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/features/webservice/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-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.feature.webservice</artifactId>
+ <name>Apache Tuscany SCA Web Service Eclipse Feature</name>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/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-android/tools/eclipse34/plugins/core/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..0d8b1053bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/META-INF/MANIFEST.MF
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Core Eclipse Plugin
+Bundle-SymbolicName: org.apache.tuscany.sca.plugin.core;singleton:=true
+Bundle-Version: 1.4.0
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
+ org.eclipse.debug.ui,
+ org.eclipse.debug.ui.sourcelookup,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.debug.ui.launchConfigurations,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.ui.wizards,
+ org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
+ org.eclipse.jface.resource,
+ org.eclipse.jface.viewers,
+ org.eclipse.jface.wizard,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.swt,
+ org.eclipse.swt.graphics,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui,
+ org.eclipse.ui.progress,
+ org.osgi.framework;version="1.3.0"
+Bundle-Vendor: Apache Software Foundation
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.ui.ide
+Export-Package: org.apache.tuscany.sca.plugin.core.classpath
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/NOTICE
new file mode 100644
index 0000000000..6dcfe88195
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/NOTICE
@@ -0,0 +1,12 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product also includes software under the SCA Collaboration license
+(see the LICENSE file contained in this distribution), with the following
+copyright:
+
+(c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/build.properties
new file mode 100644
index 0000000000..c402b2eb45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/build.properties
@@ -0,0 +1,23 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ xsd/,\
+ icons/,\
+ .,\
+ LICENSE,\
+ NOTICE,\
+ org/
+src.includes = xsd/,\
+ plugin.xml,\
+ .classpath,\
+ .project,\
+ LICENSE,\
+ META-INF/,\
+ NOTICE,\
+ build.properties,\
+ icons/,\
+ .settings/,\
+ org/,\
+ pom.xml
+jars.compile.order = .
+source.. = .
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/exsd/runtimeClasspathContainerInitializer.exsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/exsd/runtimeClasspathContainerInitializer.exsd
new file mode 100644
index 0000000000..6b6d79d45b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/exsd/runtimeClasspathContainerInitializer.exsd
@@ -0,0 +1,106 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.tuscany.sca.plugin.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.apache.tuscany.sca.plugin.core" id="runtimeClasspathContainerInitializer" name="Tuscany Runtime Classpath Container Initializers"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="runtimeClasspathContainerInitializer">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.jdt.core.IClasspathContainer"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/icons/t.gif b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/icons/t.gif
new file mode 100644
index 0000000000..ba896ced08
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/icons/t.gif
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/icons/tuscany.gif b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/icons/tuscany.gif
new file mode 100644
index 0000000000..849dd76d4a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/icons/tuscany.gif
Binary files differ
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseClasspathContainer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseClasspathContainer.java
new file mode 100644
index 0000000000..ee9a3d2de9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseClasspathContainer.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.plugin.core.classpath;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainer;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.osgi.framework.Bundle;
+
+/**
+ * A base classpath container implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BaseClasspathContainer implements RuntimeClasspathContainer {
+
+ private String pluginID;
+ private String libraryID;
+ private String libraryName;
+ private String distributionName;
+ private String sourceDistributionName;
+ private String distributionVersion;
+ private String homeProperty;
+ private String sourceProperty;
+
+ /**
+ * Constructs a new Classpath container.
+ *
+ * @param pluginID
+ * @param libraryID
+ * @param libraryName
+ * @param distributionName
+ * @param distributionVersion
+ * @param homeProperty
+ * @param sourceProperty
+ */
+ public BaseClasspathContainer(String pluginID, String libraryID, String libraryName,
+ String distributionName, String sourceDistributionName, String distributionVersion,
+ String homeProperty, String sourceProperty) {
+ this.pluginID = pluginID;
+ this.libraryID = libraryID;
+ this.libraryName = libraryName;
+ this.distributionName = distributionName;
+ this.sourceDistributionName = sourceDistributionName;
+ this.distributionVersion = distributionVersion;
+ this.homeProperty = homeProperty;
+ this.sourceProperty = sourceProperty;
+ }
+
+ public IClasspathEntry[] getClasspathEntries() {
+ List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+
+ // Get the runtime distribution location
+ IPath runtimePath = runtimePath();
+
+ // Get the source distribution location
+ IPath sourcePath = sourcePath();
+
+ // Add the JARs from runtime/lib and runtime/modules as classpath entries
+ if (runtimePath != null) {
+
+ // Add the jars from runtime/modules
+ File modulesDirectory = runtimePath.append("modules").toFile();
+ if (modulesDirectory != null && modulesDirectory.exists()) {
+ for (File file : modulesDirectory.listFiles()) {
+ IPath path = new Path(file.getPath());
+ String name = path.lastSegment();
+ String extension = path.getFileExtension();
+
+ // Only include API and launcher JARs
+ if (!"jar".equals(extension)) {
+ continue;
+ }
+ if (name.indexOf("-api-") == -1 && name.indexOf("-launcher-") == -1) {
+ continue;
+ }
+
+ list.add(JavaCore.newLibraryEntry(path, sourcePath, null));
+ }
+ }
+
+ // Add the jars from runtime/lib
+ File libDirectory = runtimePath.append("lib").toFile();
+ if (libDirectory != null && libDirectory.exists()) {
+ for (File file : libDirectory.listFiles()) {
+ IPath path = new Path(file.getPath());
+ String name = path.lastSegment();
+ String extension = path.getFileExtension();
+
+ // Only include jaxb, jaxws and jsr API JARs
+ if (!"jar".equals(extension)) {
+ continue;
+ }
+ if (name.indexOf("-api-") != -1) {
+ if (name.startsWith("jaxb") || name.startsWith("jaxws") || name.startsWith("jsr")) {
+ list.add(JavaCore.newLibraryEntry(path, sourcePath, null));
+ }
+ }
+ }
+ }
+ }
+
+ return (IClasspathEntry[])list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+ public IClasspathEntry[] getRuntimeClasspathEntries() {
+
+ // Get the runtime distribution location
+ IPath runtimePath = runtimePath();
+
+ if (runtimePath != null) {
+ return new IClasspathEntry[] {JavaCore.newLibraryEntry(runtimePath, null, null)};
+ } else {
+ return new IClasspathEntry[0];
+ }
+ }
+
+ public String getDescription() {
+ return libraryName;
+ }
+
+ public int getKind() {
+ return IClasspathContainer.K_APPLICATION;
+ }
+
+ public IPath getPath() {
+ return new Path(libraryID);
+ }
+
+ /**
+ * Returns the location of the runtime distribution.
+ *
+ * @return
+ */
+ private IPath runtimePath() {
+ IPath path = artifactLocation(pluginID, distributionName, distributionVersion, null, null);
+
+ if (path == null) {
+
+ // Try to get the location of the distribution from
+ // the HOME property or environment variable
+ String home = System.getProperty(homeProperty);
+ if (home == null || home.length() == 0) {
+ home = System.getenv(homeProperty);
+ }
+ if (home != null && home.length() != 0) {
+ if (new File(home).exists()) {
+ path = new Path(home);
+ }
+ }
+ }
+ return path;
+ }
+
+ /**
+ * Returns the location of the source distribution.
+ *
+ * @return
+ */
+ private IPath sourcePath() {
+ IPath path = artifactLocation(pluginID, sourceDistributionName, distributionVersion, "src", ".zip");
+
+ if (path == null) {
+
+ // Try to get the location of the source distribution from
+ // the SRC property or environment variable
+ String source = System.getProperty(sourceProperty);
+ if (source == null || source.length() == 0) {
+ source = System.getenv(sourceProperty);
+ }
+ if (source != null && source.length() != 0) {
+ if (new File(source).exists()) {
+ path = new Path(source);
+ }
+ }
+ }
+ return path;
+ }
+
+ /**
+ * Returns the location of the specified artifact.
+ *
+ * @param pluginId
+ * @param artifactId
+ * @param version
+ * @param classifier
+ * @param extension
+ * @return
+ */
+ private IPath artifactLocation(String pluginId, String artifactId, String version, String classifier, String extension) {
+ String artifactName;
+ if (classifier != null) {
+ artifactName = artifactId + '-' + version + '-' + classifier;
+ } else {
+ artifactName = artifactId + '-' + version;
+ }
+ if (extension != null) {
+ artifactName += extension;
+ }
+ try {
+ Bundle bundle = Platform.getBundle(pluginId);
+ URL location = FileLocator.find(bundle, new Path(artifactName), null);
+ location = FileLocator.toFileURL(location);
+ IPath path = new Path(new File(location.toURI()).getPath());
+ return path;
+ } catch (Exception e) {
+ error("Artifact not found: " + artifactName, e);
+ return null;
+ }
+ }
+
+ /**
+ * Log an error.
+ *
+ * @param msg
+ * @param e
+ */
+ private void error(String msg, Exception e) {
+ Platform.getLog(
+ Platform.getBundle(pluginID)).log(
+ new Status(IStatus.ERROR, pluginID, IStatus.OK, msg, e));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseClasspathContainerInitializer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseClasspathContainerInitializer.java
new file mode 100644
index 0000000000..7ea8d700f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseClasspathContainerInitializer.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.plugin.core.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+
+/**
+ * A base classpath container implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BaseClasspathContainerInitializer extends ClasspathContainerInitializer implements RuntimeClasspathContainerInitializer {
+
+ private RuntimeClasspathContainer container;
+
+ public BaseClasspathContainerInitializer(RuntimeClasspathContainer container) {
+ this.container = container;
+ }
+
+ @Override
+ public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
+ JavaCore.setClasspathContainer(containerPath,
+ new IJavaProject[] {project},
+ new IClasspathContainer[] {container},
+ null);
+ }
+
+ @Override
+ public boolean canUpdateClasspathContainer(IPath containerPath, IJavaProject project) {
+ return true;
+ }
+
+ public IClasspathContainer getRuntimeClasspathContainer() {
+ return new IClasspathContainer() {
+ public IClasspathEntry[] getClasspathEntries() {
+ return container.getRuntimeClasspathEntries();
+ }
+
+ public String getDescription() {
+ return container.getDescription();
+ }
+
+ public int getKind() {
+ return container.getKind();
+ }
+
+ public IPath getPath() {
+ return container.getPath();
+ }
+ };
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseLibraryEntryPage.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseLibraryEntryPage.java
new file mode 100644
index 0000000000..70e794d2ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/BaseLibraryEntryPage.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.plugin.core.classpath;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * A base classpath container page implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BaseLibraryEntryPage extends WizardPage implements IClasspathContainerPage {
+
+ private String name;
+ private String id;
+ private IClasspathEntry classpathEntry;
+
+ public BaseLibraryEntryPage(String id, String name) {
+ super(name);
+ this.name = name;
+ this.id = id;
+ }
+
+ public void createControl(Composite parent) {
+ setTitle(name);
+
+ Label label = new Label(parent, SWT.NONE);
+ label.setText("Press Finish to add the library.");
+ label.setFont(parent.getFont());
+
+ setControl(label);
+ }
+
+ public boolean finish() {
+ classpathEntry = JavaCore.newContainerEntry(new Path(id));
+ return true;
+ }
+
+ public boolean isPageComplete() {
+ return true;
+ }
+
+ public IClasspathEntry getSelection() {
+ return classpathEntry;
+ }
+
+ public void setSelection(IClasspathEntry containerEntry) {
+ this.classpathEntry = containerEntry;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreClasspathContainer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreClasspathContainer.java
new file mode 100644
index 0000000000..7891cc31a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreClasspathContainer.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.plugin.core.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainer;
+
+
+/**
+ * A classpath container for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CoreClasspathContainer extends BaseClasspathContainer implements RuntimeClasspathContainer {
+
+ public CoreClasspathContainer() {
+ super("org.apache.tuscany.sca.plugin.core",
+ "org.apache.tuscany.sca.plugin.core.runtime.library", "Tuscany SCA Core Library",
+ "tuscany-sca", "tuscany-distribution-core", "1.4-SNAPSHOT",
+ "TUSCANY_HOME", "TUSCANY_SRC");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreClasspathContainerInitializer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreClasspathContainerInitializer.java
new file mode 100644
index 0000000000..883c7c0781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreClasspathContainerInitializer.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.plugin.core.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.core.classpath.CoreClasspathContainer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializer;
+
+
+/**
+ * A classpath container initializer for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CoreClasspathContainerInitializer extends BaseClasspathContainerInitializer implements RuntimeClasspathContainerInitializer {
+
+ public CoreClasspathContainerInitializer() {
+ super(new CoreClasspathContainer());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreLibraryEntryPage.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreLibraryEntryPage.java
new file mode 100644
index 0000000000..f90483a00d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/CoreLibraryEntryPage.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.plugin.core.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseLibraryEntryPage;
+
+
+/**
+ * A classpath container page for the core runtime library.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CoreLibraryEntryPage extends BaseLibraryEntryPage {
+
+ public CoreLibraryEntryPage() {
+ super("org.apache.tuscany.sca.plugin.core.runtime.library", "Tuscany SCA Core Library");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainer.java
new file mode 100644
index 0000000000..4830268272
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainer.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.plugin.core.classpath;
+
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+
+/**
+ * A provider of a classpath container for use when launching the Tuscany
+ * runtime.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public interface RuntimeClasspathContainer extends IClasspathContainer {
+
+ /**
+ * Returns the classpath entries to use at runtime.
+ *
+ * @return
+ */
+ IClasspathEntry[] getRuntimeClasspathEntries();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainerInitializer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainerInitializer.java
new file mode 100644
index 0000000000..18850d9333
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainerInitializer.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.plugin.core.classpath;
+
+import org.eclipse.jdt.core.IClasspathContainer;
+
+/**
+ * A provider of a classpath container for use when launching the Tuscany
+ * runtime.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public interface RuntimeClasspathContainerInitializer {
+
+ /**
+ * Returns the classpath container to use.
+ *
+ * @return
+ */
+ IClasspathContainer getRuntimeClasspathContainer();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainerInitializerExtensionPoint.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainerInitializerExtensionPoint.java
new file mode 100644
index 0000000000..909290859a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/classpath/RuntimeClasspathContainerInitializerExtensionPoint.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.plugin.core.classpath;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+
+/**
+ * Utility functions to help list extensions registered in the runtime classpath
+ * extension point.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class RuntimeClasspathContainerInitializerExtensionPoint {
+
+ private static final String EXTENSION_POINT_ID = "org.apache.tuscany.sca.plugin.core.runtimeClasspathContainerInitializer";
+
+ /**
+ * Return the installed runtime classpath entries.
+ *
+ * @return
+ * @throws CoreException
+ */
+ public static String installedRuntimeClasspath() throws CoreException {
+
+ List<IClasspathEntry> classpathEntries = new ArrayList<IClasspathEntry>();
+ for (IExtension extension: Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID).getExtensions()) {
+ for (IConfigurationElement configuration: extension.getConfigurationElements()) {
+ RuntimeClasspathContainerInitializer initializer = (RuntimeClasspathContainerInitializer)configuration.createExecutableExtension("class");
+ IClasspathContainer container = initializer.getRuntimeClasspathContainer();
+ classpathEntries.addAll(Arrays.asList(container.getClasspathEntries()));
+ }
+ }
+
+ String separator = System.getProperty("path.separator");
+ StringBuffer classpath = new StringBuffer();
+ for (int i = 0, n = classpathEntries.size(); i < n; i++) {
+ IClasspathEntry entry = classpathEntries.get(i);
+ if (i >0) {
+ classpath.append(separator);
+ }
+ classpath.append(entry.getPath().toFile().toURI().getPath());
+ }
+
+ return classpath.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/DomainManagerLauncherUtil.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/DomainManagerLauncherUtil.java
new file mode 100644
index 0000000000..060f6ff6cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/DomainManagerLauncherUtil.java
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.plugin.core.launch;
+
+import static org.apache.tuscany.sca.plugin.core.launch.TuscanyLaunchConfigurationDelegate.TUSCANY_LAUNCH_CONFIGURATIONTYPE;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.plugin.core.classpath.CoreClasspathContainer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializerExtensionPoint;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.JavaRuntime;
+
+/**
+ * Provides utility methods to launch the SCA Domain Manager.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class DomainManagerLauncherUtil {
+
+ private static final String TUSCANY_DOMAIN_LAUNCH_CONFIGURATION = "SCA Domain Manager";
+ private static final String TUSCANY_SCA_DOMAIN_PROJECT = "tuscany-sca-domain";
+
+ private static final String PING_HEADER =
+ "GET /ping HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String PING_CONTENT = "";
+ private static final String PING =
+ PING_HEADER + PING_CONTENT.getBytes().length + "\n\n" + PING_CONTENT;
+
+ /**
+ * Returns the SCA domain project.
+ *
+ * @return
+ * @throws CoreException
+ */
+ static IProject domainProject(IProgressMonitor progressMonitor) throws CoreException {
+
+ IProject domainProject = ResourcesPlugin.getWorkspace().getRoot().getProject(TUSCANY_SCA_DOMAIN_PROJECT);
+ if (progressMonitor.isCanceled()) {
+ return domainProject;
+ }
+ if (!domainProject.exists()) {
+ progressMonitor.subTask("Creating SCA domain resources");
+
+ // Create SCA domain project if necessary
+ domainProject.create(new SubProgressMonitor(progressMonitor, 5));
+ domainProject.open(new SubProgressMonitor(progressMonitor, 5));
+
+ String html = "<html>\n" +
+ "<head>\n" +
+ "<meta http-equiv=\"refresh\" content=\"0;url=http://localhost:9990/ui/home\">\n" +
+ "</head>\n" +
+ "<body>\n" +
+ "<a href=\"http://localhost:9990/ui/home\">SCA Domain</a>\n" +
+ "</body>\n" +
+ "</html>";
+
+ IFile file = domainProject.getFile(new Path("domain.html"));
+ file.create(new ByteArrayInputStream(html.getBytes()), true, new SubProgressMonitor(progressMonitor, 5));
+
+ IProjectDescription description = domainProject.getDescription();
+ String[] prevNatures= description.getNatureIds();
+ String[] newNatures= new String[prevNatures.length + 1];
+ System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
+ newNatures[prevNatures.length]= JavaCore.NATURE_ID;
+ description.setNatureIds(newNatures);
+ domainProject.setDescription(description, new SubProgressMonitor(progressMonitor, 5));
+
+ IJavaProject javaProject = JavaCore.create(domainProject);
+ javaProject.setOutputLocation(domainProject.getFullPath(), new SubProgressMonitor(progressMonitor, 5));
+
+ IClasspathEntry classPath = JavaCore.newContainerEntry(new CoreClasspathContainer().getPath());
+ IClasspathEntry jrePath = JavaRuntime.getDefaultJREContainerEntry();
+ javaProject.setRawClasspath(new IClasspathEntry[] {jrePath, classPath}, new SubProgressMonitor(progressMonitor, 5));
+
+ } else {
+ domainProject.open(new SubProgressMonitor(progressMonitor, 5));
+ }
+
+ return domainProject;
+ }
+
+ /**
+ * Returns true if the SCA domain controller is running.
+ *
+ * @return
+ */
+ private static boolean isDomainManagerRunning() {
+ try {
+ Socket client = new Socket("localhost", 9990);
+ OutputStream os = client.getOutputStream();
+ os.write(DomainManagerLauncherUtil.PING.getBytes());
+ os.flush();
+ String response = DomainManagerLauncherUtil.read(client);
+ if (response.indexOf("<span id=\"ping\">") != -1) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Wait for domain to be running.
+ *
+ * @return
+ */
+ private static boolean waitForDomainManager(IProgressMonitor progressMonitor) throws InterruptedException {
+ progressMonitor.subTask("Contacting SCA domain manager");
+ for (int i = 0; i < 40; i++) {
+ if (progressMonitor.isCanceled()) {
+ return false;
+ }
+ if (isDomainManagerRunning()) {
+ return true;
+ }
+ Thread.sleep(500);
+ }
+ return false;
+ }
+
+ static void launchDomainManager(IProgressMonitor progressMonitor) throws JavaModelException, CoreException, InterruptedException {
+
+ progressMonitor.beginTask("Starting SCA Domain Manager", 100);
+
+ // If the SCA domain controller is not running yet, launch it
+ if (!isDomainManagerRunning()) {
+
+ progressMonitor.subTask("Starting SCA domain manager");
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+
+ // Get the SCA domain project
+ IProject domainProject = domainProject(progressMonitor);
+
+ // Get the domain manager launch configuration
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigurationType =launchManager.getLaunchConfigurationType(TUSCANY_LAUNCH_CONFIGURATIONTYPE);
+ ILaunchConfiguration configuration = null;
+ for (ILaunchConfiguration c : launchManager.getLaunchConfigurations(launchConfigurationType)) {
+ if (TUSCANY_DOMAIN_LAUNCH_CONFIGURATION.equals(c.getName())) {
+ configuration = c;
+ break;
+ }
+ }
+
+ if (configuration == null) {
+ progressMonitor.worked(10);
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+
+ // Create a new launch configuration
+ ILaunchConfigurationWorkingCopy newConfiguration = launchConfigurationType.newInstance(null, TUSCANY_DOMAIN_LAUNCH_CONFIGURATION);
+
+ // Set the project and type to launch
+ newConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, domainProject.getProject().getName());
+ newConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.apache.tuscany.sca.node.launcher.DomainManagerLauncher");
+ newConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, domainProject.getLocation().toString());
+
+ // Pass the runtime classpath as a system property
+ newConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "\"-DTUSCANY_PATH=" + RuntimeClasspathContainerInitializerExtensionPoint.installedRuntimeClasspath() + "\"");
+
+ // Save the configuration
+ newConfiguration.doSave();
+
+ configuration = newConfiguration;
+ }
+
+ // Launch
+ configuration.launch(ILaunchManager.RUN_MODE, new SubProgressMonitor(progressMonitor, 20));
+
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+ if (!waitForDomainManager(progressMonitor)) {
+ throw new RuntimeException("SCA Domain Manager could not be started.");
+ }
+ }
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+ progressMonitor.done();
+
+ }
+
+ /**
+ * Read a String from a socket.
+ *
+ * @param socket
+ * @return
+ * @throws IOException
+ */
+ 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();
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/NodeLauncherUtil.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/NodeLauncherUtil.java
new file mode 100644
index 0000000000..edbe4b3e69
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/NodeLauncherUtil.java
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.plugin.core.launch;
+
+import static org.apache.tuscany.sca.plugin.core.launch.DomainManagerLauncherUtil.domainProject;
+import static org.apache.tuscany.sca.plugin.core.launch.DomainManagerLauncherUtil.launchDomainManager;
+import static org.apache.tuscany.sca.plugin.core.launch.TuscanyLaunchConfigurationDelegate.TUSCANY_LAUNCH_CONFIGURATIONTYPE;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializerExtensionPoint;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+
+/**
+ * Provides utility methods to launch SCA nodes.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class NodeLauncherUtil {
+
+ private static final String START_HEADER1 =
+ "GET /quickstart?";
+ private static final String START_HEADER2 =
+ " HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String START_CONTENT = "";
+
+ /**
+ * Launch an SCA node.
+ *
+ * @param mode
+ * @param file
+ * @param launchManager
+ * @param launchConfigurationType
+ * @throws CoreException
+ * @throws JavaModelException
+ */
+ static void launchNode(String mode,
+ IFile file,
+ IProgressMonitor progressMonitor) throws CoreException, JavaModelException, IOException, InterruptedException {
+ progressMonitor.subTask("Starting SCA node");
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+
+ // First start the SCA domain manager
+ launchDomainManager(new SubProgressMonitor(progressMonitor, 20));
+
+ // Get the Java project
+ IJavaProject javaProject = JavaCore.create(file.getProject());
+
+ // Get the contribution location and URI
+ String contributionLocation = contributionLocation(javaProject);
+ String contributionURI = contributionURI(javaProject);
+
+ // Determine the composite file URI
+ String compositeURI = compositeURI(javaProject, file);
+
+ // Configure the node
+ String nodeName = configureNode(contributionURI, contributionLocation, compositeURI, progressMonitor);
+
+ // Get the node launch configuration
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigurationType =launchManager.getLaunchConfigurationType(TUSCANY_LAUNCH_CONFIGURATIONTYPE);
+ ILaunchConfiguration configuration = null;
+ for (ILaunchConfiguration c : launchManager.getLaunchConfigurations(launchConfigurationType)) {
+ if (file.getFullPath().toString().equals(c.getAttribute("COMPOSITE_PATH", ""))) {
+ configuration = c;
+ break;
+ }
+ }
+
+ if (configuration == null) {
+ progressMonitor.worked(10);
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+
+ // Create a new launch configuration
+ ILaunchConfigurationWorkingCopy newConfiguration = launchConfigurationType.newInstance(null,
+ launchManager.generateUniqueLaunchConfigurationNameFrom(file.getName()));
+
+ // Set the project and type to launch
+ newConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, file.getProject().getName());
+ newConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.apache.tuscany.sca.node.launcher.NodeLauncher");
+
+ // Pass the URL of the node install image to the launcher
+ newConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ "http://localhost:9990/node-config/" + nodeName);
+
+ // Save the composite path in the launch configuration
+ newConfiguration.setAttribute("COMPOSITE_PATH", file.getFullPath().toString());
+
+ // Pass the runtime classpath as a system property
+ newConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "\"-DTUSCANY_PATH=" + RuntimeClasspathContainerInitializerExtensionPoint.installedRuntimeClasspath() + "\"");
+
+ // Save the configuration
+ newConfiguration.doSave();
+
+ configuration = newConfiguration;
+ }
+
+ // Launch
+ configuration.launch(mode, null);
+ }
+
+ /**
+ * Returns the location of the SCA contribution representing a Java project.
+ * @param javaProject
+ * @return
+ * @throws MalformedURLException
+ * @throws JavaModelException
+ */
+ private static String contributionLocation(IJavaProject javaProject) throws MalformedURLException, JavaModelException {
+ IPath location = javaProject.getOutputLocation();
+ IResource resource;
+ if (location.segmentCount() == 1) {
+ resource = javaProject.getProject();
+ } else {
+ resource = javaProject.getProject().getWorkspace().getRoot().getFolder(location);
+ }
+ location = resource.getLocation();
+ String url = location.toFile().toURI().toURL().toString();
+ if (url.endsWith("/")) {
+ url = url.substring(0, url.length() - 1);
+ }
+ return url;
+ }
+
+ /**
+ * Returns the URI of the SCA contribution representing a Java project.
+ * @param javaProject
+ * @return
+ */
+ private static String contributionURI(IJavaProject javaProject) {
+ return javaProject.getProject().getName();
+ }
+
+ /**
+ * Returns the SCA artifact URI of a composite file inside a Java project.
+ *
+ * @param javaProject
+ * @param file
+ * @return
+ * @throws JavaModelException
+ */
+ private static String compositeURI(IJavaProject javaProject, IFile file) throws JavaModelException {
+
+ // Find the Java source container containing the specified file
+ IClasspathEntry[] classpathEntries = javaProject.getRawClasspath();
+ int sourceFolderSegments = 0;
+ for (IClasspathEntry entry : classpathEntries) {
+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ sourceFolderSegments = entry.getPath().matchingFirstSegments(file.getFullPath());
+ if (sourceFolderSegments > 0)
+ break;
+ }
+ }
+
+ // Determine the composite URI
+ String compositeURI = file.getFullPath().removeFirstSegments(sourceFolderSegments).toString();
+ return compositeURI;
+ }
+
+ /**
+ * Send a request to the SCA domain manager to configure an SCA node for
+ * the specified composite.
+ *
+ * @param contributionURI
+ * @param contributionLocation
+ * @param compositeURI
+ * @return
+ * @throws IOException
+ */
+ private static String configureNode(String contributionURI, String contributionLocation, String compositeURI,
+ IProgressMonitor progressMonitor) throws IOException, CoreException {
+ progressMonitor.subTask("Configuring node");
+
+ // Send the request to configure the node
+ Socket client = new Socket("localhost", 9990);
+ OutputStream os = client.getOutputStream();
+ String request = START_HEADER1 +
+ "contribution=" + contributionURI + "&location=" + contributionLocation + "&composite=" + compositeURI +
+ START_HEADER2 + START_CONTENT.getBytes().length + "\n\n" + START_CONTENT;
+ os.write(request.getBytes());
+ os.flush();
+ String response = DomainManagerLauncherUtil.read(client);
+
+ // Refresh the domain project
+ domainProject(progressMonitor).refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+
+ int i = response.indexOf("<span id=\"node\">");
+ if (i != -1) {
+
+ // Extract the node name
+ response = response.substring(i + 16);
+ i = response.indexOf("</span>");
+ String nodeName = response.substring(0, i);
+ return nodeName;
+
+ } else {
+ throw new RuntimeException("Node could not be configured: " + response);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchConfigurationDelegate.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchConfigurationDelegate.java
new file mode 100644
index 0000000000..056deb5b27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchConfigurationDelegate.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.plugin.core.launch;
+
+import java.io.File;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.ExecutionArguments;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMRunner;
+import org.eclipse.jdt.launching.VMRunnerConfiguration;
+
+/**
+ * Launch configuration delegate for the Tuscany launch configuration.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate implements
+ ILaunchConfigurationDelegate {
+
+ public static final String TUSCANY_LAUNCH_CONFIGURATIONTYPE = "org.apache.tuscany.sca.plugin.core.launch.configurationtype";
+
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+
+ // Verify the configuration
+ String mainTypeName = verifyMainTypeName(configuration);
+ IVMInstall vm = verifyVMInstall(configuration);
+ IVMRunner runner = vm.getVMRunner(mode);
+
+ ExecutionArguments execArgs =
+ new ExecutionArguments(getVMArguments(configuration), getProgramArguments(configuration));
+ Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
+ String[] classpath = getClasspath(configuration);
+
+ File workingDir = verifyWorkingDirectory(configuration);
+ String workingDirName = null;
+ if (workingDir != null)
+ workingDirName = workingDir.getAbsolutePath();
+
+ // Create a VM runner configuration
+ VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
+ runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
+ runConfig.setVMArguments(execArgs.getVMArgumentsArray());
+ runConfig.setVMSpecificAttributesMap(vmAttributesMap);
+ runConfig.setWorkingDirectory(workingDirName);
+ runConfig.setBootClassPath(getBootpath(configuration));
+
+ // Run!!
+ runner.run(runConfig, launch, monitor);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchConfigurationTabGroup.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchConfigurationTabGroup.java
new file mode 100644
index 0000000000..5f8ea73db4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchConfigurationTabGroup.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.plugin.core.launch;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
+
+/**
+ * Tab groups from the Tuscany launch configuration.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup implements
+ ILaunchConfigurationTabGroup {
+
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs =
+ new ILaunchConfigurationTab[] {new JavaArgumentsTab(), new JavaJRETab(), new JavaClasspathTab(),
+ new SourceLookupTab(), new EnvironmentTab(), new CommonTab()};
+
+ setTabs(tabs);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchDomainManagerAction.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchDomainManagerAction.java
new file mode 100644
index 0000000000..f66fa71191
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchDomainManagerAction.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.plugin.core.launch;
+
+import static org.apache.tuscany.sca.plugin.core.launch.DomainManagerLauncherUtil.launchDomainManager;
+import static org.apache.tuscany.sca.plugin.core.log.LogUtil.error;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * Launch the SCA DomainManager.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class TuscanyLaunchDomainManagerAction implements IWorkbenchWindowActionDelegate {
+
+ private IWorkbenchWindow window;
+
+ public TuscanyLaunchDomainManagerAction() {
+ }
+
+ public void run(IAction action) {
+
+ try {
+
+ // Run with a progress monitor
+ window.run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException {
+ try {
+
+ launchDomainManager(progressMonitor);
+
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ progressMonitor.done();
+ }
+ }
+ });
+
+ } catch (Exception e) {
+ error("Could not launch SCA Domain Manager", e);
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ public void dispose() {
+ }
+
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchNodeFilter.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchNodeFilter.java
new file mode 100644
index 0000000000..6eba5ffdc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchNodeFilter.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.plugin.core.launch;
+
+/**
+ * TuscanyLaunchNodeFilter
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class TuscanyLaunchNodeFilter {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchNodeShortcut.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchNodeShortcut.java
new file mode 100644
index 0000000000..2a4c7206db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/launch/TuscanyLaunchNodeShortcut.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.plugin.core.launch;
+
+import static org.apache.tuscany.sca.plugin.core.launch.NodeLauncherUtil.launchNode;
+import static org.apache.tuscany.sca.plugin.core.log.LogUtil.error;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * A launch shortcut for SCA .composite files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyLaunchNodeShortcut implements ILaunchShortcut {
+
+ public void launch(final ISelection selection, final String mode) {
+
+ try {
+
+ // Make sure we have a .composite file selected
+ if (!(selection instanceof IStructuredSelection)) {
+ return;
+ }
+ Object[] selections = ((IStructuredSelection)selection).toArray();
+ if (selections.length == 0) {
+ return;
+ }
+ final IFile file = (IFile)selections[0];
+ if (!file.getFileExtension().equals("composite")) {
+ return;
+ }
+
+ // Run with a progress monitor
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException {
+ try {
+ progressMonitor.beginTask("Starting SCA Composite", 100);
+
+ launchNode(mode, file, progressMonitor);
+
+ progressMonitor.done();
+
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ progressMonitor.done();
+ }
+ }
+ });
+
+ } catch (Exception e) {
+ error("Could not launch SCA composite", e);
+ }
+ }
+
+ public void launch(IEditorPart editor, String mode) {
+ //TODO later...
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/log/LogUtil.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/log/LogUtil.java
new file mode 100644
index 0000000000..5fc1a75960
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/log/LogUtil.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.plugin.core.log;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * A log utility
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class LogUtil {
+
+ public static void error(String msg, Exception e) {
+ Platform.getLog(
+ Platform.getBundle("org.apache.tuscany.sca.plugin.core")).log(
+ new Status(IStatus.ERROR, "org.apache.tuscany.sca.plugin.core", IStatus.OK, msg, e));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewComponentTypeWizard.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewComponentTypeWizard.java
new file mode 100644
index 0000000000..702da9701e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewComponentTypeWizard.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.plugin.core.newwizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+/**
+ * A wizard to create new .componentType files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NewComponentTypeWizard extends Wizard implements IWorkbenchWizard {
+
+ private IWorkbench workbench;
+ private IStructuredSelection selection;
+ private NewComponentTypeWizardPage mainPage;
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle("New SCA ComponentType");
+ }
+
+ public void addPages() {
+ mainPage = new NewComponentTypeWizardPage(workbench, selection);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewComponentTypeWizardPage.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewComponentTypeWizardPage.java
new file mode 100644
index 0000000000..a1c6cb86a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewComponentTypeWizardPage.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.plugin.core.newwizards;
+
+import static org.apache.tuscany.sca.plugin.core.log.LogUtil.error;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * Wizard page for the new .componentType file wizard.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NewComponentTypeWizardPage extends WizardNewFileCreationPage {
+
+ private IWorkbench workbench;
+
+ public NewComponentTypeWizardPage(IWorkbench workbench, IStructuredSelection selection) {
+ super("New SCA ComponentType Page", selection);
+
+ this.workbench = workbench;
+
+ setTitle("SCA ComponentType");
+ setDescription("Create a new SCA ComponentType.");
+
+ try {
+ String location = FileLocator.toFileURL(Platform.getBundle("org.apache.tuscany.sca.plugin.core").getEntry("/")).getFile().toString();
+ setImageDescriptor(ImageDescriptor.createFromImageData((new ImageLoader()).load(location + "/icons/tuscany.gif")[0]));
+ } catch (Exception e) {
+ error("Could not create wizard", e);
+ }
+
+ setFileName("sample.componentType");
+
+ }
+
+ public boolean finish() {
+ try {
+ IFile file = createNewFile();
+
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+ IDE.openEditor(workbenchPage, file, true);
+ } catch (Exception e) {
+ error("Could not open editor", e);
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected InputStream getInitialContents() {
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PrintWriter printWriter = new PrintWriter(outputStream);
+ printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ printWriter.println("<componentType xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"");
+ printWriter.println(" xmlns:t=\"http://tuscany.apache.org/xmlns/sca/1.0\">");
+ printWriter.println();
+ printWriter.println();
+ printWriter.println("</componentType>");
+ printWriter.close();
+
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewCompositeWizard.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewCompositeWizard.java
new file mode 100644
index 0000000000..5e059308e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewCompositeWizard.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.plugin.core.newwizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+/**
+ * A wizard to create new .composite files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NewCompositeWizard extends Wizard implements IWorkbenchWizard {
+
+ private IWorkbench workbench;
+ private IStructuredSelection selection;
+ private NewCompositeWizardPage mainPage;
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle("New SCA Composite");
+ }
+
+ public void addPages() {
+ mainPage = new NewCompositeWizardPage(workbench, selection);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewCompositeWizardPage.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewCompositeWizardPage.java
new file mode 100644
index 0000000000..5d9f2bdf70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/org/apache/tuscany/sca/plugin/core/newwizards/NewCompositeWizardPage.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.plugin.core.newwizards;
+
+import static org.apache.tuscany.sca.plugin.core.log.LogUtil.error;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * Wizard page for the new .composite file wizard.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NewCompositeWizardPage extends WizardNewFileCreationPage {
+
+ private IWorkbench workbench;
+
+ public NewCompositeWizardPage(IWorkbench workbench, IStructuredSelection selection) {
+ super("New SCA Composite Page", selection);
+
+ this.workbench = workbench;
+
+ setTitle("SCA Composite");
+ setDescription("Create a new SCA Composite.");
+
+ try {
+ String location = FileLocator.toFileURL(Platform.getBundle("org.apache.tuscany.sca.plugin.core").getEntry("/")).getFile().toString();
+ setImageDescriptor(ImageDescriptor.createFromImageData((new ImageLoader()).load(location + "/icons/tuscany.gif")[0]));
+ } catch (Exception e) {
+ error("Could not create wizard", e);
+ }
+
+ setFileName("sample.composite");
+
+ }
+
+ public boolean finish() {
+ try {
+ IFile file = createNewFile();
+
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+ IDE.openEditor(workbenchPage, file, true);
+ } catch (Exception e) {
+ error("Could not open editor", e);
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected InputStream getInitialContents() {
+
+ IPath path = new Path(getFileName());
+ String name = path.removeFileExtension().toString();
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PrintWriter printWriter = new PrintWriter(outputStream);
+ printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ printWriter.println("<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"");
+ printWriter.println(" xmlns:t=\"http://tuscany.apache.org/xmlns/sca/1.0\"");
+ printWriter.println(" xmlns:c=\"http://" + name + "\"");
+ printWriter.println(" targetNamespace=\"http://" + name + "\"");
+ printWriter.println(" name=\"" + name + "\">");
+ printWriter.println();
+ printWriter.println();
+ printWriter.println("</composite>");
+ printWriter.close();
+
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/plugin.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/plugin.xml
new file mode 100644
index 0000000000..edc17c5ee2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/plugin.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<plugin>
+
+ <extension-point id="runtimeClasspathContainerInitializer"
+ name="Tuscany Runtime Classpath Container Initializers"
+ schema="exsd/runtimeClasspathContainerInitializer.exsd"/>
+
+ <extension point = "org.eclipse.wst.xml.core.catalogContributions">
+ <catalogContribution id="default">
+ <uri name="http://www.osoa.org/xmlns/sca/1.0" uri="xsd/sca-all.xsd"/>
+ </catalogContribution>
+ </extension>
+
+ <extension point = "org.eclipse.wst.xml.core.catalogContributions">
+ <catalogContribution id="default">
+ <uri name="http://tuscany.apache.org/xmlns/sca/1.0" uri="xsd/tuscany-sca.xsd"/>
+ </catalogContribution>
+ </extension>
+
+ <extension point="org.eclipse.core.runtime.contentTypes">
+ <file-association content-type="org.eclipse.core.runtime.xml" file-extensions="composite"/>
+ <file-association content-type="org.eclipse.core.runtime.xml" file-extensions="componentType"/>
+ </extension>
+
+ <extension
+ point="org.apache.tuscany.sca.plugin.core.runtimeClasspathContainerInitializer">
+ <runtimeClasspathContainerInitializer
+ id="org.apache.tuscany.sca.plugin.core.runtime.library"
+ class="org.apache.tuscany.sca.plugin.core.classpath.CoreClasspathContainerInitializer"/>
+ </extension>
+
+ <extension point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer
+ id="org.apache.tuscany.sca.plugin.core.runtime.library"
+ class="org.apache.tuscany.sca.plugin.core.classpath.CoreClasspathContainerInitializer"/>
+ </extension>
+
+ <extension point="org.eclipse.jdt.ui.classpathContainerPage">
+ <classpathContainerPage
+ id="org.apache.tuscany.sca.plugin.core.runtime.library"
+ name="Tuscany SCA Core Library"
+ class="org.apache.tuscany.sca.plugin.core.classpath.CoreLibraryEntryPage">
+ </classpathContainerPage>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="Tuscany"
+ visible="true"
+ id="org.apache.tuscany.sca.plugin.core.launch.actionSet">
+ <action
+ label="&amp;Start SCA Domain Manager"
+ icon="icons/t.gif"
+ class="org.apache.tuscany.sca.plugin.core.launch.TuscanyLaunchDomainManagerAction"
+ tooltip="Start SCA Domain Manager"
+ toolbarPath="tuscanyGroup"
+ id="org.apache.tuscany.sca.plugin.core.launch.TuscanyLaunchDomainManagerAction">
+ </action>
+ </actionSet>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ name="Tuscany"
+ delegate="org.apache.tuscany.sca.plugin.core.launch.TuscanyLaunchConfigurationDelegate"
+ modes="run, debug"
+ sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
+ sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer"
+ id="org.apache.tuscany.sca.plugin.core.launch.configurationtype">
+ </launchConfigurationType>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ icon="icons/t.gif"
+ configTypeID="org.apache.tuscany.sca.plugin.core.launch.configurationtype"
+ id="org.apache.tuscany.sca.plugin.core.launch.configurationtypeimage">
+ </launchConfigurationTypeImage>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ type="org.apache.tuscany.sca.plugin.core.launch.configurationtype"
+ class="org.apache.tuscany.sca.plugin.core.launch.TuscanyLaunchConfigurationTabGroup"
+ id="org.apache.tuscany.sca.plugin.core.launch.configurationtypetabgroup">
+ </launchConfigurationTabGroup>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ id="org.apache.tuscany.sca.plugin.core.launchshortcut"
+ class="org.apache.tuscany.sca.plugin.core.launch.TuscanyLaunchNodeShortcut"
+ label="Tuscany"
+ icon="icons/t.gif"
+ modes="run, debug">
+ <contextualLaunch>
+ <enablement>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <or>
+ <test property="org.eclipse.debug.ui.matchesPattern" value="*.composite"/>
+ </or>
+ </iterate>
+ </with>
+ </enablement>
+ </contextualLaunch>
+ </shortcut>
+ </extension>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <category name="Tuscany" id="org.apache.tuscany.sca.plugin.core.newwizards" />
+ <wizard name="Composite" icon="icons/t.gif"
+ category="org.apache.tuscany.sca.plugin.core.newwizards"
+ class="org.apache.tuscany.sca.plugin.core.newwizards.NewCompositeWizard"
+ preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective"
+ id="org.apache.tuscany.sca.plugin.core.newwizards.newcompositewizard">
+ <description>Create a new SCA Composite</description>
+ </wizard>
+ <wizard name="ComponentType" icon="icons/t.gif"
+ category="org.apache.tuscany.sca.plugin.core.newwizards"
+ class="org.apache.tuscany.sca.plugin.core.newwizards.NewComponentTypeWizard"
+ preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective"
+ id="org.apache.tuscany.sca.plugin.core.newwizards.newcompositewizard">
+ <description>Create a new SCA ComponentType</description>
+ </wizard>
+ </extension>
+
+</plugin>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/pom.xml
new file mode 100644
index 0000000000..b32ec079d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/pom.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.plugin.core</artifactId>
+ <name>Apache Tuscany SCA Core Eclipse Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jdt.debug</groupId>
+ <artifactId>ui</artifactId>
+ <version>3.2.100-v20070531-1800</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.swt.win32.win32</groupId>
+ <artifactId>x86</artifactId>
+ <version>3.3.0-v3346</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <type>zip</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <classifier>src</classifier>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>tmp</classifier>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </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/jar.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <appendAssemblyId>false</appendAssemblyId>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repo1.eclipse</id>
+ <url>http://repo1.maven.org/eclipse/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/src/main/assembly/jar.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/src/main/assembly/jar.xml
new file mode 100644
index 0000000000..7832ba5131
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/src/main/assembly/jar.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>plugin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <!--
+ <format>dir</format>
+ <format>tar.gz</format>
+ -->
+ <format>jar</format>
+ </formats>
+
+ <fileSets>
+
+ <!-- Add the classes -->
+ <fileSet>
+ <directory>target/classes</directory>
+ <outputDirectory></outputDirectory>
+ <excludes>
+ <!-- General file/folders to exclude -->
+ <exclude>**/.*</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>**/*.log</exclude>
+
+ <!-- Sample specific files/folders to exclude -->
+ <exclude>pom.xml</exclude>
+ <exclude>src/</exclude>
+ <exclude>src/**/*</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+
+ <!-- Add the distributions -->
+ <dependencySet>
+ <useTransitiveDependencies>false</useTransitiveDependencies>
+ <unpack>true</unpack>
+ <includes>
+ <include>*:zip</include>
+ </includes>
+ <excludes>
+ <exclude>*:zip:src</exclude>
+ </excludes>
+ <unpackOptions>
+ <excludes>
+ <exclude>*/samples</exclude>
+ <exclude>*/samples/**/*</exclude>
+ </excludes>
+ </unpackOptions>
+ </dependencySet>
+
+ <dependencySet>
+ <useTransitiveDependencies>false</useTransitiveDependencies>
+ <unpack>false</unpack>
+ <includes>
+ <include>*:zip:src</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-all.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-all.xsd
new file mode 100644
index 0000000000..1b19ede427
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-all.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.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <include schemaLocation="sca.xsd"/>
+
+ <include schemaLocation="sca-contribution.xsd"/>
+
+ <include schemaLocation="sca-binding-ejb.xsd"/>
+
+ <include schemaLocation="sca-implementation-bpel.xsd"/>
+ <include schemaLocation="sca-implementation-spring.xsd"/>
+ <include schemaLocation="sca-implementation-ejb.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-ejb.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-ejb.xsd
new file mode 100644
index 0000000000..26bedfcce5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-ejb.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ejb" type="sca:EJBSessionBeanBinding"
+ substitutionGroup="sca:binding" />
+
+ <simpleType name="BeanType">
+ <restriction base="string">
+ <enumeration value="stateless"/>
+ <enumeration value="stateful"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="VersionValue">
+ <restriction base="string">
+ <enumeration value="EJB2"/>
+ <enumeration value="EJB3"/>
+ </restriction>
+ </simpleType>
+
+
+ <complexType name="EJBSessionBeanBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="homeInterface" type="NCName" use="optional"/>
+ <attribute name="ejb-link-name" type="NCName" use="optional"/>
+ <attribute name="session-type" type="sca:BeanType" use="optional" default="stateless"/>
+ <attribute name="ejb-version" type="sca:VersionValue" use="optional" default="EJB2"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-jms.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-jms.xsd
new file mode 100644
index 0000000000..850f32b56a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-jms.xsd
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <complexType name="JMSBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <element name="destination" type="sca:Destination" minOccurs="0"/>
+ <element name="connectionFactory" type="sca:ConnectionFactory"
+ minOccurs="0"/>
+ <element name="activationSpec" type="sca:ActivationSpec"
+ minOccurs="0"/>
+ <element name="response" type="sca:Response" minOccurs="0"/>
+ <element name="headers" type="sca:Headers" minOccurs="0"/>
+ <element name="resourceAdapter" type="sca:ResourceAdapter"
+ minOccurs="0"/>
+ <element name="operationProperties" type="sca:OperationProperties"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="correlationScheme"
+ default="RequestMsgIDToCorrelID">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="RequestMsgIDToCorrelID"/>
+ <enumeration value="RequestCorrelIDToCorrelID"/>
+ <enumeration value="None"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+
+ <attribute name="initialContextFactory" type="anyURI"/>
+ <attribute name="jndiURL" type="anyURI"/>
+ <attribute name="requestConnection" type="QName"/>
+ <attribute name="responseConnection" type="QName"/>
+ <attribute name="operationProperties" type="QName"/>
+ <anyAttribute/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="CreateResource">
+ <restriction base="string">
+ <enumeration value="always"/>
+ <enumeration value="never"/>
+ <enumeration value="ifnotexist"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="Destination">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="type" use="optional" default="queue">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="queue"/>
+ <enumeration value="topic"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="ConnectionFactory">
+ <sequence> <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="ActivationSpec">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="Response">
+ <sequence>
+ <element name="destination" type="sca:Destination" minOccurs="0"/>
+ <element name="connectionFactory" type="sca:ConnectionFactory"
+ minOccurs="0"/>
+ <element name="activationSpec" type="sca:ActivationSpec" minOccurs="0"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="Headers">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="JMSType" type="string"/>
+ <attribute name="JMSCorrelationID" type="string"/>
+ <attribute name="JMSDeliveryMode" type="string"/>
+ <attribute name="JMSTimeToLive" type="int"/>
+ <attribute name="JMSPriority" type="string"/>
+ </complexType>
+
+ <complexType name="ResourceAdapter">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="string" use="required"/>
+ </complexType>
+
+ <complexType name="OperationProperties">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <element name="headers" type="sca:Headers"/>
+ </sequence>
+ <attribute name="name" type="string" use="required"/>
+ <attribute name="nativeOperation" type="string"/>
+ </complexType>
+
+ <element name="binding.jms" type="sca:JMSBinding"
+ substitutionGroup="sca:binding"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-sca.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-sca.xsd
new file mode 100644
index 0000000000..02703402ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-sca.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.sca" type="sca:SCABinding"
+ substitutionGroup="sca:binding"/>
+ <complexType name="SCABinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-webservice.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-webservice.xsd
new file mode 100644
index 0000000000..3e92de193b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-binding-webservice.xsd
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ xmlns:wsa="http://www.w3.org/2004/12/addressing"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ws" type="sca:WebServiceBinding"
+ substitutionGroup="sca:binding"/>
+ <complexType name="WebServiceBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="wsdlElement" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-contribution.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-contribution.xsd
new file mode 100644
index 0000000000..c7f92f6c3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-contribution.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.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="contribution" type="sca:Contribution"/>
+
+ <complexType name="Contribution">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##any" processContents="lax"/>
+ </choice>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-core.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-core.xsd
new file mode 100644
index 0000000000..1c6291792b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-core.xsd
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="sca:implementation"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService" />
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:Property"/>
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="composite" type="sca:Composite"/>
+ <complexType name="Composite">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="include" type="sca:Include"/>
+ <element name="service" type="sca:Service"/>
+ <element name="property" type="sca:Property"/>
+ <element name="component" type="sca:Component"/>
+ <element name="reference" type="sca:Reference"/>
+ <element name="wire" type="sca:Wire"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="targetNamespace" type="anyURI" use="optional"/>
+ <attribute name="local" type="boolean" use="optional" default="false"/>
+ <attribute name="autowire" type="boolean" use="optional" default="false"/>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="promote" type="anyURI" use="required" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <element name="interface" type="sca:Interface" abstract="true" />
+ <complexType name="Interface" abstract="true"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax" />
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
+ <attribute name="wiredByImpl" type="boolean" use="optional" default="false"/>
+ <attribute name="multiplicity" type="sca:Multiplicity"
+ use="optional" default="1..1" />
+ <attribute name="promote" type="sca:listOfAnyURIs" use="required" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <complexType name="SCAPropertyBase" mixed="true">
+ <!-- mixed="true" to handle simple type -->
+ <sequence>
+ <any namespace="##any" processContents="lax" minOccurs="0"
+ maxOccurs="1" />
+ <!-- NOT an extension point; This xsd:any exists to accept
+ the element-based or complex type property
+ i.e. no element-based extension point under "sca:property" -->
+ </sequence>
+ </complexType>
+
+ <!-- complex type for sca:property declaration -->
+ <complexType name="Property" mixed="true">
+ <complexContent>
+ <extension base="sca:SCAPropertyBase">
+ <!-- extension defines the place to hold default value -->
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="optional"/>
+ <attribute name="element" type="QName" use="optional"/>
+ <attribute name="many" type="boolean" default="false"
+ use="optional"/>
+ <attribute name="noDefault" type="boolean" default="false"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ <!-- an extension point ; attribute-based only -->
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="PropertyValue" mixed="true">
+ <complexContent>
+ <extension base="sca:SCAPropertyBase">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="optional"/>
+ <attribute name="element" type="QName" use="optional"/>
+ <attribute name="many" type="boolean" default="false"
+ use="optional"/>
+ <attribute name="source" type="string" use="optional"/>
+ <attribute name="file" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ <!-- an extension point ; attribute-based only -->
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="binding" type="sca:Binding" abstract="true"/>
+ <complexType name="Binding" abstract="true">
+ <sequence>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <attribute name="name" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ </complexType>
+
+ <element name="bindingType" type="sca:BindingType"/>
+ <complexType name="BindingType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax" />
+ </sequence>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="callback" type="sca:Callback"/>
+ <complexType name="Callback">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Component">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="sca:implementation"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService"/>
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:PropertyValue" />
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="autowire" type="boolean" use="optional" default="false"/>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ComponentService">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1"/>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1"/>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="requires" type="sca:listOfQNames"
+ use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ComponentReference">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax" />
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
+ <attribute name="multiplicity" type="sca:Multiplicity"
+ use="optional" default="1..1" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <element name="implementation" type="sca:Implementation"
+ abstract="true" />
+ <complexType name="Implementation" abstract="true">
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ </complexType>
+
+ <element name="implementationType" type="sca:ImplementationType"/>
+ <complexType name="ImplementationType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax" />
+ </sequence>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Wire">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="source" type="anyURI" use="required"/>
+ <attribute name="target" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="include" type="sca:Include"/>
+ <complexType name="Include">
+ <attribute name="name" type="QName"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Operation">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="constrainingType" type="sca:ConstrainingType"/>
+ <complexType name="ConstrainingType">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService"/>
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:Property" />
+ </choice>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="targetNamespace" type="anyURI"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <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>
+
+ <!-- Global attribute definition for @requires to permit use of intents
+ within WSDL documents -->
+ <attribute name="requires" type="sca:listOfQNames"/>
+
+ <!-- Global attribute defintion for @endsConversation to mark operations
+ as ending a conversation -->
+ <attribute name="endsConversation" type="boolean" default="false"/>
+
+ <simpleType name="listOfQNames">
+ <list itemType="QName"/>
+ </simpleType>
+
+ <simpleType name="listOfAnyURIs">
+ <list itemType="anyURI"/>
+ </simpleType>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-definitions.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-definitions.xsd
new file mode 100644
index 0000000000..0249882a92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-definitions.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+ <include schemaLocation="sca-policy.xsd"/>
+
+ <element name="definitions">
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:intent"/>
+ <element ref="sca:policySet"/>
+ <element ref="sca:binding"/>
+ <element ref="sca:bindingType"/>
+ <element ref="sca:implementationType"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="targetNamespace" type="anyURI" use="optional"/>
+ </complexType>
+ </element>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-bpel.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-bpel.xsd
new file mode 100644
index 0000000000..87b443fb36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-bpel.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<xsd:schema xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <xsd:include schemaLocation="sca-core.xsd" />
+
+ <xsd:element name="implementation.bpel" type="BpelImplementation"
+ substitutionGroup="implementation" />
+
+ <xsd:complexType name="BpelImplementation">
+ <xsd:complexContent>
+ <xsd:extension base="Implementation">
+ <xsd:sequence>
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="process" type="xsd:QName" use="required" />
+ <xsd:anyAttribute namespace="##any" processContents="lax" />
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:element name="interface.partnerLinkType" type="BpelPartnerLinkType"
+ substitutionGroup="interface" />
+
+ <xsd:complexType name="BpelPartnerLinkType">
+ <xsd:complexContent>
+ <xsd:extension base="Interface">
+ <xsd:sequence>
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:QName" use="required" />
+ <xsd:attribute name="serviceRole" type="xsd:NCName" use="optional" />
+ <xsd:anyAttribute namespace="##any" processContents="lax" />
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-composite.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-composite.xsd
new file mode 100644
index 0000000000..99669bc672
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-composite.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+ <element name="implementation.composite" type="sca:SCAImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="SCAImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="QName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-cpp.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-cpp.xsd
new file mode 100644
index 0000000000..6f1cf14a4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-cpp.xsd
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.cpp" type="sca:CPPImplementation" substitutionGroup="sca:implementation" />
+ <complexType name="CPPImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <element name="method" type="sca:CPPImplementationMethod" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="library" type="NCName" use="required"/>
+ <attribute name="header" type="NCName" use="required"/>
+ <attribute name="path" type="NCName" use="optional"/>
+ <attribute name="class" type="Name" use="optional"/>
+ <attribute name="scope" type="sca:CPPImplementationScope" use="optional"/>
+ <attribute name="eagerInit" type="boolean" use="optional"/>
+ <attribute name="allowsPassByReference" type="boolean" use="optional"/>
+ <attribute name="conversationMaxAge" type="string" use="optional"/>
+ <attribute name="conversationMaxIdle" type="string" use="optional"/>
+ <attribute name="conversationSinglePrincipal" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="CPPImplementationScope">
+ <restriction base="string">
+ <enumeration value="stateless"/>
+ <enumeration value="composite"/>
+ <enumeration value="request"/>
+ <enumeration value="converstion"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="CPPImplementationMethod">
+ <complexContent>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="allowsPassByReference" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexContent>
+ </complexType>
+
+</schema>
+
+
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-ejb.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-ejb.xsd
new file mode 100644
index 0000000000..1bca6199cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-ejb.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.ejb" type="sca:EJBImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="EJBImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <!-- we might want to make this refer to the JEE ejb-link type -->
+ <attribute name="ejb-link" type="token" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-java.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-java.xsd
new file mode 100644
index 0000000000..f9d8171b8e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-java.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.java" type="sca:JavaImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="JavaImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-spring.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-spring.xsd
new file mode 100644
index 0000000000..1cf9fb3ea9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-implementation-spring.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.spring" type="sca:SpringImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="SpringImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-cpp.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-cpp.xsd
new file mode 100644
index 0000000000..44f14e5ed5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-cpp.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/1.0/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/1.0/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.cpp" type="sca:CPPInterface" substitutionGroup="sca:interface"/>
+
+ <complexType name="CPPInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <element name="method" type="sca:CPPMethod" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="header" type="NCName" use="required"/>
+ <attribute name="class" type="Name" use="required"/>
+ <attribute name="callbackHeader" type="NCName" use="optional"/>
+ <attribute name="callbackClass" type="Name" use="optional"/>
+ <attribute name="remotable" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="CPPMethod">
+ <complexContent>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="oneWay" type="boolean" use="optional"/>
+ <attribute name="endConversation" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexContent>
+ </complexType>
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-java.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-java.xsd
new file mode 100644
index 0000000000..81f939bdb4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-java.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.java" type="sca:JavaInterface" substitutionGroup="sca:interface"/>
+ <complexType name="JavaInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="NCName" use="required"/>
+ <attribute name="callbackInterface" type="NCName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-wsdl.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-wsdl.xsd
new file mode 100644
index 0000000000..c1fdfd8f3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-interface-wsdl.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.wsdl" type="sca:WSDLPortType" substitutionGroup="sca:interface"/>
+ <complexType name="WSDLPortType">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="anyURI" use="required"/>
+ <attribute name="callbackInterface" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-policy.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-policy.xsd
new file mode 100644
index 0000000000..c22ffd6618
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca-policy.xsd
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="intent" type="sca:Intent"/>
+ <complexType name="Intent">
+ <sequence>
+ <element name="description" type="string" minOccurs="0" maxOccurs="1" />
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="QName" use="required"/>
+ <attribute name="constrains" type="sca:listOfQNames" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="policySet" type="sca:PolicySet"/>
+ <complexType name="PolicySet">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="policySetReference" type="sca:PolicySetReference"/>
+ <element name="intentMap" type="sca:IntentMap"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="name" type="QName" use="required"/>
+ <attribute name="provides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="appliesTo" type="string" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="PolicySetReference">
+ <attribute name="name" type="QName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="IntentMap">
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element name="qualifier" type="sca:Qualifier"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="provides" type="QName" use="required"/>
+ <attribute name="default" type="string" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Qualifier">
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element name="intentMap" type="sca:IntentMap"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="name" type="string" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="allow" type="sca:Allow"/>
+ <complexType name="Allow">
+ <attribute name="roles" type="string" use="required"/>
+ </complexType>
+
+ <element name="permitAll" type="sca:PermitAll"/>
+ <complexType name="PermitAll"/>
+
+ <element name="denyAll" type="sca:DenyAll"/>
+ <complexType name="DenyAll"/>
+
+ <element name="runAs" type="sca:RunAs"/>
+ <complexType name="RunAs">
+ <attribute name="role" type="string" use="required"/>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca.xsd
new file mode 100644
index 0000000000..10f54275d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/sca.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <include schemaLocation="sca-interface-java.xsd"/>
+ <include schemaLocation="sca-interface-wsdl.xsd"/>
+
+ <include schemaLocation="sca-implementation-java.xsd"/>
+ <include schemaLocation="sca-implementation-composite.xsd"/>
+
+ <include schemaLocation="sca-binding-webservice.xsd"/>
+ <include schemaLocation="sca-binding-jms.xsd"/>
+ <include schemaLocation="sca-binding-sca.xsd"/>
+
+ <include schemaLocation="sca-definitions.xsd"/>
+ <include schemaLocation="sca-policy.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-atom.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-atom.xsd
new file mode 100644
index 0000000000..c93a1d72de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-atom.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.atom" type="t:AtomBinding"/>
+
+ <complexType name="AtomBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="title" type="string" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-dwr.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-dwr.xsd
new file mode 100644
index 0000000000..d0da5421ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-dwr.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.dwr" type="t:DWRBinding"/>
+
+ <complexType name="DWRBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-http.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-http.xsd
new file mode 100644
index 0000000000..ff48b97d7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-http.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.http" type="t:HTTPBinding"/>
+
+ <complexType name="HTTPBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-jsonrpc.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-jsonrpc.xsd
new file mode 100644
index 0000000000..7c79738898
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-jsonrpc.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.jsonrpc" type="t:JSONRPCBinding"/>
+
+ <complexType name="JSONRPCBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-notification.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-notification.xsd
new file mode 100644
index 0000000000..6d5468b2f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-notification.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.notification" type="t:NotificationBinding"/>
+
+ <complexType name="NotificationBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="ntm" type="anyURI" use="optional"/>
+ <attribute name="notificationType" type="anyURI" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rmi.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rmi.xsd
new file mode 100644
index 0000000000..2697a1ea98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rmi.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.rmi" type="t:RMIBinding"/>
+
+ <complexType name="RMIBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="host" type="anyURI" use="optional"/>
+ <attribute name="port" type="int" use="optional"/>
+ <attribute name="serviceName" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rss.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rss.xsd
new file mode 100644
index 0000000000..821f323d73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rss.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.rss" type="t:RSSBinding"/>
+
+ <complexType name="RSSBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="title" type="string" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-node.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-node.xsd
new file mode 100644
index 0000000000..1b5c8aece2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-node.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.node" type="t:NodeImplementation"/>
+
+ <complexType name="NodeImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="uri" type="string" use="required"/>
+ <attribute name="composite" type="QName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-notification.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-notification.xsd
new file mode 100644
index 0000000000..f8d437310e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-notification.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.notification" type="t:NotificationImplementation"/>
+
+ <complexType name="NotificationImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-osgi.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-osgi.xsd
new file mode 100644
index 0000000000..f8ece54a07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-osgi.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.osgi" type="t:OSGiImplementation"/>
+
+ <!-- TODO Declare the proper attributes and elements -->
+ <complexType name="OSGiImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##any" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-resource.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-resource.xsd
new file mode 100644
index 0000000000..dd596821ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-resource.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.resource" type="t:ResourceImplementation"/>
+
+ <complexType name="ResourceImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-script.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-script.xsd
new file mode 100644
index 0000000000..e1723d65f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-script.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.script" type="t:ScriptImplementation"/>
+
+ <complexType name="ScriptImplementation">
+ <complexContent mixed="true">
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="script" type="anyURI" use="optional"/>
+ <attribute name="language" type="NCName" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-widget.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-widget.xsd
new file mode 100644
index 0000000000..0c0998595f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-widget.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.widget" type="t:WidgetImplementation"/>
+
+ <complexType name="WidgetImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-xquery.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-xquery.xsd
new file mode 100644
index 0000000000..cdabb697aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca-implementation-xquery.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.xquery" type="t:XQueryImplementation"/>
+
+ <complexType name="XQueryImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca.xsd b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca.xsd
new file mode 100644
index 0000000000..da5e696e01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/core/xsd/tuscany-sca.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-all.xsd"/>
+
+ <include schemaLocation="tuscany-sca-binding-atom.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-dwr.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-http.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-jsonrpc.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-notification.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-rmi.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-rss.xsd"/>
+
+ <!--
+ <include schemaLocation="tuscany-sca-implementation-das.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-data.xsd"/>
+ -->
+ <include schemaLocation="tuscany-sca-implementation-node.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-notification.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-osgi.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-resource.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-script.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-widget.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-xquery.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/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-android/tools/eclipse34/plugins/ejava/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..fb238f04b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/META-INF/MANIFEST.MF
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA JEE Eclipse Plugin
+Bundle-SymbolicName: org.apache.tuscany.sca.plugin.ejava;singleton:=true
+Bundle-Version: 1.4.0
+Import-Package: org.apache.tuscany.sca.plugin.core.classpath,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
+ org.eclipse.debug.ui,
+ org.eclipse.debug.ui.sourcelookup,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.debug.ui.launchConfigurations,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.ui.wizards,
+ org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
+ org.eclipse.jface.resource,
+ org.eclipse.jface.viewers,
+ org.eclipse.jface.wizard,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.swt,
+ org.eclipse.swt.graphics,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui,
+ org.eclipse.ui.progress,
+ org.osgi.framework;version="1.3.0"
+Bundle-Vendor: Apache Software Foundation
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.ui.ide
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/NOTICE
new file mode 100644
index 0000000000..6dcfe88195
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/NOTICE
@@ -0,0 +1,12 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product also includes software under the SCA Collaboration license
+(see the LICENSE file contained in this distribution), with the following
+copyright:
+
+(c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/build.properties
new file mode 100644
index 0000000000..c402b2eb45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/build.properties
@@ -0,0 +1,23 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ xsd/,\
+ icons/,\
+ .,\
+ LICENSE,\
+ NOTICE,\
+ org/
+src.includes = xsd/,\
+ plugin.xml,\
+ .classpath,\
+ .project,\
+ LICENSE,\
+ META-INF/,\
+ NOTICE,\
+ build.properties,\
+ icons/,\
+ .settings/,\
+ org/,\
+ pom.xml
+jars.compile.order = .
+source.. = .
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/org/apache/tuscany/sca/plugin/ejava/classpath/EJavaClasspathContainer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/org/apache/tuscany/sca/plugin/ejava/classpath/EJavaClasspathContainer.java
new file mode 100644
index 0000000000..4051436888
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/org/apache/tuscany/sca/plugin/ejava/classpath/EJavaClasspathContainer.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.plugin.ejava.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainer;
+
+
+/**
+ * A classpath container for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EJavaClasspathContainer extends BaseClasspathContainer implements RuntimeClasspathContainer {
+
+ public EJavaClasspathContainer() {
+ super("org.apache.tuscany.sca.plugin.ejava",
+ "org.apache.tuscany.sca.plugin.ejava.runtime.library", "Tuscany SCA JEE Library",
+ "tuscany-sca", "tuscany-distribution-ejava", "1.4-SNAPSHOT",
+ "TUSCANY_HOME", "TUSCANY_SRC");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/org/apache/tuscany/sca/plugin/ejava/classpath/EJavaClasspathContainerInitializer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/org/apache/tuscany/sca/plugin/ejava/classpath/EJavaClasspathContainerInitializer.java
new file mode 100644
index 0000000000..9b7c199c79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/org/apache/tuscany/sca/plugin/ejava/classpath/EJavaClasspathContainerInitializer.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.plugin.ejava.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.ejava.classpath.EJavaClasspathContainer;
+
+
+/**
+ * A classpath container initializer for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EJavaClasspathContainerInitializer extends BaseClasspathContainerInitializer implements RuntimeClasspathContainerInitializer {
+
+ public EJavaClasspathContainerInitializer() {
+ super(new EJavaClasspathContainer());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/plugin.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/plugin.xml
new file mode 100644
index 0000000000..fef1afe0b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<plugin>
+
+ <extension
+ point="org.apache.tuscany.sca.plugin.core.runtimeClasspathContainerInitializer">
+ <runtimeClasspathContainerInitializer
+ id="org.apache.tuscany.sca.plugin.ejava.runtime.library"
+ class="org.apache.tuscany.sca.plugin.ejava.classpath.EJavaClasspathContainerInitializer"/>
+ </extension>
+
+</plugin>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/pom.xml
new file mode 100644
index 0000000000..752d20f7c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/ejava/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.plugin.ejava</artifactId>
+ <name>Apache Tuscany SCA JEE Eclipse Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jdt.debug</groupId>
+ <artifactId>ui</artifactId>
+ <version>3.2.100-v20070531-1800</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.swt.win32.win32</groupId>
+ <artifactId>x86</artifactId>
+ <version>3.3.0-v3346</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-ejava</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <type>zip</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-ejava</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <classifier>src</classifier>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>tmp</classifier>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </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>../core/src/main/assembly/jar.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <appendAssemblyId>false</appendAssemblyId>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repo1.eclipse</id>
+ <url>http://repo1.maven.org/eclipse/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/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-android/tools/eclipse34/plugins/manager/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..2a70682fae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/META-INF/MANIFEST.MF
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Domain Manager Eclipse Plugin
+Bundle-SymbolicName: org.apache.tuscany.sca.plugin.manager;singleton:=true
+Bundle-Version: 1.4.0
+Import-Package: org.apache.tuscany.sca.plugin.core.classpath,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
+ org.eclipse.debug.ui,
+ org.eclipse.debug.ui.sourcelookup,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.debug.ui.launchConfigurations,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.ui.wizards,
+ org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
+ org.eclipse.jface.resource,
+ org.eclipse.jface.viewers,
+ org.eclipse.jface.wizard,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.swt,
+ org.eclipse.swt.graphics,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui,
+ org.eclipse.ui.progress,
+ org.osgi.framework;version="1.3.0"
+Bundle-Vendor: Apache Software Foundation
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.ui.ide
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/NOTICE
new file mode 100644
index 0000000000..6dcfe88195
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/NOTICE
@@ -0,0 +1,12 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product also includes software under the SCA Collaboration license
+(see the LICENSE file contained in this distribution), with the following
+copyright:
+
+(c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/build.properties
new file mode 100644
index 0000000000..c402b2eb45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/build.properties
@@ -0,0 +1,23 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ xsd/,\
+ icons/,\
+ .,\
+ LICENSE,\
+ NOTICE,\
+ org/
+src.includes = xsd/,\
+ plugin.xml,\
+ .classpath,\
+ .project,\
+ LICENSE,\
+ META-INF/,\
+ NOTICE,\
+ build.properties,\
+ icons/,\
+ .settings/,\
+ org/,\
+ pom.xml
+jars.compile.order = .
+source.. = .
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/org/apache/tuscany/sca/plugin/manager/classpath/ManagerClasspathContainer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/org/apache/tuscany/sca/plugin/manager/classpath/ManagerClasspathContainer.java
new file mode 100644
index 0000000000..4ec1688b56
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/org/apache/tuscany/sca/plugin/manager/classpath/ManagerClasspathContainer.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.plugin.manager.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainer;
+
+
+/**
+ * A classpath container for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ManagerClasspathContainer extends BaseClasspathContainer implements RuntimeClasspathContainer {
+
+ public ManagerClasspathContainer() {
+ super("org.apache.tuscany.sca.plugin.manager",
+ "org.apache.tuscany.sca.plugin.manager.runtime.library", "Tuscany SCA Domain Manager Library",
+ "tuscany-sca", "tuscany-distribution-manager", "1.4-SNAPSHOT",
+ "TUSCANY_HOME", "TUSCANY_SRC");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/org/apache/tuscany/sca/plugin/manager/classpath/ManagerClasspathContainerInitializer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/org/apache/tuscany/sca/plugin/manager/classpath/ManagerClasspathContainerInitializer.java
new file mode 100644
index 0000000000..9c7df0f488
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/org/apache/tuscany/sca/plugin/manager/classpath/ManagerClasspathContainerInitializer.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.plugin.manager.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.manager.classpath.ManagerClasspathContainer;
+
+
+/**
+ * A classpath container initializer for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ManagerClasspathContainerInitializer extends BaseClasspathContainerInitializer implements RuntimeClasspathContainerInitializer {
+
+ public ManagerClasspathContainerInitializer() {
+ super(new ManagerClasspathContainer());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/plugin.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/plugin.xml
new file mode 100644
index 0000000000..2e09146dfd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<plugin>
+
+ <extension
+ point="org.apache.tuscany.sca.plugin.core.runtimeClasspathContainerInitializer">
+ <runtimeClasspathContainerInitializer
+ id="org.apache.tuscany.sca.plugin.manager.runtime.library"
+ class="org.apache.tuscany.sca.plugin.manager.classpath.ManagerClasspathContainerInitializer"/>
+ </extension>
+
+</plugin>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/pom.xml
new file mode 100644
index 0000000000..ae6b3516a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/manager/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.plugin.manager</artifactId>
+ <name>Apache Tuscany SCA Domain Manager Eclipse Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jdt.debug</groupId>
+ <artifactId>ui</artifactId>
+ <version>3.2.100-v20070531-1800</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.swt.win32.win32</groupId>
+ <artifactId>x86</artifactId>
+ <version>3.3.0-v3346</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-manager</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <type>zip</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-manager</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <classifier>src</classifier>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>tmp</classifier>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </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>../core/src/main/assembly/jar.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <appendAssemblyId>false</appendAssemblyId>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repo1.eclipse</id>
+ <url>http://repo1.maven.org/eclipse/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/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-android/tools/eclipse34/plugins/process/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..0acd32e51c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/META-INF/MANIFEST.MF
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Process Eclipse Plugin
+Bundle-SymbolicName: org.apache.tuscany.sca.plugin.process;singleton:=true
+Bundle-Version: 1.4.0
+Import-Package: org.apache.tuscany.sca.plugin.core.classpath,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
+ org.eclipse.debug.ui,
+ org.eclipse.debug.ui.sourcelookup,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.debug.ui.launchConfigurations,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.ui.wizards,
+ org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
+ org.eclipse.jface.resource,
+ org.eclipse.jface.viewers,
+ org.eclipse.jface.wizard,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.swt,
+ org.eclipse.swt.graphics,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui,
+ org.eclipse.ui.progress,
+ org.osgi.framework;version="1.3.0"
+Bundle-Vendor: Apache Software Foundation
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.ui.ide
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/NOTICE
new file mode 100644
index 0000000000..6dcfe88195
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/NOTICE
@@ -0,0 +1,12 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product also includes software under the SCA Collaboration license
+(see the LICENSE file contained in this distribution), with the following
+copyright:
+
+(c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/build.properties
new file mode 100644
index 0000000000..c402b2eb45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/build.properties
@@ -0,0 +1,23 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ xsd/,\
+ icons/,\
+ .,\
+ LICENSE,\
+ NOTICE,\
+ org/
+src.includes = xsd/,\
+ plugin.xml,\
+ .classpath,\
+ .project,\
+ LICENSE,\
+ META-INF/,\
+ NOTICE,\
+ build.properties,\
+ icons/,\
+ .settings/,\
+ org/,\
+ pom.xml
+jars.compile.order = .
+source.. = .
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/org/apache/tuscany/sca/plugin/process/classpath/ProcessClasspathContainer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/org/apache/tuscany/sca/plugin/process/classpath/ProcessClasspathContainer.java
new file mode 100644
index 0000000000..a342de7bde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/org/apache/tuscany/sca/plugin/process/classpath/ProcessClasspathContainer.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.plugin.process.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainer;
+
+
+/**
+ * A classpath container for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessClasspathContainer extends BaseClasspathContainer implements RuntimeClasspathContainer {
+
+ public ProcessClasspathContainer() {
+ super("org.apache.tuscany.sca.plugin.process",
+ "org.apache.tuscany.sca.plugin.process.runtime.library", "Tuscany SCA Process Library",
+ "tuscany-sca", "tuscany-distribution-process", "1.4-SNAPSHOT",
+ "TUSCANY_HOME", "TUSCANY_SRC");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/org/apache/tuscany/sca/plugin/process/classpath/ProcessClasspathContainerInitializer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/org/apache/tuscany/sca/plugin/process/classpath/ProcessClasspathContainerInitializer.java
new file mode 100644
index 0000000000..dab0eeaadc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/org/apache/tuscany/sca/plugin/process/classpath/ProcessClasspathContainerInitializer.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.plugin.process.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.process.classpath.ProcessClasspathContainer;
+
+
+/**
+ * A classpath container initializer for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessClasspathContainerInitializer extends BaseClasspathContainerInitializer implements RuntimeClasspathContainerInitializer {
+
+ public ProcessClasspathContainerInitializer() {
+ super(new ProcessClasspathContainer());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/plugin.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/plugin.xml
new file mode 100644
index 0000000000..3e5f87f634
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<plugin>
+
+ <extension
+ point="org.apache.tuscany.sca.plugin.core.runtimeClasspathContainerInitializer">
+ <runtimeClasspathContainerInitializer
+ id="org.apache.tuscany.sca.plugin.process.runtime.library"
+ class="org.apache.tuscany.sca.plugin.process.classpath.ProcessClasspathContainerInitializer"/>
+ </extension>
+
+</plugin>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/pom.xml
new file mode 100644
index 0000000000..5e7366c07b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/process/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.plugin.process</artifactId>
+ <name>Apache Tuscany SCA Process Eclipse Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jdt.debug</groupId>
+ <artifactId>ui</artifactId>
+ <version>3.2.100-v20070531-1800</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.swt.win32.win32</groupId>
+ <artifactId>x86</artifactId>
+ <version>3.3.0-v3346</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-process</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <type>zip</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-process</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <classifier>src</classifier>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>tmp</classifier>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </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>../core/src/main/assembly/jar.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <appendAssemblyId>false</appendAssemblyId>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repo1.eclipse</id>
+ <url>http://repo1.maven.org/eclipse/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/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-android/tools/eclipse34/plugins/web20/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..3c2816ec4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/META-INF/MANIFEST.MF
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Web 2.0 Eclipse Plugin
+Bundle-SymbolicName: org.apache.tuscany.sca.plugin.web20;singleton:=true
+Bundle-Version: 1.4.0
+Import-Package: org.apache.tuscany.sca.plugin.core.classpath,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
+ org.eclipse.debug.ui,
+ org.eclipse.debug.ui.sourcelookup,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.debug.ui.launchConfigurations,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.ui.wizards,
+ org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
+ org.eclipse.jface.resource,
+ org.eclipse.jface.viewers,
+ org.eclipse.jface.wizard,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.swt,
+ org.eclipse.swt.graphics,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui,
+ org.eclipse.ui.progress,
+ org.osgi.framework;version="1.3.0"
+Bundle-Vendor: Apache Software Foundation
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.ui.ide
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/NOTICE
new file mode 100644
index 0000000000..6dcfe88195
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/NOTICE
@@ -0,0 +1,12 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product also includes software under the SCA Collaboration license
+(see the LICENSE file contained in this distribution), with the following
+copyright:
+
+(c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/build.properties
new file mode 100644
index 0000000000..c402b2eb45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/build.properties
@@ -0,0 +1,23 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ xsd/,\
+ icons/,\
+ .,\
+ LICENSE,\
+ NOTICE,\
+ org/
+src.includes = xsd/,\
+ plugin.xml,\
+ .classpath,\
+ .project,\
+ LICENSE,\
+ META-INF/,\
+ NOTICE,\
+ build.properties,\
+ icons/,\
+ .settings/,\
+ org/,\
+ pom.xml
+jars.compile.order = .
+source.. = .
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/org/apache/tuscany/sca/plugin/web20/classpath/Web20ClasspathContainer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/org/apache/tuscany/sca/plugin/web20/classpath/Web20ClasspathContainer.java
new file mode 100644
index 0000000000..3ccaa053bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/org/apache/tuscany/sca/plugin/web20/classpath/Web20ClasspathContainer.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.plugin.web20.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainer;
+
+
+/**
+ * A classpath container for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Web20ClasspathContainer extends BaseClasspathContainer implements RuntimeClasspathContainer {
+
+ public Web20ClasspathContainer() {
+ super("org.apache.tuscany.sca.plugin.web20",
+ "org.apache.tuscany.sca.plugin.web20.runtime.library", "Tuscany SCA Web 2.0 Library",
+ "tuscany-sca", "tuscany-distribution-web20", "1.4-SNAPSHOT",
+ "TUSCANY_HOME", "TUSCANY_SRC");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/org/apache/tuscany/sca/plugin/web20/classpath/Web20ClasspathContainerInitializer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/org/apache/tuscany/sca/plugin/web20/classpath/Web20ClasspathContainerInitializer.java
new file mode 100644
index 0000000000..96026db08e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/org/apache/tuscany/sca/plugin/web20/classpath/Web20ClasspathContainerInitializer.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.plugin.web20.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.web20.classpath.Web20ClasspathContainer;
+
+
+/**
+ * A classpath container initializer for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Web20ClasspathContainerInitializer extends BaseClasspathContainerInitializer implements RuntimeClasspathContainerInitializer {
+
+ public Web20ClasspathContainerInitializer() {
+ super(new Web20ClasspathContainer());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/plugin.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/plugin.xml
new file mode 100644
index 0000000000..6bf9087474
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<plugin>
+
+ <extension
+ point="org.apache.tuscany.sca.plugin.core.runtimeClasspathContainerInitializer">
+ <runtimeClasspathContainerInitializer
+ id="org.apache.tuscany.sca.plugin.web20.runtime.library"
+ class="org.apache.tuscany.sca.plugin.web20.classpath.Web20ClasspathContainerInitializer"/>
+ </extension>
+
+</plugin>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/pom.xml
new file mode 100644
index 0000000000..7c450e753e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/web20/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.plugin.web20</artifactId>
+ <name>Apache Tuscany SCA Web 2.0 Eclipse Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jdt.debug</groupId>
+ <artifactId>ui</artifactId>
+ <version>3.2.100-v20070531-1800</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.swt.win32.win32</groupId>
+ <artifactId>x86</artifactId>
+ <version>3.3.0-v3346</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-web20</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <type>zip</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-web20</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <classifier>src</classifier>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>tmp</classifier>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </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>../core/src/main/assembly/jar.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <appendAssemblyId>false</appendAssemblyId>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repo1.eclipse</id>
+ <url>http://repo1.maven.org/eclipse/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/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-android/tools/eclipse34/plugins/webservice/META-INF/MANIFEST.MF b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..9d83fd9b6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/META-INF/MANIFEST.MF
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Web Service Eclipse Plugin
+Bundle-SymbolicName: org.apache.tuscany.sca.plugin.webservice;singleton:=true
+Bundle-Version: 1.4.0
+Import-Package: org.apache.tuscany.sca.plugin.core.classpath,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
+ org.eclipse.debug.ui,
+ org.eclipse.debug.ui.sourcelookup,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.debug.ui.launchConfigurations,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.ui.wizards,
+ org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
+ org.eclipse.jface.resource,
+ org.eclipse.jface.viewers,
+ org.eclipse.jface.wizard,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.swt,
+ org.eclipse.swt.graphics,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui,
+ org.eclipse.ui.progress,
+ org.osgi.framework;version="1.3.0"
+Bundle-Vendor: Apache Software Foundation
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.ui.ide
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/NOTICE
new file mode 100644
index 0000000000..6dcfe88195
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/NOTICE
@@ -0,0 +1,12 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product also includes software under the SCA Collaboration license
+(see the LICENSE file contained in this distribution), with the following
+copyright:
+
+(c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/build.properties b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/build.properties
new file mode 100644
index 0000000000..c402b2eb45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/build.properties
@@ -0,0 +1,23 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ xsd/,\
+ icons/,\
+ .,\
+ LICENSE,\
+ NOTICE,\
+ org/
+src.includes = xsd/,\
+ plugin.xml,\
+ .classpath,\
+ .project,\
+ LICENSE,\
+ META-INF/,\
+ NOTICE,\
+ build.properties,\
+ icons/,\
+ .settings/,\
+ org/,\
+ pom.xml
+jars.compile.order = .
+source.. = .
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/org/apache/tuscany/sca/plugin/webservice/classpath/WebServiceClasspathContainer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/org/apache/tuscany/sca/plugin/webservice/classpath/WebServiceClasspathContainer.java
new file mode 100644
index 0000000000..36ff7bb8df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/org/apache/tuscany/sca/plugin/webservice/classpath/WebServiceClasspathContainer.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.plugin.webservice.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainer;
+
+
+/**
+ * A classpath container for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WebServiceClasspathContainer extends BaseClasspathContainer implements RuntimeClasspathContainer {
+
+ public WebServiceClasspathContainer() {
+ super("org.apache.tuscany.sca.plugin.webservice",
+ "org.apache.tuscany.sca.plugin.webservice.runtime.library", "Tuscany SCA Web Service Library",
+ "tuscany-sca", "tuscany-distribution-webservice", "1.4-SNAPSHOT",
+ "TUSCANY_HOME", "TUSCANY_SRC");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/org/apache/tuscany/sca/plugin/webservice/classpath/WebServiceClasspathContainerInitializer.java b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/org/apache/tuscany/sca/plugin/webservice/classpath/WebServiceClasspathContainerInitializer.java
new file mode 100644
index 0000000000..6310209c3a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/org/apache/tuscany/sca/plugin/webservice/classpath/WebServiceClasspathContainerInitializer.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.plugin.webservice.classpath;
+
+import org.apache.tuscany.sca.plugin.core.classpath.BaseClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.core.classpath.RuntimeClasspathContainerInitializer;
+import org.apache.tuscany.sca.plugin.webservice.classpath.WebServiceClasspathContainer;
+
+
+/**
+ * A classpath container initializer for the core runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WebServiceClasspathContainerInitializer extends BaseClasspathContainerInitializer implements RuntimeClasspathContainerInitializer {
+
+ public WebServiceClasspathContainerInitializer() {
+ super(new WebServiceClasspathContainer());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/plugin.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/plugin.xml
new file mode 100644
index 0000000000..1fd46d3e75
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<plugin>
+
+ <extension
+ point="org.apache.tuscany.sca.plugin.core.runtimeClasspathContainerInitializer">
+ <runtimeClasspathContainerInitializer
+ id="org.apache.tuscany.sca.plugin.webservice.runtime.library"
+ class="org.apache.tuscany.sca.plugin.webservice.classpath.WebServiceClasspathContainerInitializer"/>
+ </extension>
+
+</plugin>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/pom.xml
new file mode 100644
index 0000000000..64fb36a15d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/plugins/webservice/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.plugin.webservice</artifactId>
+ <name>Apache Tuscany SCA Web Service Eclipse Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jdt.debug</groupId>
+ <artifactId>ui</artifactId>
+ <version>3.2.100-v20070531-1800</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.swt.win32.win32</groupId>
+ <artifactId>x86</artifactId>
+ <version>3.3.0-v3346</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-webservice</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <type>zip</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-webservice</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <classifier>src</classifier>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>tmp</classifier>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </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>../core/src/main/assembly/jar.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <appendAssemblyId>false</appendAssemblyId>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repo1.eclipse</id>
+ <url>http://repo1.maven.org/eclipse/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/pom.xml
new file mode 100644
index 0000000000..a8da59b478
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/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-sca-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <packaging>pom</packaging>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <name>Apache Tuscany SCA Eclipse Tools</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>features/core</module>
+ <module>features/ejava</module>
+ <module>features/manager</module>
+ <module>features/process</module>
+ <module>features/web20</module>
+ <module>features/webservice</module>
+ <module>plugins/core</module>
+ <module>plugins/ejava</module>
+ <module>plugins/manager</module>
+ <module>plugins/process</module>
+ <module>plugins/web20</module>
+ <module>plugins/webservice</module>
+ <module>site/updatesite</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/LICENSE b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/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-android/tools/eclipse34/site/updatesite/NOTICE b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/tools/eclipse34/site/updatesite/etc/generate-p2.sh b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/etc/generate-p2.sh
new file mode 100755
index 0000000000..ea2eb865f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/etc/generate-p2.sh
@@ -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.
+
+# After building the updatesite Zip, this script can be used to generate the
+# Eclipse Ganymede P2 metadata for the site.
+
+rm -rf target/p2-tmp
+mkdir target/p2-tmp
+cd target/p2-tmp
+unzip ../apache-tuscany-sca-1.4-SNAPSHOT-updatesite.zip
+
+eclipse -nosplash -application org.eclipse.equinox.p2.metadata.generator.EclipseGenerator -updateSite tuscany-sca-1.4-SNAPSHOT-updatesite/ -site file:tuscany-sca-1.4-SNAPSHOT-updatesite/site.xml -metadataRepository file:tuscany-sca-1.4-SNAPSHOT-updatesite/ -metadataRepositoryName "Apache Tuscany SCA Eclipse Update Site." -artifactRepository file:tuscany-sca-1.4-SNAPSHOT-updatesite/ -artifactRepositoryName "Eclipse Ganymede Artifacts" -noDefaultIUs -vmargs -Xmx256m
+
+zip ../apache-tuscany-sca-1.4-SNAPSHOT-updatesite.zip tuscany-sca-1.4-SNAPSHOT-updatesite/artifacts.xml tuscany-sca-1.4-SNAPSHOT-updatesite/content.xml
+
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/pom.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/pom.xml
new file mode 100644
index 0000000000..0ef2f84873
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/pom.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-eclipse-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.updatesite</artifactId>
+ <name>Apache Tuscany SCA Eclipse Update Site</name>
+
+ <properties>
+ <tuscany.version>${pom.version}</tuscany.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.feature.core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.ejava</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.feature.ejava</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.manager</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.feature.manager</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.process</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.feature.process</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.web20</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.feature.web20</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.plugin.webservice</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.feature.webservice</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ <exclude>target/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>updatesite-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/updatesite.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <finalName>apache-tuscany-sca-${pom.version}</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/site.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/site.xml
new file mode 100644
index 0000000000..1ea30f7f70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/site.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<site>
+ <description url="http://incubator.apache.org/tuscany">
+ Apache Tuscany SCA Eclipse Update Site.
+ </description>
+
+ <feature url="features/org.apache.tuscany.sca.feature.core-1.4-SNAPSHOT.jar"
+ id="org.apache.tuscany.sca.feature.core" version="1.4.0">
+ <category name="org.apache.tuscany.sca.core.features"/>
+ </feature>
+
+ <feature url="features/org.apache.tuscany.sca.feature.ejava-1.4-SNAPSHOT.jar"
+ id="org.apache.tuscany.sca.feature.ejava" version="1.4.0">
+ <category name="org.apache.tuscany.sca.optional.features"/>
+ </feature>
+
+ <feature url="features/org.apache.tuscany.sca.feature.manager-1.4-SNAPSHOT.jar"
+ id="org.apache.tuscany.sca.feature.manager" version="1.4.0">
+ <category name="org.apache.tuscany.sca.core.features"/>
+ </feature>
+
+ <feature url="features/org.apache.tuscany.sca.feature.process-1.4-SNAPSHOT.jar"
+ id="org.apache.tuscany.sca.feature.process" version="1.4.0">
+ <category name="org.apache.tuscany.sca.optional.features"/>
+ </feature>
+
+ <feature url="features/org.apache.tuscany.sca.feature.web20-1.4-SNAPSHOT.jar"
+ id="org.apache.tuscany.sca.feature.web20" version="1.4.0">
+ <category name="org.apache.tuscany.sca.optional.features"/>
+ </feature>
+
+ <feature url="features/org.apache.tuscany.sca.feature.webservice-1.4-SNAPSHOT.jar"
+ id="org.apache.tuscany.sca.feature.webservice" version="1.4.0">
+ <category name="org.apache.tuscany.sca.optional.features"/>
+ </feature>
+
+ <archive path="features/org.apache.tuscany.sca.feature.core_1.4.0.jar"
+ url="features/org.apache.tuscany.sca.feature.core-1.4-SNAPSHOT.jar"/>
+ <archive path="plugins/org.apache.tuscany.sca.plugin.core_1.4.0.jar"
+ url="plugins/org.apache.tuscany.sca.plugin.core-1.4-SNAPSHOT.jar"/>
+
+ <archive path="features/org.apache.tuscany.sca.feature.ejava_1.4.0.jar"
+ url="features/org.apache.tuscany.sca.feature.ejava-1.4-SNAPSHOT.jar"/>
+ <archive path="plugins/org.apache.tuscany.sca.plugin.ejava_1.4.0.jar"
+ url="plugins/org.apache.tuscany.sca.plugin.ejava-1.4-SNAPSHOT.jar"/>
+
+ <archive path="features/org.apache.tuscany.sca.feature.manager_1.4.0.jar"
+ url="features/org.apache.tuscany.sca.feature.manager-1.4-SNAPSHOT.jar"/>
+ <archive path="plugins/org.apache.tuscany.sca.plugin.manager_1.4.0.jar"
+ url="plugins/org.apache.tuscany.sca.plugin.manager-1.4-SNAPSHOT.jar"/>
+
+ <archive path="features/org.apache.tuscany.sca.feature.process_1.4.0.jar"
+ url="features/org.apache.tuscany.sca.feature.process-1.4-SNAPSHOT.jar"/>
+ <archive path="plugins/org.apache.tuscany.sca.plugin.process_1.4.0.jar"
+ url="plugins/org.apache.tuscany.sca.plugin.process-1.4-SNAPSHOT.jar"/>
+
+ <archive path="features/org.apache.tuscany.sca.feature.web20_1.4.0.jar"
+ url="features/org.apache.tuscany.sca.feature.web20-1.4-SNAPSHOT.jar"/>
+ <archive path="plugins/org.apache.tuscany.sca.plugin.web20_1.4.0.jar"
+ url="plugins/org.apache.tuscany.sca.plugin.web20-1.4-SNAPSHOT.jar"/>
+
+ <archive path="features/org.apache.tuscany.sca.feature.webservice_1.4.0.jar"
+ url="features/org.apache.tuscany.sca.feature.webservice-1.4-SNAPSHOT.jar"/>
+ <archive path="plugins/org.apache.tuscany.sca.plugin.webservice_1.4.0.jar"
+ url="plugins/org.apache.tuscany.sca.plugin.webservice-1.4-SNAPSHOT.jar"/>
+
+ <category-def name="org.apache.tuscany.sca.core.features"
+ label="Core Features"/>
+ <category-def name="org.apache.tuscany.sca.optional.features"
+ label="Optional Features"/>
+
+</site>
diff --git a/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/src/main/assembly/updatesite.xml b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/src/main/assembly/updatesite.xml
new file mode 100644
index 0000000000..c1225e320b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/eclipse34/site/updatesite/src/main/assembly/updatesite.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.
+-->
+<assembly>
+ <id>updatesite</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <outputDirectory>tuscany-sca-${tuscany.version}-updatesite</outputDirectory>
+ <includes>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ <include>site.xml</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}-updatesite/plugins</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:org.apache.tuscany.sca.plugin.*</include>
+ </includes>
+ <scope>runtime</scope>
+ </dependencySet>
+
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}-updatesite/features</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:org.apache.tuscany.sca.feature.*</include>
+ </includes>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
diff --git a/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/LICENSE b/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/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-android/tools/maven/maven-ant-generator/NOTICE b/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/tools/maven/maven-ant-generator/pom.xml b/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/pom.xml
new file mode 100644
index 0000000000..42b379cdba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/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-maven-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany SCA Ant Build Generator Maven Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-settings</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java b/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java
new file mode 100644
index 0000000000..d7b80bd67c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java
@@ -0,0 +1,534 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.tools.ant.generator.plugin;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.model.FileSet;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Settings;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * A Maven plugin that generates an Ant build.xml file for Tuscany SCA samples.
+ *
+ * Build dependencies and additional build steps like WSDL2Java for example are
+ * automatically determined from the pom.xml file describing the module's Maven build.
+ *
+ * @version $Rev$ $Date$
+ * @goal generate
+ * @phase generate-sources
+ * @requiresDependencyResolution test
+ * @description Generate Ant build script for an SCA project
+ */
+public class AntGeneratorMojo extends AbstractMojo {
+
+ /**
+ * The project to generate an Ant build for.
+ *
+ * @parameter expression="${project}"
+ * @required
+ */
+ private MavenProject project;
+
+ /**
+ * Used for resolving artifacts
+ *
+ * @component
+ */
+ private ArtifactResolver resolver;
+
+ /**
+ * Factory for creating artifact objects
+ *
+ * @component
+ */
+ private ArtifactFactory factory;
+
+ /**
+ * The local repository where the artifacts are located
+ *
+ * @parameter expression="${localRepository}"
+ * @required
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * The remote repositories where artifacts are located
+ *
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ */
+ private List remoteRepositories;
+
+ /**
+ * The current user system settings for use in Maven.
+ *
+ * @parameter expression="${settings}"
+ * @required
+ * @readonly
+ */
+ private Settings settings;
+
+ /**
+ * The main class name.
+ * @parameter
+ */
+ private String mainClass;
+
+ /**
+ * If set true then only the dependency file is created. The dependency
+ * file can then be included in a hand generated build.xml file
+ * @parameter
+ */
+ private Boolean buildDependencyFileOnly;
+
+ /**
+ * The build.xml file to generate.
+ * @parameter expression="${basedir}/build.xml"
+ */
+ private String buildFile;
+
+ /**
+ * The build-dependency.xml file to generate.
+ * @parameter expression="${basedir}/build-dependency.xml"
+ */
+ private String buildDependencyFile;
+
+ public void execute() throws MojoExecutionException {
+ if ((buildDependencyFileOnly != null) &&
+ (buildDependencyFileOnly == true)){
+ generateBuildDependencyFile();
+ } else {
+ generateBuildFile();
+ }
+ }
+
+ /**
+ * Generate Ant build dependency XML file
+ */
+ private void generateBuildDependencyFile() throws MojoExecutionException {
+
+ getLog().info("Generating " + buildDependencyFile);
+
+ // Open the target build-dependency.xml file
+ File targetFile = new File(buildDependencyFile);
+ PrintWriter pw;
+ try {
+ pw = new PrintWriter(new FileOutputStream(targetFile));
+ } catch (FileNotFoundException e) {
+ throw new MojoExecutionException(e.toString());
+ }
+
+ // Generate the Apache license header
+ generateLicenseHeader(pw);
+
+ // Generate Ant filesets representing the build dependencies
+ generateBuildDependencies(pw);
+
+ pw.close();
+ }
+
+ /**
+ * Generate Ant build XML file
+ */
+ private void generateBuildFile() throws MojoExecutionException {
+
+ getLog().info("Generating " + buildFile);
+
+ // Open the target build.xml file
+ File targetFile = new File(buildFile);
+ PrintWriter pw;
+ try {
+ pw = new PrintWriter(new FileOutputStream(targetFile));
+ } catch (FileNotFoundException e) {
+ throw new MojoExecutionException(e.toString());
+ }
+
+ // Determine the project packaging
+ String packaging = project.getPackaging().toLowerCase();
+
+ // Generate the Apache license header
+ generateLicenseHeader(pw);
+
+ pw.println("<project name=\"" + project.getArtifactId() + "\" default=\"compile\">");
+ pw.println();
+
+ // Generate the compile target
+ int base = project.getBasedir().toString().length() + 1;
+ pw.println(" <target name=\"compile\">");
+ pw.println(" <mkdir dir=\"target/classes\"/>");
+
+ // Generate any pre-compilation tasks
+ generatePreCompileTasks(pw);
+
+ // Generate the compile task
+ pw.println(" <javac destdir=\"target/classes\" debug=\"on\" source=\"1.5\" target=\"1.5\">");
+ for (String source: (List<String>)project.getCompileSourceRoots()) {
+ if (source.length() > base) {
+ source = source.substring(base);
+ } else {
+ source = ".";
+ }
+ pw.println(" <src path=\"" + source + "\"/>");
+ }
+ pw.println(" <classpath>");
+ pw.println(" <fileset refid=\"tuscany.jars\"/>");
+ pw.println(" <fileset refid=\"3rdparty.jars\"/>");
+ pw.println(" </classpath>");
+ pw.println(" </javac>");
+ pw.println(" <copy todir=\"target/classes\">");
+ for (FileSet resource: (List<FileSet>)project.getResources()) {
+ String source = resource.getDirectory();
+ if (source.length() > base) {
+ source = source.substring(base);
+
+ if (source.equals(".")){
+ pw.println(" <fileset dir=\".\" includes=\"*\" excludes=\"src, target, pom.xml, build.xml\"/>");
+ } else {
+ pw.println(" <fileset dir=\"" + source + "\"/>");
+ }
+ } else {
+ if (project.getResources().size() > 1) {
+ break;
+ }
+ pw.println(" <fileset dir=\".\" excludes=\"**/*.java, pom.xml, build.xml, target\"/>");
+ source = ".";
+ }
+ }
+ pw.println(" </copy>");
+
+ // Build a JAR
+ if (packaging.equals("jar")) {
+ pw.println(" <jar destfile=\"target/" + project.getArtifactId() + ".jar\" basedir=\"target/classes\">");
+ pw.println(" <manifest>");
+ if (mainClass != null) {
+ pw.println(" <attribute name=\"Main-Class\" value=\"" + mainClass + "\"/>");
+ }
+ pw.println(" </manifest>");
+ pw.println(" </jar>");
+
+ } else if (packaging.equals("war")) {
+
+ // Build a WAR
+ pw.println(" <war destfile=\"target/" + project.getArtifactId() + ".war\" webxml=\"src/main/webapp/WEB-INF/web.xml\">");
+ pw.println(" <fileset dir=\"src/main/webapp\"/>");
+ pw.println(" <lib refid=\"tuscany.jars\"/>");
+ pw.println(" <lib refid=\"3rdparty.jars\"/>");
+ pw.println(" <classes dir=\"target/classes\"/>");
+ pw.println(" </war>");
+ }
+ pw.println(" </target>");
+ pw.println();
+
+
+ // Generate a package target alongside the compile target
+ // Tuscany SCA samples use "package" as the target for webapps
+ pw.println(" <target name=\"package\" depends=\"compile\"/>");
+ pw.println();
+
+ // Generate the run target
+ if (mainClass != null) {
+ pw.println(" <target name=\"run\">");
+ pw.println(" <java classname=\"" + mainClass + "\" fork=\"true\">");
+ pw.println(" <classpath>");
+ pw.println(" <pathelement location=\"target/" + project.getArtifactId() + ".jar\"/>");
+ pw.println(" <fileset refid=\"tuscany.jars\"/>");
+ pw.println(" <fileset refid=\"3rdparty.jars\"/>");
+ pw.println(" </classpath>");
+ pw.println(" </java>");
+ pw.println(" </target>");
+ pw.println();
+ }
+
+ // Generate the clean target
+ pw.println(" <target name=\"clean\">");
+ pw.println(" <delete includeemptydirs=\"true\">");
+ pw.println(" <fileset dir=\"target\"/>");
+ pw.println(" </delete>");
+ pw.println(" </target>");
+ pw.println();
+
+ // Generate Ant filesets representing the build dependencies
+ generateBuildDependencies(pw);
+
+ pw.println("</project>");
+ pw.close();
+ }
+
+ /**
+ * Generate Ant filesets representing the build dependencies.
+ * @param pw PrintWriter to write to
+ */
+ private void generateBuildDependencies(PrintWriter pw) {
+
+ // Determine the module dependencies
+ List<String> tuscanyModules = new ArrayList<String>();
+ List<String> otherModules = new ArrayList<String>();
+ for (Artifact artifact: (List<Artifact>)project.getRuntimeArtifacts()) {
+ if (artifact.getGroupId().startsWith("org.apache.tuscany.sca")) {
+ tuscanyModules.add(artifact.getFile().getName());
+ } else {
+ otherModules.add(artifact.getFile().getName());
+ }
+ }
+
+ // Sort lists of modules, making output deterministic
+ Collections.sort(tuscanyModules);
+ Collections.sort(otherModules);
+
+ // Generate filesets for the tuscany and 3rd party dependencies
+ pw.println(" <fileset id=\"tuscany.jars\" dir=\"../../modules\">");
+ for (String name: tuscanyModules) {
+ pw.println(" <include name=\"" + name +"\"/>");
+ }
+ pw.println(" </fileset>");
+ pw.println(" <fileset id=\"3rdparty.jars\" dir=\"../../lib\">");
+ for (String name: otherModules) {
+ pw.println(" <include name=\"" + name +"\"/>");
+ }
+ pw.println(" </fileset>");
+ pw.println();
+ }
+
+ /**
+ * Extract plugin execution configurations out of the Maven model. This handles
+ * nested configurations with a base configuration and a collection of nested
+ * configuration elements, for example:
+ * <configuration>
+ * <schemaFiles>
+ * <configuration>
+ * <fileName>x.wsdl</fileName>
+ * </configuration>
+ * <configuration>
+ * <fileName>y.wsdl</fileName>
+ * </configuration>
+ * </schemaFiles>
+ * <noNotification>true</noNotification>
+ * </configuration>
+ *
+ * @param execution Maven plugin execution model
+ * @return a list of maps containing the plugin configuration key value pairs
+ */
+ private static List<Map<String, String>> pluginConfigurations(PluginExecution execution) {
+ List<Map<String, String>> configurations = new ArrayList<Map<String,String>>();
+ Map<String, String> topConfiguration = new HashMap<String, String>();
+
+ Xpp3Dom dom = (Xpp3Dom)execution.getConfiguration();
+ for (Xpp3Dom element: dom.getChildren()) {
+ if (element.getChildCount() != 0) {
+ // Handle nested configuration element, create a child configuration
+ // for each
+ for (Xpp3Dom childConfigurationElement: element.getChildren()) {
+ Map<String, String> childConfiguration = new HashMap<String, String>();
+ for (Xpp3Dom childElement: childConfigurationElement.getChildren()) {
+ childConfiguration.put(childElement.getName(), childElement.getValue());
+ }
+ configurations.add(childConfiguration);
+ }
+ } else {
+ // Handle top level key value pair element
+ topConfiguration.put(element.getName(), element.getValue());
+ }
+ }
+ // Return the top configuration or the child configurations merged
+ // with the top one
+ if (configurations.isEmpty()) {
+ configurations.add(topConfiguration);
+ } else {
+ for (Map<String, String> configuration: configurations) {
+ configuration.putAll(topConfiguration);
+ }
+ }
+ return configurations;
+ }
+
+ /**
+ * Generate Ant tasks for the pre-compilation generation plugins
+ * used in the Maven module.
+ * @param pw PrintWriter to write to
+ * @return list of directories containing generated source to compile
+ */
+ private void generatePreCompileTasks(PrintWriter pw) {
+ String baseDir = project.getBasedir().getAbsolutePath() + '/';
+
+ List<Plugin> plugins = (List<Plugin>)project.getBuildPlugins();
+ for (Plugin plugin: plugins) {
+
+ // Generate Ant task equivalent to the Tuscany SDO plugin
+ if ("org.apache.tuscany.sdo".equals(plugin.getGroupId()) && "tuscany-sdo-plugin".equals(plugin.getArtifactId())) {
+ for (PluginExecution execution: (List<PluginExecution>)plugin.getExecutions()) {
+ for (Map<String, String> configuration: pluginConfigurations(execution)) {
+
+ pw.println(" <java classname=\"org.apache.tuscany.sdo.generate.XSD2JavaGenerator\" fork=\"true\">");
+
+ // Generate the various code generation options
+ for (Map.Entry<String, String> element: configuration.entrySet()) {
+ String key = element.getKey();
+ String value = element.getValue();
+ if (key.equals("schemaNamespace")) {
+ pw.println(" <arg value=\"-schemaNamespace\"/>");
+ pw.println(" <arg value=\"" + value + "\"/>");
+ }
+ if (key.equals("javaPackage")) {
+ pw.println(" <arg value=\"-javaPackage\"/>");
+ pw.println(" <arg value=\"" + value + "\"/>");
+ }
+ if (key.equals("prefix")) {
+ pw.println(" <arg value=\"-prefix\"/>");
+ pw.println(" <arg value=\"" + value + "\"/>");
+ }
+ if (key.equals("noInterfaces") && "true".equals(value)) {
+ pw.println(" <arg value=\"-noInterfaces\"/>");
+ }
+ if (key.equals("noNotification") && "true".equals(value)) {
+ pw.println(" <arg value=\"-noNotification\"/>");
+ }
+ if (key.equals("noContainer") && "true".equals(value)) {
+ pw.println(" <arg value=\"-noContainment\"/>");
+ }
+ if (key.equals("noUnsettable") && "true".equals(value)) {
+ pw.println(" <arg value=\"-noUnsettable\"/>");
+ }
+ }
+
+ // Generate target directory parameter
+ String targetDirectory = configuration.get("targetDirectory");
+ if (targetDirectory == null) {
+ targetDirectory = "target/sdo-source";
+ } else if (targetDirectory.startsWith(baseDir)) {
+ targetDirectory = targetDirectory.substring(baseDir.length());
+ }
+ pw.println(" <arg value=\"-targetDirectory\"/>");
+ pw.println(" <arg value=\"" + targetDirectory + "\"/>");
+
+ // Generate schema file parameter
+ String schemaFile = configuration.get("schemaFile");
+ if (schemaFile == null) {
+ schemaFile = configuration.get("fileName");
+ }
+ if (schemaFile != null) {
+ if (schemaFile.startsWith(baseDir)) {
+ schemaFile = schemaFile.substring(baseDir.length());
+ }
+ pw.println(" <arg value=\"" + schemaFile + "\"/>");
+ }
+
+ pw.println(" <classpath>");
+ pw.println(" <fileset refid=\"tuscany.jars\"/>");
+ pw.println(" <fileset refid=\"3rdparty.jars\"/>");
+ pw.println(" </classpath>");
+ pw.println(" </java>");
+ }
+ }
+ }
+
+ // Generate Ant task equivalent to the Tuscany WSDL2Java plugin
+ else if ("org.apache.tuscany.sca".equals(plugin.getGroupId()) && "tuscany-maven-wsdl2java".equals(plugin.getArtifactId())) {
+ for (PluginExecution execution: (List<PluginExecution>)plugin.getExecutions()) {
+ for (Map<String, String> configuration: pluginConfigurations(execution)) {
+
+ pw.println(" <java classname=\"org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator\" fork=\"true\">");
+
+ // Generate the various code generation options
+ for (Map.Entry<String, String> element: configuration.entrySet()) {
+ String key = element.getKey();
+ String value = element.getValue();
+ if (key.equals("javaPackage")) {
+ pw.println(" <arg value=\"-javaPackage\"/>");
+ pw.println(" <arg value=\"" + value + "\"/>");
+ }
+ }
+
+ // Generate target directory parameter
+ String targetDirectory = configuration.get("targetDirectory");
+ if (targetDirectory == null) {
+ targetDirectory = "target/wsdl2java-source";
+ } else if (targetDirectory.startsWith(baseDir)) {
+ targetDirectory = targetDirectory.substring(baseDir.length());
+ }
+ pw.println(" <arg value=\"-targetDirectory\"/>");
+ pw.println(" <arg value=\"" + targetDirectory + "\"/>");
+
+ // Generate WSDL file parameter
+ String wsdlFile = configuration.get("wsdlFile");
+ if (wsdlFile == null) {
+ wsdlFile = configuration.get("fileName");
+ }
+ if (wsdlFile != null) {
+ if (wsdlFile.startsWith(baseDir)) {
+ wsdlFile = wsdlFile.substring(baseDir.length());
+ }
+ pw.println(" <arg value=\"" + wsdlFile + "\"/>");
+ }
+
+ pw.println(" <classpath>");
+ pw.println(" <fileset refid=\"tuscany.jars\"/>");
+ pw.println(" <fileset refid=\"3rdparty.jars\"/>");
+ pw.println(" </classpath>");
+ pw.println(" </java>");
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Generate license header.
+ *
+ * @param pw PrintWriter to write to
+ */
+ private void generateLicenseHeader(PrintWriter pw) {
+ pw.println("<!--");
+ pw.println(" * Licensed to the Apache Software Foundation (ASF) under one");
+ pw.println(" * or more contributor license agreements. See the NOTICE file");
+ pw.println(" * distributed with this work for additional information");
+ pw.println(" * regarding copyright ownership. The ASF licenses this file");
+ pw.println(" * to you under the Apache License, Version 2.0 (the");
+ pw.println(" * \"License\"); you may not use this file except in compliance");
+ pw.println(" * with the License. You may obtain a copy of the License at");
+ pw.println(" * ");
+ pw.println(" * http://www.apache.org/licenses/LICENSE-2.0");
+ pw.println(" * ");
+ pw.println(" * Unless required by applicable law or agreed to in writing,");
+ pw.println(" * software distributed under the License is distributed on an");
+ pw.println(" * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY");
+ pw.println(" * KIND, either express or implied. See the License for the");
+ pw.println(" * specific language governing permissions and limitations");
+ pw.println(" * under the License.");
+ pw.println("-->");
+ pw.println();
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/LICENSE b/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/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-android/tools/maven/maven-incremental-build/NOTICE b/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 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-android/tools/maven/maven-incremental-build/pom.xml b/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/pom.xml
new file mode 100644
index 0000000000..e73c99b29d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/pom.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-maven-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-maven-incremental-build</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany SCA Incremental Build Generator Maven Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-settings</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-invoker</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-api</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-manager</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-javac</artifactId>
+ <version>1.5.3</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>LATEST</version>
+ <configuration>
+ <goalPrefix>incremental</goalPrefix>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/src/main/java/org/apache/tuscany/sca/tools/incremental/build/plugin/IncrementalBuildMojo.java b/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/src/main/java/org/apache/tuscany/sca/tools/incremental/build/plugin/IncrementalBuildMojo.java
new file mode 100644
index 0000000000..3a6870732b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/maven/maven-incremental-build/src/main/java/org/apache/tuscany/sca/tools/incremental/build/plugin/IncrementalBuildMojo.java
@@ -0,0 +1,415 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.tools.incremental.build.plugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.shared.invoker.DefaultInvocationRequest;
+import org.apache.maven.shared.invoker.InvocationResult;
+import org.apache.maven.shared.invoker.Invoker;
+import org.apache.maven.shared.invoker.MavenInvocationException;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.cli.CommandLineException;
+
+/**
+ * @version $Rev$ $Date$
+ * @goal build
+ * @phase validate
+ * @requiresDependencyResolution test
+ * @description Incrementally build project modules that depend on modified modules.
+ */
+public class IncrementalBuildMojo extends AbstractMojo {
+
+ /**
+ * Keep track of modified projects.
+ */
+ private static Set<String> modifiedProjectIDs = new HashSet<String>();
+
+ /**
+ * The current user system settings for use in Maven.
+ *
+ * @parameter expression="${settings}"
+ * @required
+ * @readonly
+ */
+ private Settings settings;
+
+ /**
+ * Used to invoke Maven builds.
+ *
+ * @component
+ */
+ private Invoker invoker;
+
+ /**
+ * The target directory of the compiler if fork is true.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ * @readonly
+ */
+ private File buildDirectory;
+
+ /**
+ * The project to create a build for.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ private File outputFile;
+
+ public void execute() throws MojoExecutionException {
+ String projectID = id(project);
+ outputFile = getOutputFile();
+
+ File testMarkerFile = new File(project.getBasedir().getPath() + "/.test");
+
+ List<String> goals = new ArrayList<String>();
+ String type = project.getArtifact().getType();
+ if ("pom".equals(type)) {
+
+ // Always install pom modules
+ goals.add("install");
+
+ } else {
+
+ // Check if anything has changed in the project
+ boolean changed = false;
+ boolean testChanged = false;
+ boolean testFailed = false;
+ if (new File(project.getBasedir().getPath() + "/.modified").exists()) {
+ getLog().info("Found .modified marker file.");
+ changed = true;
+ } else {
+ changed = areSourcesStale() || areResourcesStale() || isPOMStale();
+ }
+ if (changed) {
+ modifiedProjectIDs.add(projectID);
+ } else {
+ testChanged = areTestSourcesStale() || areTestResourcesStale();
+ }
+
+ // Check if a project has compile dependencies on the modified projects
+ // and will need to be recompiled, or has runtime or test dependencies
+ // on the modified projects and needs to be retested
+ if (changed) {
+ goals.add("clean");
+ goals.add("install");
+ getLog().info("Project " + projectID + " has changed and will be recompiled.");
+
+ } else {
+ for (Artifact artifact : (List<Artifact>)project.getCompileArtifacts()) {
+ String artifactID = id(artifact);
+ if (modifiedProjectIDs.contains(artifactID)) {
+ getLog().info("Project " + projectID + " depends on modified project " + artifactID + " and will be recompiled.");
+ goals.add("clean");
+ goals.add("install");
+ break;
+ }
+ }
+
+ if (goals.isEmpty()) {
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ artifacts.addAll(project.getRuntimeArtifacts());
+ artifacts.addAll(project.getTestArtifacts());
+ for (Artifact artifact : artifacts) {
+ String artifactID = id(artifact);
+ if (modifiedProjectIDs.contains(artifactID)) {
+ getLog().info("Project " + projectID + " depends on modified project " + artifactID + " and will be retested.");
+ goals.add("test");
+ break;
+ }
+ }
+ }
+ }
+
+ if (testChanged && goals.isEmpty()) {
+ getLog().info("Project " + projectID + " has changed and will be retested.");
+ goals.add("test");
+ }
+
+ if (goals.isEmpty()) {
+ if (testMarkerFile.exists()) {
+ testFailed = true;
+ getLog().info("Project " + projectID + " contains failed tests and will be retested.");
+ goals.add("test");
+ }
+ }
+ }
+
+ // Invoke Maven with the necessary goals
+ if (!goals.isEmpty()) {
+ DefaultInvocationRequest request = new DefaultInvocationRequest();
+ request.setGoals(goals);
+ // FIXME: The maven invoker doesn't handle the directory names with spaces
+ // request.setLocalRepositoryDirectory(new File(localRepository.getBasedir()));
+ request.setInteractive(false);
+ request.setShowErrors(false);
+ request.setRecursive(false);
+ // request.setDebug(true);
+ request.setOffline(settings.isOffline());
+ request.setBaseDirectory(project.getBasedir());
+ request.setPomFile(project.getFile());
+
+ boolean success = false;
+ try {
+ try {
+ InvocationResult result = invoker.execute(request);
+
+ CommandLineException cle = result.getExecutionException();
+ if (cle != null) {
+ throw new MojoExecutionException(cle.getMessage(), cle);
+ }
+
+ int ec = result.getExitCode();
+ if (ec != 0) {
+ throw new MojoExecutionException("Maven invocation exit code: " + ec);
+ }
+
+ success = true;
+
+
+
+ } catch (MavenInvocationException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ } finally {
+
+ // Create or delete a .test marker file to keep track of the latest
+ // test result status and trigger testing again next time the build
+ // is run
+ if (!success) {
+ try {
+ if (!testMarkerFile.exists()) {
+ testMarkerFile.createNewFile();
+ }
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ } else {
+ if (testMarkerFile.exists()) {
+ testMarkerFile.delete();
+ }
+ }
+ }
+ } else {
+ getLog().info("The project is up-to-date. No build is required.");
+ }
+ }
+
+ private File getOutputFile() {
+ File basedir = buildDirectory;
+ String finalName = project.getBuild().getFinalName();
+ String classifier = project.getArtifact().getClassifier();
+ if (classifier == null) {
+ classifier = "";
+ } else if (classifier.trim().length() > 0 && !classifier.startsWith("-")) {
+ classifier = "-" + classifier;
+ }
+
+ String pkg = project.getPackaging();
+ if ("maven-plugin".equals(pkg)) {
+ pkg = "jar";
+ }
+ return new File(basedir, finalName + classifier + "." + pkg);
+ }
+
+ /**
+ * Test if any of the resources are stale
+ * @param resources
+ * @param outputDirectory
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areStale(List<Resource> resources, String outputDirectory) throws MojoExecutionException {
+
+ for (Resource resource: resources) {
+
+ File resourceDirectory = new File(resource.getDirectory());
+ if (!resourceDirectory.exists()) {
+ continue;
+ }
+
+ DirectoryScanner scanner = new DirectoryScanner();
+
+ scanner.setBasedir(resource.getDirectory());
+ if (resource.getIncludes() != null && !resource.getIncludes().isEmpty()) {
+ scanner.setIncludes((String[])resource.getIncludes().toArray(new String[]{}));
+ } else {
+ scanner.setIncludes(new String[]{"**/**"});
+ }
+ if (resource.getExcludes() != null && !resource.getExcludes().isEmpty()) {
+ scanner.setExcludes((String[])resource.getExcludes().toArray(new String[]{}));
+ }
+
+ scanner.addDefaultExcludes();
+ scanner.scan();
+
+ List<String> includedFiles = Arrays.asList(scanner.getIncludedFiles());
+ String targetPath = resource.getTargetPath();
+ for (String source: includedFiles) {
+ String target;
+ if (source.endsWith(".java")) {
+ target = source.substring(0, source.length() - 5) + ".class";
+ } else {
+ target = source;
+ }
+
+ String destination;
+ if (targetPath != null) {
+ destination = targetPath + "/" + target;
+ } else {
+ destination = target;
+ }
+
+ File sourceFile = new File(resource.getDirectory(), source);
+ File destinationFile = new File(outputDirectory, destination);
+
+ if (!destinationFile.exists()) {
+ getLog().info("Source file " + sourceFile + ".");
+ getLog().info("Target file " + destinationFile + " could not be found.");
+ return true;
+ } else {
+ if (sourceFile.lastModified() > destinationFile.lastModified()) {
+ getLog().info("Source file " + sourceFile + " has changed.");
+ getLog().info("Target file " + destinationFile + " is stale.");
+ return true;
+ } else if (sourceFile.lastModified() > outputFile.lastModified()) {
+ getLog().info("Source file " + sourceFile + " has changed.");
+ getLog().info("Target build output file " + outputFile + " is stale.");
+ return true;
+ } else if (outputFile.lastModified() == 0) {
+ getLog().info("Target build output file " + outputFile + " could not be found.");
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test if the POM resource is stale.
+ *
+ * @return
+ */
+ private boolean isPOMStale() {
+ File pom = project.getFile();
+ if (pom.lastModified() > outputFile.lastModified()) {
+ getLog().info("File " + pom + " has changed.");
+ getLog().info("Target build output file " + pom + " is stale.");
+ return true;
+ } else if (outputFile.lastModified() == 0) {
+ getLog().info("Target build output file " + outputFile + " could not be found.");
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Test if the project resources are stale.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areResourcesStale() throws MojoExecutionException {
+ return areStale(project.getResources(), project.getBuild().getOutputDirectory());
+ }
+
+ /**
+ * Test if the project sources are stale.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areSourcesStale() throws MojoExecutionException {
+ List<Resource> resources = new ArrayList<Resource>();
+ for (String root: (List<String>)project.getCompileSourceRoots()) {
+ if (new File(root).exists()) {
+ Resource resource = new Resource();
+ resource.setDirectory(root);
+ resource.addInclude("*.java");
+ resources.add(resource);
+ }
+ }
+ return areStale(resources, project.getBuild().getOutputDirectory());
+ }
+
+ /**
+ * Tests if the project test resources are stale.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areTestResourcesStale() throws MojoExecutionException {
+ return areStale(project.getTestResources(), project.getBuild().getTestOutputDirectory());
+ }
+
+ /**
+ * Tests if the project test sources are stale.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areTestSourcesStale() throws MojoExecutionException {
+ List<Resource> resources = new ArrayList<Resource>();
+ for (String root: (List<String>)project.getTestCompileSourceRoots()) {
+ if (new File(root).exists()) {
+ Resource resource = new Resource();
+ resource.setDirectory(root);
+ resources.add(resource);
+ }
+ }
+ return areStale(resources, project.getBuild().getTestOutputDirectory());
+ }
+
+ /**
+ * Returns the qualified id of a Maven artifact .
+ * @param p a Maven artifact
+ * @return a qualified id
+ */
+ private static String id(Artifact a) {
+ return a.getGroupId() + ':' + a.getArtifactId();
+ }
+
+ /**
+ * Returns the qualified id of a Maven project.
+ * @param p a Maven project
+ * @return a qualified id
+ */
+ private static String id(MavenProject p) {
+ return p.getGroupId() + ':' + p.getArtifactId();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/tools/maven/pom.xml b/sca-java-1.x/branches/sca-android/tools/maven/pom.xml
new file mode 100644
index 0000000000..0d0ee8b61b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/maven/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-tools</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <packaging>pom</packaging>
+ <artifactId>tuscany-sca-maven-tools</artifactId>
+ <name>Apache Tuscany SCA Maven Tools</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>maven-ant-generator</module>
+ <module>maven-incremental-build</module>
+ </modules>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <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-android/tools/pom.xml b/sca-java-1.x/branches/sca-android/tools/pom.xml
new file mode 100644
index 0000000000..0a6b907fc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tools/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-sca-tools</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tools</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <!--
+ <module>eclipse34</module>
+ -->
+ <module>maven</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/tutorials/pom.xml b/sca-java-1.x/branches/sca-android/tutorials/pom.xml
new file mode 100644
index 0000000000..3f2d6359a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/tutorials/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-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-tutorials</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tutorials</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/pom.xml b/sca-java-1.x/branches/sca-android/vtest/assembly/component/pom.xml
new file mode 100644
index 0000000000..cf38e7ab8e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>vtest-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-assembly-component</artifactId>
+
+ <name>Apache Tuscany SCA Assembly Verification Tests - Component</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.java
new file mode 100644
index 0000000000..592020c180
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/AService.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.vtest.assembly.component;
+
+/**
+ * Simple Remotable Service
+ */
+public interface AService {
+
+ public String getState();
+ public String getBProperty();
+ public String getB2Property();
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.java
new file mode 100644
index 0000000000..0d95c8e4b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/BService.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.vtest.assembly.component;
+
+/**
+ * Simple Service
+ */
+public interface BService {
+
+ public String getState();
+ public String getSomeProperty();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/CService.java b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/CService.java
new file mode 100644
index 0000000000..c979c57f31
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/CService.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.vtest.assembly.component;
+
+/**
+ *
+ */
+public interface CService {
+
+ public String getState();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.java
new file mode 100644
index 0000000000..8c0d08d052
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/AServiceImpl.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.vtest.assembly.component.impl;
+
+import org.apache.tuscany.sca.vtest.assembly.component.AService;
+import org.apache.tuscany.sca.vtest.assembly.component.BService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ protected BService b;
+
+ @Reference
+ protected BService b2;
+
+ public String getState() {
+ return b.getState();
+ }
+
+ public String getBProperty() {
+ return b.getSomeProperty();
+ }
+
+ public String getB2Property() {
+ return b2.getSomeProperty();
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.java
new file mode 100644
index 0000000000..424e245fea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/BServiceImpl.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.vtest.assembly.component.impl;
+
+import org.apache.tuscany.sca.vtest.assembly.component.BService;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ @Property
+ protected String someProperty;
+
+ public String getState() {
+ return "SomeStateFromB";
+ }
+
+ public String getSomeProperty() {
+ return someProperty;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/CServiceImpl.java
new file mode 100644
index 0000000000..b2b420ed6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/java/org/apache/tuscany/sca/vtest/assembly/component/impl/CServiceImpl.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.vtest.assembly.component.impl;
+
+public class CServiceImpl {
+
+ private String state = "Some State";
+
+ public String getState() {
+ return state;
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/component.composite b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/component.composite
new file mode 100644
index 0000000000..bb452feac9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/component.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://assembly-tests"
+ name="Assemby-component--Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.AServiceImpl"/>
+ <reference name="b" target="BComponent"/>
+ <reference name="b2" target="B2Component"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+ <property name="someProperty">some b component value</property>
+ </component>
+
+ <component name="B2Component">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+ <property name="someProperty">some b2 component value</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/nonuniquename.composite b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/nonuniquename.composite
new file mode 100644
index 0000000000..3019542091
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/nonuniquename.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://assembly-tests"
+ name="Assemby-non-unique-name--Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.AServiceImpl"/>
+ </component>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/serviceelement.composite b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/serviceelement.composite
new file mode 100644
index 0000000000..9460f5a2e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/serviceelement.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://assembly-tests"
+ name="Assemby-component--Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.AServiceImpl"/>
+ <reference name="b" target="BComponent"/>
+ <reference name="b2" target="B2Component"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+ <property name="someProperty">some b component value</property>
+ <service name="BService"/>
+ </component>
+
+ <component name="B2Component">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+ <property name="someProperty">some b2 component value</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/servicewithbinding.composite b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/servicewithbinding.composite
new file mode 100644
index 0000000000..085d84f40e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/servicewithbinding.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://assembly-tests"
+ name="Assemby-component-servicewithbinding-Composite">
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.CServiceImpl"/>
+ <service name="CServiceImpl">
+ <interface.java interface="org.apache.tuscany.sca.vtest.assembly.component.CService"/>
+ <binding.sca/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/servicewithinterface.composite b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/servicewithinterface.composite
new file mode 100644
index 0000000000..cc915fbde5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/servicewithinterface.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"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://assembly-tests"
+ name="Assemby-component-servicewithinterface-Composite">
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.CServiceImpl"/>
+ <service name="CServiceImpl">
+ <interface.java interface="org.apache.tuscany.sca.vtest.assembly.component.CService"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/zerocomponents.composite b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/zerocomponents.composite
new file mode 100644
index 0000000000..6f02d7e941
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/zerocomponents.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://assembly-tests"
+ name="Assemby-zero-components-Composite">
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/zeroimplelements.composite b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/zeroimplelements.composite
new file mode 100644
index 0000000000..8629f3817a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/main/resources/zeroimplelements.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"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://assembly-tests"
+ name="Assemby-component-zeroimplelements-Composite">
+
+ <component name="AComponent">
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+ <property name="someProperty">some b component value</property>
+ </component>
+
+ <component name="B2Component">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.component.impl.BServiceImpl"/>
+ <property name="someProperty">some b2 component value</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.java
new file mode 100644
index 0000000000..de4fbe39ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/component/src/test/java/org/apache/tuscany/sca/vtest/assembly/component/ComponentTestCase.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.vtest.assembly.component;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ *
+ */
+public class ComponentTestCase {
+
+ private void initDomain(String compositePath) {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositePath);
+ }
+
+ private void cleanupDomain() {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Lines 92-96:
+ * <p>
+ * Components are configured instances of implementations. Components
+ * provide and consume services. More than one component can use and
+ * configure the same implementation, where each component configures the
+ * implementation differently.
+ */
+ @Test
+ public void components1() throws Exception {
+ initDomain("component.composite");
+ AService service = ServiceFinder.getService(AService.class, "AComponent/AService");
+ Assert.assertEquals("some b component value", service.getBProperty());
+ Assert.assertEquals("some b2 component value", service.getB2Property());
+ cleanupDomain();
+ }
+
+ /**
+ * Lines 96-97:
+ * <p>
+ * There can be zero or more component elements within a composite.
+ */
+ @Test
+ public void components2() throws Exception {
+ initDomain("zerocomponents.composite");
+ cleanupDomain();
+ }
+
+ /**
+ * Lines 142-143:
+ * <p>
+ * name (required) – the name of the component. The name must be unique
+ * across all the components in the composite.
+ */
+ @Test(expected = ServiceRuntimeException.class)
+ //@Ignore("TUSCANY-2455")
+ public void components3() throws Exception {
+ initDomain("nonuniquename.composite");
+ cleanupDomain();
+ }
+
+ /**
+ * Lines 154-158:
+ * <p>
+ * A component element has zero or one implementation element as its child,
+ * which points to the implementation used by the component. A component
+ * with no implementation element is not runnable, but components of this
+ * kind may be useful during a "top-down" development process as a means of
+ * defining the characteristics required of the implementation before the
+ * implementation is written.
+ */
+ @Test
+ public void components4() throws Exception {
+ initDomain("zeroimplelements.composite");
+ cleanupDomain();
+ }
+
+ /**
+ * Lines 159-160:
+ * <p>
+ * The component element can have zero or more service elements as children
+ * which are used to configure the services of the component.
+ */
+ @Test
+ public void components5() throws Exception {
+ initDomain("serviceelement.composite");
+ cleanupDomain();
+ }
+
+ /**
+ * Lines 174-179:
+ * <p>
+ * A service has zero or one interface, which describes the operations
+ * provided by the service. The interface is described by an interface
+ * element which is a child element of the service element. If no interface
+ * is specified, then the interface specified for the service by the
+ * implementation is in effect. If an interface is specified it must provide
+ * a compatible subset of the interface provided by the implementation, i.e.
+ * provide a subset of the operations defined by the implementation for the
+ * service.
+ */
+ @Test
+ public void components6() throws Exception {
+ initDomain("servicewithinterface.composite");
+ CService service = ServiceFinder.getService(CService.class, "CComponent");
+ Assert.assertEquals("Some State", service.getState());
+ cleanupDomain();
+ }
+
+ /**
+ * Lines 180-182:
+ * <p>
+ * A service element has one or more binding elements as children. If no
+ * bindings are specified, then the bindings specified for the service by
+ * the implementation are in effect. If bindings are specified, then those
+ * bindings override the bindings specified by the implementation.
+ */
+ @Test
+ public void components7() throws Exception {
+ initDomain("servicewithbinding.composite");
+ CService service = ServiceFinder.getService(CService.class, "CComponent");
+ Assert.assertEquals("Some State", service.getState());
+ cleanupDomain();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/pom.xml b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/pom.xml
new file mode 100644
index 0000000000..f1e2b3ba80
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>vtest-assembly</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-assembly-ctypefile</artifactId>
+
+ <name>Apache Tuscany SCA Assembly Verification Tests - Component Type File</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/AService.java b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/AService.java
new file mode 100644
index 0000000000..d1df390ace
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/AService.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.vtest.assembly.ctypefile;
+
+/**
+ * Simple Remotable Service
+ */
+public interface AService {
+
+ public String getState();
+ public String getState2();
+ public String getBProperty();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/BService.java b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/BService.java
new file mode 100644
index 0000000000..8ee18b242f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/BService.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.vtest.assembly.ctypefile;
+
+/**
+ * Simple Service
+ */
+public interface BService {
+
+ public String getState();
+ public String getSomeProperty();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/AServiceImpl.java
new file mode 100644
index 0000000000..0f24201970
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/AServiceImpl.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.vtest.assembly.ctypefile.impl;
+
+import org.apache.tuscany.sca.vtest.assembly.ctypefile.AService;
+import org.apache.tuscany.sca.vtest.assembly.ctypefile.BService;
+import org.osoa.sca.annotations.Reference;
+
+public class AServiceImpl implements AService {
+
+ private BService bService;
+ private BService b2Service;
+
+ public void setBService(BService b) {
+ this.bService = b;
+ }
+
+ @Reference
+ public void setB2Service(BService b) {
+ this.b2Service = b;
+ }
+
+ public String getState() {
+ return bService.getState();
+ }
+
+ public String getState2() {
+ return b2Service.getState();
+ }
+
+ public String getBProperty() {
+ return bService.getSomeProperty();
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/BServiceImpl.java
new file mode 100644
index 0000000000..fd32cb1f9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/BServiceImpl.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.vtest.assembly.ctypefile.impl;
+
+import org.apache.tuscany.sca.vtest.assembly.ctypefile.BService;
+
+public class BServiceImpl implements BService {
+
+ //@Property
+ protected String someProperty;
+
+ public String getState() {
+ return "SomeStateFromB";
+ }
+
+ public String getSomeProperty() {
+ return someProperty;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/AServiceImpl.componentType b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/AServiceImpl.componentType
new file mode 100644
index 0000000000..173203ae21
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/AServiceImpl.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">
+
+ <service name="AService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.assembly.ctypefile.AService"/>
+ </service>
+
+ <reference name="bService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.assembly.ctypefile.BService"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/BServiceImpl.componentType b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/BServiceImpl.componentType
new file mode 100644
index 0000000000..c6a0f274c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/org/apache/tuscany/sca/vtest/assembly/ctypefile/impl/BServiceImpl.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.assembly.ctypefile.BService"/>
+ </service>
+
+ <property name="someProperty" type="xsd:string">componentTypeValue</property>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/typefile.composite b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/typefile.composite
new file mode 100644
index 0000000000..889bb846ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/main/resources/typefile.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://assembly-tests"
+ name="Assemby-component-typefile-Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.ctypefile.impl.AServiceImpl"/>
+ <reference name="bService" target="BComponent/BService"/>
+ <reference name="b2Service" target="BComponent/BService"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.ctypefile.impl.BServiceImpl"/>
+ <property name="someProperty">compositeValue</property>
+ </component>
+
+ <!-- component name="BComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.assembly.ctypefile.impl.BServiceImpl"/>
+ </component-->
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/test/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/CompomnentTypeFileTestCase.java b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/test/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/CompomnentTypeFileTestCase.java
new file mode 100644
index 0000000000..f8f7e45f61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/ctypefile/src/test/java/org/apache/tuscany/sca/vtest/assembly/ctypefile/CompomnentTypeFileTestCase.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.vtest.assembly.ctypefile;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class CompomnentTypeFileTestCase {
+
+ protected static String compositeName = "typefile.composite";
+ protected static AService aService = null;
+ protected static BService bService2 = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent/AService");
+ bService2 = ServiceFinder.getService(BService.class, "BComponent2/BService");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Lines 435-439:
+ * <p>
+ * Step two covers the cases where introspection of the implementation is
+ * not possible or where it does not provide complete information and it
+ * involves looking for an SCA component type file. Component type
+ * information found in the component type file must be compatible with the
+ * equivalent information found from inspection of the implementation.
+ * <p>
+ * Lines 441-444:
+ * <p>
+ * In the ideal case, the component type information is determined by
+ * inspecting the implementation, for example as code annotations. The
+ * component type file provides a mechanism for the provision of component
+ * type information for implementation types where the information cannot be
+ * determined by inspecting the implementation.
+ */
+ @Test
+ public void typeFile1() throws Exception {
+ Assert.assertSame("SomeStateFromB", aService.getState());
+ }
+
+ /**
+ * Lines 439-449:
+ * <p>
+ * The component type file can specify partial information, with the
+ * remainder being derived from the implementation.
+ * <p>
+ * The first test makes use of the reference to b which is provided by the
+ * type file. The second test makes use of the reference to b2 which is
+ * provided via annotation
+ */
+ @Test
+ public void typeFile2() throws Exception {
+ Assert.assertSame("SomeStateFromB", aService.getState());
+ Assert.assertSame("SomeStateFromB", aService.getState2());
+ }
+
+ /**
+ * Lines 450-451:
+ * <p>
+ * The componentType element can contain Service elements, Reference
+ * elements and Property elements.
+ */
+ @Test
+ public void typeFile3() throws Exception {
+ Assert.assertEquals("compositeValue", aService.getBProperty());
+ }
+
+ public void typeFile31() throws Exception {
+ Assert.assertEquals("componentTypeValue", bService2.getSomeProperty());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/assembly/pom.xml b/sca-java-1.x/branches/sca-android/vtest/assembly/pom.xml
new file mode 100644
index 0000000000..9a907402bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/assembly/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-vtest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-assembly</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Assembly Verification Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>vtest-utilities</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>ctypefile</module>
+ <module>component</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/pom.xml
new file mode 100644
index 0000000000..2b612731fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-conversation</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @Conversation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/AService.java
new file mode 100644
index 0000000000..bc7212f70c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/AService.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.vtest.javaapi.annotations.conversational;
+
+/**
+ * Simple Remotable Service
+ */
+public interface AService {
+
+ public String setThenGetB1State(String someState);
+
+ public String setThenGetB2State(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/B1Service.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/B1Service.java
new file mode 100644
index 0000000000..76c857126a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/B1Service.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.vtest.javaapi.annotations.conversational;
+
+/**
+ * Simple Local Service
+ */
+public interface B1Service {
+
+ public void setState(String someState);
+ public String getState();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/B2Service.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/B2Service.java
new file mode 100644
index 0000000000..b67d89d3e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/B2Service.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.vtest.javaapi.annotations.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Local Service
+ */
+@Conversational
+public interface B2Service {
+
+ public void setState(String someState);
+ public String getState();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/AServiceImpl.java
new file mode 100644
index 0000000000..55d87c9546
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/AServiceImpl.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.vtest.javaapi.annotations.conversational.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversational.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversational.B1Service;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversational.B2Service;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ protected B1Service b1;
+
+ @Reference
+ protected B2Service b2;
+
+ public String setThenGetB1State(String someState) {
+ b1.setState(someState);
+ return b1.getState();
+ }
+
+ public String setThenGetB2State(String someState) {
+ b2.setState(someState);
+ return b2.getState();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/B1ServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/B1ServiceImpl.java
new file mode 100644
index 0000000000..457b18e60a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/B1ServiceImpl.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.vtest.javaapi.annotations.conversational.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversational.B1Service;
+import org.osoa.sca.annotations.Service;
+
+@Service(B1Service.class)
+public class B1ServiceImpl implements B1Service {
+
+ String someState;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/B2ServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/B2ServiceImpl.java
new file mode 100644
index 0000000000..d6252f0a0c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/impl/B2ServiceImpl.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.vtest.javaapi.annotations.conversational.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversational.B2Service;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(B2Service.class)
+@Scope("COMPOSITE")
+public class B2ServiceImpl implements B2Service {
+
+ String someState;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/resources/conversation.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/resources/conversation.composite
new file mode 100644
index 0000000000..4c2de35d52
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/main/resources/conversation.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Converstion-Composite">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversational.impl.AServiceImpl" />
+ <reference name="b1" target="B1Component" />
+ <reference name="b2" target="B2Component" />
+ </component>
+
+ <component name="B1Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversational.impl.B1ServiceImpl" />
+ </component>
+
+ <component name="B2Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversational.impl.B2ServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/ConversationAnnotationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/ConversationAnnotationTestCase.java
new file mode 100644
index 0000000000..c00d5f1c10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversational/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversational/ConversationAnnotationTestCase.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.vtest.javaapi.annotations.conversational;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * This test class tests the Service annotation described in section 1.2.1 and
+ * 1.8.17
+ */
+public class ConversationAnnotationTestCase {
+
+ protected static String compositeName = "conversation.composite";
+ protected static AService aService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Line 328:<br>
+ * <p>
+ * When "@Conversational" is not specified on a service interface, the
+ * service contract is stateless.<br>
+ * <p>
+ * Line 394, 395: <br>
+ * A service may be declared as conversational by marking its Java interface
+ * with "@Conversational". If a service interface is not marked with
+ * "@Conversational", it is stateless. <br>
+ * <p>
+ * BService has no "@Conversation" annotation so communication from A-> is
+ * stateless
+ */
+ @Test
+ public void atConversation1() throws Exception {
+ String thisState = "This State";
+ Assert.assertNotSame(thisState, aService.setThenGetB1State(thisState));
+ }
+
+ /**
+ * Line 325-327:<br>
+ * <p>
+ * Java service interfaces may be annotated to specify whether their
+ * contract is conversational as described in the Assembly Specification
+ * by using the "@Conversational" annotation. A conversational service
+ * indicates that requests to the service are correlated in some way
+ */
+ @Test
+ public void atConversation2() throws Exception {
+ String thisState = "This State";
+ Assert.assertSame(thisState, aService.setThenGetB2State(thisState));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/pom.xml
new file mode 100644
index 0000000000..9531468e8f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-conversationattributes</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @ConversationAttributes</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/AService.java
new file mode 100644
index 0000000000..a3f1f11826
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/AService.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.vtest.javaapi.annotations.conversationattributes;
+
+/**
+ * Simple Service
+ */
+public interface AService {
+
+ public void testMaxAge() throws InterruptedException;
+ public void testMaxIdle() throws InterruptedException;
+ public void testSinglePrincipal();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/B2Service.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/B2Service.java
new file mode 100644
index 0000000000..8a1ed23b9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/B2Service.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.vtest.javaapi.annotations.conversationattributes;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service
+ */
+@Conversational
+public interface B2Service {
+
+ public void setState(String someState);
+ public String getState();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/BService.java
new file mode 100644
index 0000000000..1d215100f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/BService.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.vtest.javaapi.annotations.conversationattributes;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service
+ */
+@Conversational
+public interface BService {
+
+ public void setState(String someState);
+ public String getState();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/CService.java
new file mode 100644
index 0000000000..cd4f29ea5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/CService.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.vtest.javaapi.annotations.conversationattributes;
+
+import org.osoa.sca.ServiceReference;
+
+/**
+ * Simple Service
+ */
+public interface CService {
+
+ public void testSinglePricipal(ServiceReference<BService> bReference);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/AServiceImpl.java
new file mode 100644
index 0000000000..64b99c9f98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/AServiceImpl.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.vtest.javaapi.annotations.conversationattributes.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.B2Service;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.CService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ protected BService b;
+
+ @Reference
+ protected B2Service b2;
+
+ @Reference
+ protected CService c;
+
+ @Context
+ protected ComponentContext context;
+
+ private void delayForSeconds(int numSeconds) {
+ try {
+ Thread.sleep(numSeconds * 1000);// millisecs
+ } catch (InterruptedException ex) {
+ throw new Error(ex);
+ }
+ }
+
+ public void testMaxAge() {
+
+ String someState = "someState";
+ b.setState(someState);
+ delayForSeconds(2);
+ b.setState(someState);
+
+ }
+
+ public void testMaxIdle() {
+
+ String someState = "someState";
+ b2.setState(someState);
+ delayForSeconds(2);
+ b2.setState(someState);
+
+ }
+
+ public void testSinglePrincipal() {
+
+ b.setState("Some state");
+ System.out.println("Calling c and passing reference to b");
+ c.testSinglePricipal(context.getServiceReference(BService.class, "b"));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/B2ServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/B2ServiceImpl.java
new file mode 100644
index 0000000000..0d34b802e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/B2ServiceImpl.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.vtest.javaapi.annotations.conversationattributes.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.BService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class B2ServiceImpl implements BService {
+
+ String someState;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/BServiceImpl.java
new file mode 100644
index 0000000000..762c9533d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/BServiceImpl.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.vtest.javaapi.annotations.conversationattributes.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.BService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="1 seconds", singlePrincipal=true)
+public class BServiceImpl implements BService {
+
+ String someState;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/CServiceImpl.java
new file mode 100644
index 0000000000..3ebf63ba54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/impl/CServiceImpl.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.vtest.javaapi.annotations.conversationattributes.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.CService;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl implements CService {
+
+ public void testSinglePricipal(ServiceReference<BService> bReference) {
+
+ System.out.println("In C calling set state on passed reference to B");
+ bReference.getService().setState("someState");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java
new file mode 100644
index 0000000000..3820240ee2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.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.vtest.javaapi.annotations.conversationattributes.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ACallbackHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ if (callbacks[i] instanceof NameCallback) {
+ NameCallback nc = (NameCallback)callbacks[i];
+ nc.setName("AUser");
+ } else if (callbacks[i] instanceof PasswordCallback) {
+ PasswordCallback pc = (PasswordCallback)callbacks[i];
+ pc.setPassword("AUserPasswd".toCharArray());
+ } else {
+ throw new UnsupportedCallbackException
+ (callbacks[i], "Unsupported Callback!");
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java
new file mode 100644
index 0000000000..75573b838d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.security;
+
+import java.security.Principal;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JaasLoginModule implements LoginModule {
+
+ private CallbackHandler callbackHandler;
+ private Subject subject;
+ private Principal userPrincipal;
+ private String userId;
+ private String password;
+ private boolean succeeded;
+ private boolean commitSucceeded;
+
+ public void initialize(Subject subject,
+ CallbackHandler callbackHandler,
+ Map<String, ?> sharedState,
+ Map<String, ?> options) {
+ this.callbackHandler = callbackHandler;
+ this.subject = subject;
+ }
+
+ public boolean login() throws LoginException {
+ Callback[] callbacks = new Callback[2];
+ callbacks[0] = new NameCallback("UserId:");
+ callbacks[1] = new PasswordCallback("Password:", false);
+
+ try {
+ callbackHandler.handle(callbacks);
+ userId = ((NameCallback)callbacks[0]).getName();
+ password = new String(((PasswordCallback)callbacks[1]).getPassword());
+
+ if (userId.equals("CalculatorUser") && password.equals("CalculatorUserPasswd")) {
+ System.out.println("Successfully AUTHENTICATED!!");
+ succeeded = true;
+ return true;
+ } else {
+ System.out.println("Incorrect userId / password! AUTHENTICATION FAILED!!");
+ return false;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ /**
+ * <p> This method is called if the LoginContext's
+ * overall authentication succeeded
+ * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
+ * succeeded).
+ *
+ * <p> If this LoginModule's own authentication attempt
+ * succeeded (checked by retrieving the private state saved by the
+ * <code>login</code> method), then this method associates a
+ * <code>UserPrincipal</code>
+ * with the <code>Subject</code> located in the
+ * <code>LoginModule</code>. If this LoginModule's own
+ * authentication attempted failed, then this method removes
+ * any state that was originally saved.
+ *
+ * <p>
+ *
+ * @exception LoginException if the commit fails.
+ *
+ * @return true if this LoginModule's own login and commit
+ * attempts succeeded, or false otherwise.
+ */
+ public boolean commit() throws LoginException {
+ if (succeeded == false) {
+ return false;
+ } else {
+ // add a Principal (authenticated identity) to the Subject
+
+ // assume the user we authenticated is the UserPrincipal
+ userPrincipal = new UserPrincipal(userId);
+ if (!subject.getPrincipals().contains(userPrincipal))
+ subject.getPrincipals().add(userPrincipal);
+
+ // in any case, clean out state
+ userId = null;
+ password = null;
+ commitSucceeded = true;
+ return true;
+ }
+ }
+
+ /**
+ * <p> This method is called if the LoginContext's
+ * overall authentication failed.
+ * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
+ * did not succeed).
+ *
+ * <p> If this LoginModule's own authentication attempt
+ * succeeded (checked by retrieving the private state saved by the
+ * <code>login</code> and <code>commit</code> methods),
+ * then this method cleans up any state that was originally saved.
+ *
+ * <p>
+ *
+ * @exception LoginException if the abort fails.
+ *
+ * @return false if this LoginModule's own login and/or commit attempts
+ * failed, and true otherwise.
+ */
+ public boolean abort() throws LoginException {
+ if (succeeded == false) {
+ return false;
+ } else if (succeeded == true && commitSucceeded == false) {
+ // login succeeded but overall authentication failed
+ succeeded = false;
+ userId = null;
+ password = null;
+ userPrincipal = null;
+ } else {
+ // overall authentication succeeded and commit succeeded,
+ // but someone else's commit failed
+ logout();
+ }
+ return true;
+ }
+
+ /**
+ * Logout the user.
+ *
+ * <p> This method removes the <code>SimplePrincipal</code>
+ * that was added by the <code>commit</code> method.
+ *
+ * <p>
+ *
+ * @exception LoginException if the logout fails.
+ *
+ * @return true in all cases since this <code>LoginModule</code>
+ * should not be ignored.
+ */
+ public boolean logout() throws LoginException {
+ subject.getPrincipals().remove(userPrincipal);
+ succeeded = false;
+ succeeded = commitSucceeded;
+ userId = null;
+ if (password != null)
+ password = null;
+ userPrincipal = null;
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java
new file mode 100644
index 0000000000..8349e775c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.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.vtest.javaapi.annotations.conversationattributes.security;
+
+import java.security.Principal;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class UserPrincipal implements Principal {
+
+ private final String name;
+
+ public UserPrincipal(String name) {
+ if (name == null)
+ throw new IllegalArgumentException("name cannot be null");
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.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 UserPrincipal other = (UserPrincipal)obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/AJass.config b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/AJass.config
new file mode 100644
index 0000000000..9d5aec8ed5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/AJass.config
@@ -0,0 +1,3 @@
+AService {
+ org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.security.JaasLoginModule required debug=true;
+};
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/conversation.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/conversation.composite
new file mode 100644
index 0000000000..49391b3353
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/conversation.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Converstion-Composite">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ <reference name="b2" target="B2Component" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.impl.BServiceImpl" />
+ </component>
+
+ <component name="B2Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.impl.B2ServiceImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.impl.CServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..d3573176a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml
@@ -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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:convatt="http://convatt">
+
+ <!-- PolicySets -->
+ <policySet name="JaasPolicy" provides="tuscany:jaasAuthentication" appliesTo="sca:implementation.java"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <tuscany:jaasAuthentication>
+ <tuscany:configurationName>AService</tuscany:configurationName>
+ <tuscany:callbackHandler>org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.security.ACallbackHandler</tuscany:callbackHandler>
+ </tuscany:jaasAuthentication>
+ </policySet>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/singleprincipal.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/singleprincipal.composite
new file mode 100644
index 0000000000..c10369c9bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/main/resources/singleprincipal.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"
+ targetNamespace="http://java-api-tests"
+ xmlns:sample="http://java-api-tests"
+ name="SinglePrincipal"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.impl.AServiceImpl"
+ requires = "tuscany:jaasAuthentication" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.impl.CServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/ConversationAttributesAnnotationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/ConversationAttributesAnnotationTestCase.java
new file mode 100644
index 0000000000..b9d10732e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/ConversationAttributesAnnotationTestCase.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.vtest.javaapi.annotations.conversationattributes;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.osoa.sca.ConversationEndedException;
+
+/**
+ * This test class tests the Service annotation described in section 1.2.1 and
+ * 1.8.17
+ */
+public class ConversationAttributesAnnotationTestCase {
+
+ protected static String compositeName = "conversation.composite";
+ protected static AService aService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Line 1665, 1666
+ * <p>
+ * maxIdleTime (optional) - The maximum time that can pass between
+ * operations within a single conversation. If more time than this passes,
+ * then the container may end the conversation.
+ */
+ @Test(expected = ConversationEndedException.class)
+ public void maxIdle() throws Exception {
+ aService.testMaxIdle();
+ }
+
+ /**
+ * Line 1667, 1668
+ * <p>
+ * maxAge (optional) - The maximum time that the entire conversation can
+ * remain active. If more time than this passes, then the container may end
+ * the conversation.
+ */
+ @Test(expected = ConversationEndedException.class)
+ public void maxAge() throws Exception {
+ aService.testMaxAge();
+ }
+
+ /**
+ * Line 1669, 1670
+ * <p>
+ * singlePrincipal (optional) – If true, only the principal (the user) that
+ * started the conversation has authority to continue the conversation.
+ * The default value is false.
+ */
+ @Ignore
+ @Test(expected = Exception.class)
+ public void singlePrincipal() throws Exception {
+ aService.testSinglePrincipal();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java
new file mode 100644
index 0000000000..4ebd667a00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.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.vtest.javaapi.annotations.conversationattributes;
+
+import javax.security.auth.login.Configuration;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class SinglePricipalTestCase {
+
+ protected static String compositeName = "singleprincipal.composite";
+ protected static AService aService = null;
+
+ @Before
+ public void init() throws Exception {
+ try {
+ Configuration.getConfiguration();
+ } catch (java.lang.SecurityException e) {
+ System.out.println("Caught SecurityException");
+ System.setProperty("java.security.auth.login.config", this.getClass().getClassLoader()
+ .getResource("AJass.config").toString());
+ }
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ }
+
+ @After
+ public void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Line 1669, 1670
+ * <p>
+ * singlePrincipal (optional) – If true, only the principal (the user) that
+ * started the conversation has authority to continue the conversation. The
+ * default value is false.
+ */
+ @Test(expected = Exception.class)
+ public void singlePrincipal() throws Exception {
+ aService.testSinglePrincipal();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/pom.xml
new file mode 100644
index 0000000000..57477d1bbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-destroy</artifactId>
+
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @Destroy</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/AService.java
new file mode 100644
index 0000000000..039689805c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/AService.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.vtest.javaapi.annotations.destroy;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService
+ */
+@Remotable
+public interface AService {
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr1Impl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr1Impl.java
new file mode 100644
index 0000000000..0b30bb8644
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr1Impl.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.vtest.javaapi.annotations.destroy.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.AService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService. The implementation has an error since it annotates a protected
+ * method with "@Destroy".
+ */
+@Service(AService.class)
+public class AServiceErr1Impl implements AService {
+
+ @Destroy
+ protected void destroy() {
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr2Impl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr2Impl.java
new file mode 100644
index 0000000000..33b2e01bcb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr2Impl.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.vtest.javaapi.annotations.destroy.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.AService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService. The implementation has an error since it annotates a private
+ * method with "@Destroy".
+ */
+@Service(AService.class)
+public class AServiceErr2Impl implements AService {
+
+ @Destroy
+ private void destroy() {
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr3Impl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr3Impl.java
new file mode 100644
index 0000000000..d5630e859e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr3Impl.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.vtest.javaapi.annotations.destroy.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.AService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService. The implementation has an error since it annotates a
+ * method with non-void return type with "@Destroy".
+ */
+@Service(AService.class)
+public class AServiceErr3Impl implements AService {
+
+ @Destroy
+ public String destroy() {
+ return null;
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr4Impl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr4Impl.java
new file mode 100644
index 0000000000..b8f384704a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceErr4Impl.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.vtest.javaapi.annotations.destroy.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.AService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService. The implementation has an error since it annotates a
+ * method with arguments with "@Destroy".
+ */
+@Service(AService.class)
+public class AServiceErr4Impl implements AService {
+
+ @Destroy
+ public void destroy(int x) {
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceImpl.java
new file mode 100644
index 0000000000..75a00447f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/impl/AServiceImpl.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.vtest.javaapi.annotations.destroy.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.AService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Destroy
+ public void destroy() {
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err1/AServiceErr1.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err1/AServiceErr1.composite
new file mode 100644
index 0000000000..b03a0defe5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err1/AServiceErr1.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ xmlns:vtest="http://vtest"
+ name="AServiceErr1">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.impl.AServiceErr1Impl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err2/AServiceErr2.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err2/AServiceErr2.composite
new file mode 100644
index 0000000000..93aafdd971
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err2/AServiceErr2.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ xmlns:vtest="http://vtest"
+ name="AServiceErr2">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.impl.AServiceErr2Impl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err3/AServiceErr3.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err3/AServiceErr3.composite
new file mode 100644
index 0000000000..eb8f6e59ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err3/AServiceErr3.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ xmlns:vtest="http://vtest"
+ name="AServiceErr3">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.impl.AServiceErr3Impl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err4/AServiceErr4.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err4/AServiceErr4.composite
new file mode 100644
index 0000000000..296a386876
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/err4/AServiceErr4.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ xmlns:vtest="http://vtest"
+ name="AServiceErr4">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.impl.AServiceErr4Impl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/proper/AService.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/proper/AService.composite
new file mode 100644
index 0000000000..4373bc2558
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/main/resources/proper/AService.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ xmlns:vtest="http://vtest"
+ name="AService">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.destroy.impl.AServiceImpl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/DestroyAnnotationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/DestroyAnnotationTestCase.java
new file mode 100644
index 0000000000..f3b2f28200
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/destroy/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/DestroyAnnotationTestCase.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.vtest.javaapi.annotations.destroy;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.Test;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * This test class tests the "@Destroy" annotation described in section 1.8.8.
+ */
+public class DestroyAnnotationTestCase {
+
+ /**
+ * Lines 1225, 1226, 1227<br>
+ * The "@Destroy" annotation type is used to annotate a Java class method
+ * that will be called when the scope defined for the local service
+ * implemented by the class ends. The method must have a void return value
+ * and no arguments. The annotated method must be public.
+ * <p>
+ * This method tests a proper destroy method. i.e., public, no arguments and
+ * with void return type.
+ */
+ @Test
+ public void atDestroyProper() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/proper/AService.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/proper").toURL().toString()));
+ node.start();
+ AService aService = ((SCAClient)node).getService(AService.class, "AComponent");
+ Assert.assertEquals("Hello Pandu", aService.getGreetings("Pandu"));
+ node.stop();
+ }
+
+ /**
+ * Lines 1225, 1226, 1227<br>
+ * The "@Destroy" annotation type is used to annotate a Java class method
+ * that will be called when the scope defined for the local service
+ * implemented by the class ends. The method must have a void return value
+ * and no arguments. The annotated method must be public.
+ * <p>
+ * This method tests that an exception is thrown when a protected method is
+ * annotated with "@Destroy".
+ */
+ @Test
+ public void atDestroyProtectedMethod() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ try {
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err1/AServiceErr1.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/err1").toURL().toString()));
+ Assert.fail();
+ node.stop();
+ } catch(ServiceRuntimeException e) {
+ //expected
+ Assert.assertNotSame(-1, e.getMessage().indexOf("Destructor must be a public method."));
+ }
+ }
+
+ /**
+ * Lines 1225, 1226, 1227<br>
+ * The "@Destroy" annotation type is used to annotate a Java class method
+ * that will be called when the scope defined for the local service
+ * implemented by the class ends. The method must have a void return value
+ * and no arguments. The annotated method must be public.
+ * <p>
+ * This method tests that an exception is thrown when a private method is
+ * annotated with "@Destroy".
+ */
+ @Test
+ public void atDestroyPrivateMethod() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ try {
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err2/AServiceErr2.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/err2").toURL().toString()));
+ Assert.fail();
+ node.stop();
+ } catch(ServiceRuntimeException e) {
+ //expected
+ Assert.assertNotSame(-1, e.getMessage().indexOf("Destructor must be a public method."));
+ }
+ }
+
+ /**
+ * Lines 1225, 1226, 1227<br>
+ * The "@Destroy" annotation type is used to annotate a Java class method
+ * that will be called when the scope defined for the local service
+ * implemented by the class ends. The method must have a void return value
+ * and no arguments. The annotated method must be public.
+ * <p>
+ * This method tests that an exception is thrown when a method with non-void
+ * return type is annotated with "@Destroy".
+ */
+ @Test
+ public void atDestroyNonVoidReturnType() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ try {
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err3/AServiceErr3.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/err3").toURL().toString()));
+ Assert.fail();
+ node.stop();
+ } catch(ServiceRuntimeException e) {
+ //expected
+ Assert.assertNotSame(-1, e.getMessage().indexOf("Destructor must return void."));
+ }
+ }
+
+ /**
+ * Lines 1225, 1226, 1227<br>
+ * The "@Destroy" annotation type is used to annotate a Java class method
+ * that will be called when the scope defined for the local service
+ * implemented by the class ends. The method must have a void return value
+ * and no arguments. The annotated method must be public.
+ * <p>
+ * This method tests that an exception is thrown when a method with arguments is
+ * annotated with "@Destroy".
+ */
+ @Test
+ public void atDestroyMethodWithArgs() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ try {
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err4/AServiceErr4.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/err4").toURL().toString()));
+ Assert.fail();
+ node.stop();
+ } catch(ServiceRuntimeException e) {
+ //expected
+ Assert.assertNotSame(-1, e.getMessage().indexOf("Destructor must not have argments"));
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/pom.xml
new file mode 100644
index 0000000000..8cd14ed0a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-endsconversation</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @EndsConversation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/AService.java
new file mode 100644
index 0000000000..13bcb1fd51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/AService.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.vtest.javaapi.annotations.endsconversation;
+
+/**
+ * Simple Remotable Service
+ */
+public interface AService {
+
+ public void testAtEndsConversation();
+
+ public void testSREndConversation();
+
+ public void testTimedEnd();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/BService.java
new file mode 100644
index 0000000000..5400c1fe0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/BService.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.vtest.javaapi.annotations.endsconversation;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Simple Local Service
+ */
+@Conversational
+public interface BService {
+
+ public void setState(String someState);
+
+ public String getConversationId();
+
+ @EndsConversation
+ public void endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/impl/AServiceImpl.java
new file mode 100644
index 0000000000..ed564ddbdc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/impl/AServiceImpl.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.vtest.javaapi.annotations.endsconversation.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.endsconversation.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.endsconversation.BService;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.junit.Assert;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ protected BService b;
+
+ @Reference
+ protected ServiceReference<BService> b2;
+
+ private void delayForSeconds(int numSeconds) {
+ try {
+ Thread.sleep(numSeconds * 1000);// millisecs
+ } catch (InterruptedException ex) {
+ throw new Error(ex);
+ }
+ }
+
+ public void testAtEndsConversation() {
+ String firstId;
+ b.setState("SomeState");
+ firstId = b.getConversationId();
+ b.endConversation();
+ b.setState("SomeState");// This should start a new conversation
+ Assert.assertNotSame(b.getConversationId(), firstId);
+ }
+
+ public void testSREndConversation() {
+ String firstId;
+ b2.getService().setState("SomeState");
+ firstId = b2.getService().getConversationId();
+ b2.getConversation().end();
+ b2.getService().setState("SomeState");// This should start a new conversation
+ Assert.assertNotSame(b2.getService().getConversationId(), firstId);
+ }
+
+ public void testTimedEnd() {
+ b.setState("someState");
+ delayForSeconds(2);
+ b.setState("someState"); // should fail w/ timeout
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/impl/BServiceImpl.java
new file mode 100644
index 0000000000..418fb93c68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/impl/BServiceImpl.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.vtest.javaapi.annotations.endsconversation.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.endsconversation.BService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class BServiceImpl implements BService {
+
+ String someState;
+
+ protected String conversationId;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ @ConversationID
+ public void setConversationID (String id){
+ this.conversationId = id;
+ System.out.println("BService conversation ID =>" + conversationId);
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public String getConversationId() {
+ return conversationId;
+ }
+
+ public void endConversation() {
+ System.out.println("Conversation ended");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/resources/endsconversation.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/resources/endsconversation.composite
new file mode 100644
index 0000000000..cbc13e380c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/main/resources/endsconversation.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"
+ targetNamespace="http://java-api-tests" name="Converstion-Composite">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.endsconversation.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ <reference name="b2" target="BComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.endsconversation.impl.BServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/EndsConversationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/EndsConversationTestCase.java
new file mode 100644
index 0000000000..1ddd711a31
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/endsconversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/endsconversation/EndsConversationTestCase.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.vtest.javaapi.annotations.endsconversation;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osoa.sca.ConversationEndedException;
+
+/**
+ * This test class tests the Service annotation described in section 1.2.1 and
+ * 1.8.17
+ */
+public class EndsConversationTestCase {
+
+ protected static String compositeName = "endsconversation.composite";
+ protected static AService aService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Lines 410,411,412,413:
+ * <p>
+ * A method of a conversational interface may be marked with an
+ * "@EndsConversation" annotation. Once a method marked with
+ * "@EndsConversation" has been called, the conversation between client and
+ * service provider is at an end, which implies no further methods may be
+ * called on that service within the *same* conversation.
+ */
+ @Test
+ public void atEndsConversation1() throws Exception {
+ aService.testAtEndsConversation();
+ }
+
+ /**
+ * Lines 417,418,419,420:
+ * <p>
+ * From the errata: <br>
+ * Solution: Replace lines 417-420 at the end of section 1.6.2.2 with the
+ * following: "If a conversation is ended with an explicit outbound call to
+ * an "@EndsConversation" method or a call to
+ * ServiceReference.endConversation(), then any subsequent call to an
+ * operation on the service reference will start a new conversation. If the
+ * conversation ends for any other reason (e.g. a timeout occurred), then
+ * until ServiceReference.getConversation().end() is called, the
+ * ConversationEndedException will be thrown by any conversational
+ * operation."
+ * <p>
+ * This tests the first section of the errata. Up to "start a new
+ * conversation"
+ */
+ @Test
+ public void atEndsConversation2() throws Exception {
+ aService.testSREndConversation();
+ }
+
+ /**
+ * Lines 417,418,419,420:
+ * <p>
+ * From the errata: <br>
+ * Solution: Replace lines 417-420 at the end of section 1.6.2.2 with the
+ * following: "If a conversation is ended with an explicit outbound call to
+ * an "@EndsConversation" method or a call to
+ * ServiceReference.endConversation(), then any subsequent call to an
+ * operation on the service reference will start a new conversation. If the
+ * conversation ends for any other reason (e.g. a timeout occurred), then
+ * until ServiceReference.getConversation().end() is called, the
+ * ConversationEndedException will be thrown by any conversational
+ * operation."
+ * <p>
+ * This tests the second section of the errata. Starting with .. "If the
+ * conversation ends for any other reason ..."
+ */
+ @Test(expected = ConversationEndedException.class)
+ public void atEndsConversation3() throws Exception {
+ aService.testTimedEnd();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/pom.xml
new file mode 100644
index 0000000000..b2393947f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-init</artifactId>
+
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @Init</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/AService.java
new file mode 100644
index 0000000000..edf13010f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/AService.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.vtest.javaapi.annotations.init;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService
+ */
+@Remotable
+public interface AService {
+ public String getGreetings(String name);
+ public boolean isInitProper();
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr1Impl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr1Impl.java
new file mode 100644
index 0000000000..5d53510462
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr1Impl.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.vtest.javaapi.annotations.init.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.init.AService;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService. The implementation has an error since it annotates a protected
+ * method with "@Init".
+ */
+@Service(AService.class)
+public class AServiceErr1Impl implements AService {
+
+ @Init
+ protected void init() {
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ public boolean isInitProper() {
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr2Impl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr2Impl.java
new file mode 100644
index 0000000000..43c1a8cffa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr2Impl.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.vtest.javaapi.annotations.init.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.init.AService;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService. The implementation has an error since it annotates a private
+ * method with "@Init".
+ */
+@Service(AService.class)
+public class AServiceErr2Impl implements AService {
+
+ @Init
+ private void init() {
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ public boolean isInitProper() {
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr3Impl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr3Impl.java
new file mode 100644
index 0000000000..f5cac472c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr3Impl.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.vtest.javaapi.annotations.init.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.init.AService;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService. The implementation has an error since it annotates a
+ * method with non-void return type with "@Init".
+ */
+@Service(AService.class)
+public class AServiceErr3Impl implements AService {
+
+ @Init
+ public String init() {
+ return null;
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ public boolean isInitProper() {
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr4Impl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr4Impl.java
new file mode 100644
index 0000000000..b7c17ee535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceErr4Impl.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.vtest.javaapi.annotations.init.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.init.AService;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService. The implementation has an error since it annotates a
+ * method with arguments with "@Init".
+ */
+@Service(AService.class)
+public class AServiceErr4Impl implements AService {
+
+ @Init
+ public void init(int x) {
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ public boolean isInitProper() {
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceImpl.java
new file mode 100644
index 0000000000..c2adea1426
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/impl/AServiceImpl.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.vtest.javaapi.annotations.init.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.init.AService;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ private boolean initProper;
+
+ @Property
+ public String someProperty;
+
+ @Reference
+ public AService someReference;
+
+ @Init
+ public void init() {
+ initProper = someProperty != null && someReference != null;
+ }
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ public boolean isInitProper() {
+ return initProper;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err1/AServiceErr1.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err1/AServiceErr1.composite
new file mode 100644
index 0000000000..01b8e101e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err1/AServiceErr1.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ xmlns:vtest="http://vtest"
+ name="AServiceErr1">
+
+ <component name="AServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.init.impl.AServiceErr1Impl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err2/AServiceErr2.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err2/AServiceErr2.composite
new file mode 100644
index 0000000000..4ae38d44b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err2/AServiceErr2.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ xmlns:vtest="http://vtest"
+ name="AServiceErr2">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.init.impl.AServiceErr2Impl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err3/AServiceErr3.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err3/AServiceErr3.composite
new file mode 100644
index 0000000000..6bc3d8e7fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err3/AServiceErr3.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ xmlns:vtest="http://vtest"
+ name="AServiceErr3">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.init.impl.AServiceErr3Impl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err4/AServiceErr4.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err4/AServiceErr4.composite
new file mode 100644
index 0000000000..7ade16e6d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/err4/AServiceErr4.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ xmlns:vtest="http://vtest"
+ name="AServiceErr4">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.init.impl.AServiceErr4Impl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/proper/AService.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/proper/AService.composite
new file mode 100644
index 0000000000..35f13a2ae6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/main/resources/proper/AService.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://vtest"
+ xmlns:vtest="http://vtest"
+ name="AService">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.init.impl.AServiceImpl"/>
+ <property name="someProperty">hello</property>
+ <reference name="someReference" target="AnotherAComponent"/>
+ </component>
+ <component name="AnotherAComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.init.impl.AServiceImpl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/InitAnnotationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/InitAnnotationTestCase.java
new file mode 100644
index 0000000000..0dbccd8611
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/init/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/InitAnnotationTestCase.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.vtest.javaapi.annotations.init;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.Test;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * This test class tests the "@Init" annotation described in section 1.8.11.
+ */
+public class InitAnnotationTestCase {
+
+ /**
+ * Lines 1290, 1291, 1292, 1293 <br>
+ * The "@Init" annotation type is used to annotate a Java class method that
+ * is called when the scope defined for the local service implemented by the
+ * class starts. The method must have a void return value and no arguments.
+ * The annotated method must be public. The annotated method is called after
+ * all property and reference injection is complete.
+ * <p>
+ * This method tests a proper init method i.e., public, no arguments and with
+ * void return type.<br>
+ * Expected result: Method must be called. Method must be called after all property
+ * and reference injection is complete.
+ */
+ @Test
+ public void atInitProper() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/proper/AService.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/proper").toURL().toString()));
+ node.start();
+ AService aService = ((SCAClient)node).getService(AService.class, "AComponent");
+ Assert.assertTrue(aService.isInitProper());
+ Assert.assertEquals("Hello Pandu", aService.getGreetings("Pandu"));
+ node.stop();
+ }
+
+ /**
+ * Lines 1290, 1291, 1292, 1293 <br>
+ * The "@Init" annotation type is used to annotate a Java class method that
+ * is called when the scope defined for the local service implemented by the
+ * class starts. The method must have a void return value and no arguments.
+ * The annotated method must be public. The annotated method is called after
+ * all property and reference injection is complete.
+ * <p>
+ * This method tests that an exception is thrown when a protected method is
+ * annotated with "@Init".
+ */
+ @Test
+ public void atInitProtectedMethod() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ try {
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err1/AServiceErr1.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/err1").toURL().toString()));
+ Assert.fail();
+ node.stop();
+ } catch(ServiceRuntimeException e) {
+ //expected
+ Assert.assertNotSame(-1, e.getMessage().indexOf("Initializer must be a public method."));
+ }
+ }
+
+ /**
+ * Lines 1290, 1291, 1292, 1293 <br>
+ * The "@Init" annotation type is used to annotate a Java class method that
+ * is called when the scope defined for the local service implemented by the
+ * class starts. The method must have a void return value and no arguments.
+ * The annotated method must be public. The annotated method is called after
+ * all property and reference injection is complete.
+ * <p>
+ * This method tests that an exception is thrown when a private method is
+ * annotated with "@Init".
+ */
+ @Test
+ public void atInitPrivateMethod() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ try {
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err2/AServiceErr2.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/err2").toURL().toString()));
+ Assert.fail();
+ node.stop();
+ } catch(ServiceRuntimeException e) {
+ //expected
+ Assert.assertNotSame(-1, e.getMessage().indexOf("Initializer must be a public method."));
+ }
+ }
+
+ /**
+ * Lines 1290, 1291, 1292, 1293 <br>
+ * The "@Init" annotation type is used to annotate a Java class method that
+ * is called when the scope defined for the local service implemented by the
+ * class starts. The method must have a void return value and no arguments.
+ * The annotated method must be public. The annotated method is called after
+ * all property and reference injection is complete.
+ * <p>
+ * This method tests that an exception is thrown when a method with non-void
+ * return type is annotated with "@Init".
+ */
+ @Test
+ public void atInitNonVoidReturnType() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ try {
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err3/HelloWorldErr3.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/err3").toURL().toString()));
+ Assert.fail();
+ node.stop();
+ } catch(ServiceRuntimeException e) {
+ //expected
+ Assert.assertNotSame(-1, e.getMessage().indexOf("Initializer must return void."));
+ }
+ }
+
+ /**
+ * Lines 1290, 1291, 1292, 1293 <br>
+ * The "@Init" annotation type is used to annotate a Java class method that
+ * is called when the scope defined for the local service implemented by the
+ * class starts. The method must have a void return value and no arguments.
+ * The annotated method must be public. The annotated method is called after
+ * all property and reference injection is complete.
+ * <p>
+ * This method tests that an exception is thrown when a method with arguments is
+ * annotated with "@Init".
+ */
+ @Test
+ public void atInitMethodWithArgs() throws Exception {
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ try {
+ SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err4/HelloWorldErr4.composite").toURL().toString(),
+ new SCAContribution("TestContribution",
+ new File("src/main/resources/err4").toURL().toString()));
+ Assert.fail();
+ node.stop();
+ } catch(ServiceRuntimeException e) {
+ //expected
+ Assert.assertNotSame(-1, e.getMessage().indexOf("Initializer must not have argments"));
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/pom.xml
new file mode 100644
index 0000000000..18d22a913b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-oneway</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @OneWay</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/AService.java
new file mode 100644
index 0000000000..6fef2afa2a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/AService.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.vtest.javaapi.annotations.oneway;
+
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * Simple Remotable Service
+ */
+public interface AService {
+
+ @OneWay
+ public void setNameOneWay(String name);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/BService.java
new file mode 100644
index 0000000000..1cb4f3adf5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/BService.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.vtest.javaapi.annotations.oneway;
+
+/**
+ * Simple Local Service
+ */
+public interface BService {
+
+ public void setNameOneWay(String name);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/impl/AServiceImpl.java
new file mode 100644
index 0000000000..4829ffb95f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/impl/AServiceImpl.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.vtest.javaapi.annotations.oneway.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.oneway.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.oneway.BService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ protected BService b;
+
+ public void setNameOneWay(String name) {
+ b.setNameOneWay(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/impl/BServiceImpl.java
new file mode 100644
index 0000000000..09c783ae96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/impl/BServiceImpl.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.vtest.javaapi.annotations.oneway.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.oneway.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ String name;
+
+ private void delay2Seconds() {
+ try {
+ Thread.sleep(2000);// millisecs
+ } catch (InterruptedException ex) {
+ throw new Error(ex);
+ }
+ }
+
+ public void setNameOneWay(String name) {
+ delay2Seconds();
+ this.name = name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/resources/oneway.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/resources/oneway.composite
new file mode 100644
index 0000000000..47a7a98c7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/main/resources/oneway.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"
+ targetNamespace="http://java-api-tests" name="OneWay-Composite">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.oneway.impl.AServiceImpl" />
+ <reference name="b" target="BComponent"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.oneway.impl.BServiceImpl" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/OneWayAnnotationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/OneWayAnnotationTestCase.java
new file mode 100644
index 0000000000..f2fb8d0dc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/OneWayAnnotationTestCase.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.vtest.javaapi.annotations.oneway;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * This test class tests the Service annotation described in section 1.2.1 and
+ * 1.8.17
+ */
+public class OneWayAnnotationTestCase {
+
+ protected static String compositeName = "oneway.composite";
+ protected static AService aService = null;
+ protected static BService bService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Line 384,385,386:<br>
+ * <p>
+ * Any method that returns "void" and has no declared exceptions may be
+ * marked with an "@OneWay" annotation. This means that the method is
+ * non-blocking and communication with the service provider may use a
+ * binding that buffers the requests and sends it at some later time.
+ * <p>
+ * Line 1319, 1320:<br>
+ * <p>
+ * The "@OneWay" annotation type is used to annotate a Java interface method
+ * to indicate that invocations will be dispatched in a non-blocking fashion
+ * as described in the section on Asynchronous Programming.<br>
+ * <p>
+ * The serviceMethod on A is annotated with "@OneWay". The A implementation
+ * delegates to b's method which includes a 2 seconds delay. So, this will
+ * fail if the call to A is blocking.
+ */
+ @Test(timeout = 500)
+ public void atOneWay1() throws Exception {
+ aService.setNameOneWay("Some Name");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/pom.xml
new file mode 100644
index 0000000000..2755583358
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>vtest-java-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>java-api-annotations</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>reference</module>
+ <module>service</module>
+ <module>property</module>
+ <module>scope</module>
+ <module>init</module>
+ <module>destroy</module>
+ <module>oneway</module>
+ <module>conversational</module>
+ <module>conversationattributes</module>
+ <module>endsconversation</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/pom.xml
new file mode 100644
index 0000000000..3d4781846a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-property</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @Property</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.java
new file mode 100644
index 0000000000..5cfea1b099
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AService.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.vtest.javaapi.annotations.property;
+
+/**
+ * Simple Service
+ */
+public interface AService {
+
+ public String getName();
+
+ public String getP1();
+
+ public String getP2();
+
+ public String getP3();
+
+ public String getP4();
+
+ public String getP5();
+
+ public String getP6();
+
+ public String getP7AString();
+
+ public int getP7BInt();
+
+ public String getP8AString();
+
+ public int getP8BInt();
+
+ public String getP9AString();
+
+ public int getP9BInt();
+
+ public String getP10AString();
+
+ public int getP10BInt();
+
+ public String getP11AString();
+
+ public int getP11BInt();
+
+ public String getP12AString();
+
+ public int getP12BInt();
+
+ public String getP15();
+
+ public String getP16();
+
+ public String getP17();
+
+ public String getP18();
+
+ public int getP19Size();
+
+ public String getP20(int i);
+
+ public int getP20Size();
+
+ public int getP21(int i);
+
+ public int getP21Size();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.java
new file mode 100644
index 0000000000..5ddc59f8b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/AnotherAService.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.vtest.javaapi.annotations.property;
+
+/**
+ * Simple Service
+ */
+public interface AnotherAService {
+
+ public String getName();
+
+ public String getP13();
+
+ public String getP14();
+
+ public String getP22();
+
+ public String getP23();
+
+ public String getP24();
+
+ public String getP25();
+
+ public boolean getP14SetterIsCalled();
+
+ public boolean getP23SetterIsCalled();
+
+ public boolean getP24SetterIsCalled();
+
+ public boolean getP25SetterIsCalled();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.java
new file mode 100644
index 0000000000..99fb842a9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/BService.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.vtest.javaapi.annotations.property;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ String getName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.java
new file mode 100644
index 0000000000..5de3b5fcff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/CService.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.vtest.javaapi.annotations.property;
+
+
+/**
+ * Simple Service used by another service
+ */
+public interface CService {
+
+ String getName();
+
+ public String getB1Name();
+
+ public String getP2();
+
+ public int getP3();
+
+ public String getP4();
+
+ public String getConstructor();
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.java
new file mode 100644
index 0000000000..f30c4c69fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AObject.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.vtest.javaapi.annotations.property.impl;
+
+/**
+ * A simple object to hold a string
+ */
+public class AObject {
+
+ public String aString;
+ public int bInt;
+
+ public AObject() {
+ this.aString = null;
+ this.bInt = 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
new file mode 100644
index 0000000000..b385083533
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AServiceImpl.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.AService;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Property;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Property
+ protected String p1; // simple Java type injected via field
+
+ @Property
+ public String p2; // simple Java type injected via field
+
+ protected String p3; // simple Java type injected via setter
+
+ public String p4; // simple Java type injected via setter
+
+ protected String p5; // simple Java type injected via constructor parameter
+
+ public String p6; // simple Java type injected via constructor parameter
+
+ @Property(required=true)
+ protected AObject p7; // complex Java type injected via field
+
+ @Property
+ public AObject p8; // complex Java type injected via field
+
+ protected AObject p9; // complex Java type injected via setter
+
+ public AObject p10; // complex Java type injected via setter
+
+ protected AObject p11; // complex Java type injected via constructor parameter
+
+ public AObject p12; // complex Java type injected via constructor parameter
+
+ @Property(name="pFifteen")
+ protected String p15; // injected via field with different name
+
+ protected String p16; // injected via setter with different name
+
+ @Property(name="p17", required=false)
+ public String p17; // injected via field but not defined in composite
+
+ public String p18; // injected via setter but not defined in composite
+
+ @Property(name="p19", required=true)
+ public List<String> p19; // a List and injected via field with no element
+
+ public List<String> p20; // a List and injected via setter
+
+ @Property(required=false)
+ public Integer[] p21; // an array and injected via field
+
+ public String getName() {
+ return "AService";
+ }
+
+ public AServiceImpl(
+ @Property(name = "p5") String p5,
+ @Property(name = "p6") String p6,
+ @Property(name = "p11") AObject p11,
+ @Property(name = "p12") AObject p12
+ ) {
+ super();
+ this.p5 = p5;
+ this.p6 = p6;
+ this.p11 = p11;
+ this.p12 = p12;
+ }
+
+ @Property
+ public void setP3(String p3) {
+ this.p3 = p3;
+ }
+
+ @Property(required=true)
+ public void setP4(String p4) {
+ this.p4 = p4;
+ }
+
+ @Property
+ public void setP9(AObject p9) {
+ this.p9 = p9;
+ }
+
+ @Property
+ public void setP10(AObject p10) {
+ this.p10 = p10;
+ }
+
+ @Property(name="pSixteen")
+ public void setP16(String p16) {
+ this.p16 = p16;
+ }
+
+ @Property(name="p18", required=false)
+ public void setP18(String p18) {
+ this.p18 = p18;
+ }
+
+ @Property(name="p20", required=true)
+ public void setP20(List<String> p20) {
+ this.p20 = p20;
+ }
+
+ public String getP1() {
+ return p1;
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public String getP3() {
+ return p3;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+
+ public String getP5() {
+ return p5;
+ }
+
+ public String getP6() {
+ return p6;
+ }
+
+ public String getP7AString() {
+ return p7.aString;
+ }
+
+ public int getP7BInt() {
+ return p7.bInt;
+ }
+
+ public String getP8AString() {
+ return p8.aString;
+ }
+
+ public int getP8BInt() {
+ return p8.bInt;
+ }
+
+ public String getP9AString() {
+ return p9.aString;
+ }
+
+ public int getP9BInt() {
+ return p9.bInt;
+ }
+
+ public String getP10AString() {
+ return p10.aString;
+ }
+
+ public int getP10BInt() {
+ return p10.bInt;
+ }
+
+ public String getP11AString() {
+ return p11.aString;
+ }
+
+ public int getP11BInt() {
+ return p11.bInt;
+ }
+
+ public String getP12AString() {
+ return p12.aString;
+ }
+
+ public int getP12BInt() {
+ return p12.bInt;
+ }
+
+ public String getP15() {
+ return p15;
+ }
+
+ public String getP16() {
+ return p16;
+ }
+
+ public String getP17() {
+ return p17;
+ }
+
+ public String getP18() {
+ return p18;
+ }
+
+ public int getP19Size() {
+ return p19.size();
+ }
+
+ public String getP20(int i) {
+ return p20.get(i);
+ }
+
+ public int getP20Size() {
+ return p20.size();
+ }
+
+ public int getP21(int i) {
+ return p21[i].intValue();
+ }
+
+ public int getP21Size() {
+ return p21.length;
+ }
+
+}
+
+
+
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.java
new file mode 100644
index 0000000000..fd1ba5ee52
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/AnotherAServiceImpl.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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.AnotherAService;
+import org.osoa.sca.annotations.Service;
+
+@Service(AnotherAService.class)
+public class AnotherAServiceImpl implements AnotherAService {
+
+ public String p13; // injected via field and un-annotated
+
+ public String p14; // injected via setter and un-annotated
+
+ protected String p22; // unannotated protected field should not be injected
+
+ protected String p23; // un-annotated protected and has protected setter
+
+ protected String p24; // un-annotated protected field and has public setter
+
+ private String p25; // un-annotated private field and has public setter
+
+ public boolean p14SetterIsCalled = false;
+
+ public boolean p23SetterIsCalled = false;
+
+ public boolean p24SetterIsCalled = false;
+
+ public boolean p25SetterIsCalled = false;
+
+
+ public String getName() {
+ return "AService";
+ }
+
+ public void setP14(String p14) {
+ p14SetterIsCalled = true;
+ this.p14 = p14;
+ }
+
+ protected void setP23(String p23) {
+ p23SetterIsCalled = true;
+ this.p23 = p23;
+ }
+
+ public void setP24(String p24) {
+ p24SetterIsCalled = true;
+ this.p24 = p24;
+ }
+
+ public void setP25(String p25) {
+ p25SetterIsCalled = true;
+ this.p25 = p25;
+ }
+
+ public String getP13() {
+ return p13;
+ }
+
+ public String getP14() {
+ return p14;
+ }
+
+ public String getP22() {
+ return p22;
+ }
+
+ public String getP23() {
+ return p23;
+ }
+
+ public String getP24() {
+ return p24;
+ }
+
+ public String getP25() {
+ return p25;
+ }
+
+ public boolean getP14SetterIsCalled() {
+ return p14SetterIsCalled;
+ }
+
+
+ public boolean getP23SetterIsCalled() {
+ return p23SetterIsCalled;
+ }
+
+
+ public boolean getP24SetterIsCalled() {
+ return p24SetterIsCalled;
+ }
+
+
+ public boolean getP25SetterIsCalled() {
+ return p25SetterIsCalled;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.java
new file mode 100644
index 0000000000..f22f4a35b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/BServiceImpl.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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.java
new file mode 100644
index 0000000000..280d2275f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl1.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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl1 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ @Constructor
+ public CServiceImpl1() {
+ constructor = "NoArgument";
+ }
+
+ public CServiceImpl1(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "AllArguments";
+ }
+
+ public CServiceImpl1(BService bOne, String pTwo, int pThree) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ constructor = "LessArguments";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.java
new file mode 100644
index 0000000000..6bc4384e73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl2.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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl2 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl2() {
+ constructor = "NoArgument";
+ }
+
+ @Constructor()
+ public CServiceImpl2(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "AllArguments";
+ }
+
+ public CServiceImpl2(BService bOne, String pTwo, int pThree) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ constructor = "LessArguments";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.java
new file mode 100644
index 0000000000..6715b64fad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl3.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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl3 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl3() {
+ constructor = "NoArgument";
+ }
+
+ @Constructor({"bOne", "pTwo", "pThree", "pFour"})
+ public CServiceImpl3(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "AllArguments";
+ }
+
+ public CServiceImpl3(BService bOne, String pTwo, int pThree) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ constructor = "LessArguments";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.java
new file mode 100644
index 0000000000..e10f07b0be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl4.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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl4 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl4() {
+ constructor = "NoArgument";
+ }
+
+ public CServiceImpl4(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4, int extra) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "ExtraArguments";
+ }
+
+ @Constructor({"bOne", "pTwo", "pThree", "pFour"})
+ public CServiceImpl4(BService bOne, String pTwo, int pThree, String pFour) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ this.p4 = pFour;
+ constructor = "AllArguments";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.java
new file mode 100644
index 0000000000..9a23e2de8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl5.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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl5 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl5() {
+ constructor = "NoArgument";
+ }
+
+ public CServiceImpl5(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4, int extra) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "ExtraArguments";
+ }
+
+ @Constructor({"bOne", "pFour", "pThree", "pTwo"})
+ public CServiceImpl5(BService bOne, String pTwo, int pThree, String pFour) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ this.p4 = pFour;
+ constructor = "SwitchedValues";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.java
new file mode 100644
index 0000000000..b4797595ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/impl/CServiceImpl6.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.vtest.javaapi.annotations.property.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl6 implements CService {
+
+ public BService b1;
+
+ public String p2;
+
+ public int p3;
+
+ public String p4;
+
+ public String constructor;
+
+ public CServiceImpl6() {
+ constructor = "NoArgument";
+ }
+
+ public CServiceImpl6(@Reference(name = "bOne") BService b1, @Property(name = "pTwo") String p2, @Property(name = "pThree") int p3, @Property(name = "pFour") String p4, int extra) {
+ this.b1 = b1;
+ this.p2 = p2;
+ this.p3 = p3;
+ this.p4 = p4;
+ constructor = "ExtraArguments";
+ }
+
+ @Constructor({"bOne", "pTwo", "pThree", "pWrong"})
+ public CServiceImpl6(BService bOne, String pTwo, int pThree, String pFour) {
+ this.b1 = bOne;
+ this.p2 = pTwo;
+ this.p3 = pThree;
+ this.p4 = pFour;
+ constructor = "WrongValues";
+ }
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getB1Name() {
+ if (b1 == null)
+ return null;
+ return b1.getName();
+ }
+
+ public String getP2() {
+ return p2;
+ }
+
+ public int getP3() {
+ return p3;
+ }
+
+ public String getConstructor() {
+ return constructor;
+ }
+
+ public String getP4() {
+ return p4;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/resources/property.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/resources/property.composite
new file mode 100644
index 0000000000..f7af170f33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/main/resources/property.composite
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://java-api-tests" name="Property-Composite">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.AServiceImpl" />
+ <property name="p1">p1</property>
+ <property name="p2">p2</property>
+ <property name="p3">p3</property>
+ <property name="p4">p4</property>
+ <property name="p5">p5</property>
+ <property name="p6">p6</property>
+ <property name="p7" type="AObject">
+ <AObject xmlns="">
+ <aString>p7.aString</aString>
+ <bInt>7</bInt>
+ </AObject>
+ </property>
+ <property name="p8" type="AObject">
+ <AObject xmlns="">
+ <aString>p8.aString</aString>
+ <bInt>8</bInt>
+ </AObject>
+ </property>
+ <property name="p9" type="AObject">
+ <AObject xmlns="">
+ <aString>p9.aString</aString>
+ <bInt>9</bInt>
+ </AObject>
+ </property>
+ <property name="p10" type="AObject">
+ <AObject xmlns="">
+ <aString>p10.aString</aString>
+ <bInt>10</bInt>
+ </AObject>
+ </property>
+ <property name="p11" type="AObject">
+ <AObject xmlns="">
+ <aString>p11.aString</aString>
+ <bInt>11</bInt>
+ </AObject>
+ </property>
+ <property name="p12" type="AObject">
+ <AObject xmlns="">
+ <aString>p12.aString</aString>
+ <bInt>12</bInt>
+ </AObject>
+ </property>
+ <property name="pFifteen">p15</property>
+ <property name="pSixteen">p16</property>
+ <property name="p19" many="true"></property>
+ <property name="p20" many="true">"p20"</property>
+ <property name="p21" many="true">2 1 21</property>
+ </component>
+
+ <component name="CComponent1">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl1" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent2">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl2" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent3">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl3" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent4">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl4" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent5">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl5" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="CComponent6">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.CServiceImpl6" />
+ <reference name="bOne" target="BComponent"/>
+ <property name="pTwo">p2</property>
+ <property name="pThree">3</property>
+ <property name="pFour">p4</property>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.BServiceImpl"/>
+ </component>
+
+ <component name="AnotherAComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.property.impl.AnotherAServiceImpl" />
+ <property name="p13">p13</property>
+ <property name="p14">p14</property>
+ <property name="p22">p22</property>
+ <property name="p23">p23</property>
+ <property name="p24">p24</property>
+ <property name="p25">p25</property>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
new file mode 100644
index 0000000000..d5fbc568f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
@@ -0,0 +1,299 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.annotations.property;
+
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test class tests the Property annotation described in section 1.2.3
+ * including 1.8.5 and 1.8.13
+ */
+public class PropertyAnnotationTestCase {
+
+ protected static String compositeName = "property.composite";
+ protected static AService aService = null;
+ protected static CService cService1 = null;
+ protected static CService cService2 = null;
+ protected static CService cService3 = null;
+ protected static CService cService4 = null;
+ protected static CService cService5 = null;
+ protected static CService cService6 = null;
+ protected static AnotherAService anotherAService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ cService1 = ServiceFinder.getService(CService.class, "CComponent1");
+ cService2 = ServiceFinder.getService(CService.class, "CComponent2");
+ cService3 = ServiceFinder.getService(CService.class, "CComponent3");
+ cService4 = ServiceFinder.getService(CService.class, "CComponent4");
+ cService5 = ServiceFinder.getService(CService.class, "CComponent5");
+ cService6 = ServiceFinder.getService(CService.class, "CComponent6");
+ anotherAService = ServiceFinder.getService(AnotherAService.class, "AnotherAComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Lines 1343 to 1348:<br>
+ * The "@Property" annotation type is used to annotate a Java class field or
+ * a setter method that is used to inject an SCA property value. The type of
+ * the property injected, which can be a simple Java type or a complex Java
+ * type, is defined by the type of the Java class field or the type of the
+ * setter method input argument.<br>
+ * The "@Property" annotation may be used on protected or public fields and
+ * on setter methods or on a constructor method.<br>
+ * <p>
+ * p1 - simple Java type injected via field<br>
+ * p2 - simple Java type injected via field<br>
+ * p3 - simple Java type injected via setter<br>
+ * p4 - simple Java type injected via setter and required=true<br>
+ * p5 - simple Java type injected via constructor parameter<br>
+ * p6 - simple Java type injected via constructor parameter<br>
+ * p7 - complex Java type injected via field and required=true<br>
+ * p8 - complex Java type injected via field<br>
+ * p9 - complex Java type injected via setter<br>
+ * p10 - complex Java type injected via setter<br>
+ * p11 - complex Java type injected via constructor parameter<br>
+ * p12 - complex Java type injected via constructor parameter<br>
+ */
+ @Test
+ public void atProperty1() throws Exception {
+ Assert.assertEquals("p1", aService.getP1());
+ Assert.assertEquals("p2", aService.getP2());
+ Assert.assertEquals("p3", aService.getP3());
+ Assert.assertEquals("p4", aService.getP4());
+ Assert.assertEquals("p5", aService.getP5());
+ Assert.assertEquals("p6", aService.getP6());
+ Assert.assertEquals("p7.aString", aService.getP7AString());
+ Assert.assertEquals(7, aService.getP7BInt());
+ Assert.assertEquals("p8.aString", aService.getP8AString());
+ Assert.assertEquals(8, aService.getP8BInt());
+ Assert.assertEquals("p9.aString", aService.getP9AString());
+ Assert.assertEquals(9, aService.getP9BInt());
+ Assert.assertEquals("p10.aString", aService.getP10AString());
+ Assert.assertEquals(10, aService.getP10BInt());
+ Assert.assertEquals("p11.aString", aService.getP11AString());
+ Assert.assertEquals(11, aService.getP11BInt());
+ Assert.assertEquals("p12.aString", aService.getP12AString());
+ Assert.assertEquals(12, aService.getP12BInt());
+ }
+
+ /**
+ * Lines 1349 to 1352:<br>
+ * Properties may also be injected via public setter methods even when the
+ * "@Property" annotation is not present. However, the
+ *
+ * @Property annotation must be used in order to inject a property onto a
+ * non-public field. In the case where there is no "@Property"
+ * annotation, the name of the property is the same as the name of
+ * the field or setter.<br>
+ * <p>
+ * p13 is an un-annotated public field which should be injected
+ * via field<br>
+ */
+ @Test
+ public void atProperty2() throws Exception {
+ Assert.assertEquals("p13", anotherAService.getP13());
+ }
+
+ /**
+ * Line 1353:<br>
+ * Where there is both a setter method and a field for a property, the
+ * setter method is used.<br>
+ * <p>
+ * p14 is an un-annotated public field, it should be injected via public
+ * setter<br>
+ */
+ @Test
+ public void atProperty3() throws Exception {
+ Assert.assertEquals("p14", anotherAService.getP14());
+ Assert.assertTrue(anotherAService.getP14SetterIsCalled());
+ }
+
+ /**
+ * Lines 1355 to 1357:<br>
+ * The "@Property" annotation has the following attributes:<br>
+ * <li>name (optional) – the name of the property, defaults to the name of
+ * the field of the Java class</li>
+ * <li>required (optional) – specifies whether injection is required,
+ * defaults to false</li>
+ * <p>
+ * p15 - injected via field with different name "pFifteen"<br>
+ * p16 - injected via setter with different name "pSixteen"<br>
+ * p17 - injected via field but not defined in composite<br>
+ * p18 - injected via setter but not defined in composite<br>
+ *
+ * @TODO - Need to test required=true but not defined in composite (The
+ * specification does not describe the proper behaviour in this
+ * situation.)
+ */
+ @Test
+ public void atProperty4() throws Exception {
+ Assert.assertEquals("p15", aService.getP15());
+ Assert.assertEquals("p16", aService.getP16());
+ Assert.assertNull(aService.getP17());
+ Assert.assertNull(aService.getP18());
+ }
+
+ /**
+ * Lines 1369 to 1370:<br>
+ * If the property is defined as an array or as a java.util.Collection, then
+ * the implied component type has a property with a many attribute set to
+ * true.<br>
+ * <p>
+ * p19 - a List and injected via field with no element<br>
+ * p20 - a List and injected via setter<br>
+ * p21 - an array and injected via field<br>
+ */
+ @Test
+ public void atProperty5() throws Exception {
+ Assert.assertEquals(0, aService.getP19Size());
+ Assert.assertEquals(1, aService.getP20Size());
+ Assert.assertEquals("p20", aService.getP20(0));
+ Assert.assertEquals(3, aService.getP21Size());
+ Assert.assertEquals(2, aService.getP21(0));
+ Assert.assertEquals(1, aService.getP21(1));
+ Assert.assertEquals(21, aService.getP21(2));
+ }
+
+ /**
+ * Lines 1141 to 1162:<br>
+ * 1.8.5. "@Constructor"<br>
+ * ...<br>
+ * The "@Constructor" annotation is used to mark a particular constructor to
+ * use when instantiating a Java component implementation.<br>
+ * The "@Constructor" annotation has the following attribute:<br>
+ * <li>value (optional) – identifies the property/reference names that
+ * correspond to each of the constructor arguments. The position in the
+ * array determines which of the arguments are being named.</li>
+ * <p>
+ * cService1 - "@Constructor" without value and constructor arguments<br>
+ * cService2 - "@Constructor" without value but with constructor arguments<br>
+ * cService3 - "@Constructor" with values and constructor arguments<br>
+ * cService4 - "@Constructor" with values and constructor arguments where
+ * value, property and parameter names are same<br>
+ * cService5 - "@Constructor" with switched values and constructor arguments<br>
+ * cService6 - "@Constructor" with wrong values<br>
+ */
+ @Test
+ public void atProperty6() throws Exception {
+ Assert.assertNull(cService1.getB1Name());
+ Assert.assertNull(cService1.getP2());
+ Assert.assertEquals(0, cService1.getP3());
+ Assert.assertNull(cService1.getP4());
+ Assert.assertEquals("NoArgument", cService1.getConstructor());
+
+ Assert.assertEquals("BService", cService2.getB1Name());
+ Assert.assertEquals("p2", cService2.getP2());
+ Assert.assertEquals(3, cService2.getP3());
+ Assert.assertEquals("p4", cService2.getP4());
+ Assert.assertEquals("AllArguments", cService2.getConstructor());
+
+ Assert.assertEquals("BService", cService3.getB1Name());
+ Assert.assertEquals("p2", cService3.getP2());
+ Assert.assertEquals(3, cService3.getP3());
+ Assert.assertEquals("p4", cService3.getP4());
+ Assert.assertEquals("AllArguments", cService3.getConstructor());
+
+ Assert.assertEquals("BService", cService4.getB1Name());
+ Assert.assertEquals("p2", cService4.getP2());
+ Assert.assertEquals(3, cService4.getP3());
+ Assert.assertEquals("p4", cService4.getP4());
+ Assert.assertEquals("AllArguments", cService4.getConstructor());
+
+ Assert.assertEquals("BService", cService5.getB1Name());
+ Assert.assertEquals("p4", cService5.getP2());
+ Assert.assertEquals(3, cService5.getP3());
+ Assert.assertEquals("p2", cService5.getP4());
+ Assert.assertEquals("SwitchedValues", cService5.getConstructor());
+
+ try {
+ System.out.println(cService6.getB1Name());
+ fail("Should have failed to call this service");
+ } catch (Throwable t) {
+ }
+
+ }
+
+ /**
+ * Lines 1349 to 1352:<br>
+ * 1.8.13. "@Property"<br>
+ * ...<br>
+ * Properties may also be injected via public setter methods even when the
+ * "@Property" annotation is not present. However, the "@Property"
+ * annotation must be used in order to inject a property onto a non-public
+ * field. In the case where there is no "@Property" annotation, the name of
+ * the property is the same as the name of the field or setter.
+ * <p>
+ * p22 is unannotated protected field which should not be injected p23 is
+ * un-annotated protected which should not be injected via protected setter<br>
+ */
+ @Test
+ @Ignore("JIRA-2289 - p23 failed")
+ public void atProperty7() throws Exception {
+ Assert.assertNull(anotherAService.getP22());
+ Assert.assertNull(anotherAService.getP23());
+ Assert.assertFalse(anotherAService.getP23SetterIsCalled());
+ }
+
+ /**
+ * Lines 1349 to 1352:<br>
+ * 1.8.13. "@Property"<br>
+ * ...<br>
+ * Properties may also be injected via public setter methods even when the
+ * "@Property" annotation is not present. However, the "@Property"
+ * annotation must be used in order to inject a property onto a non-public
+ * field. In the case where there is no "@Property" annotation, the name of
+ * the property is the same as the name of the field or setter.
+ * <p>
+ * p24 is un-annotated protected field which should be injected via public
+ * setter<br>
+ * p25 is un-annotated private field which should be injected via public
+ * setter<br>
+ */
+ @Test
+ public void atProperty8() throws Exception {
+ Assert.assertEquals("p24", anotherAService.getP24());
+ Assert.assertTrue(anotherAService.getP24SetterIsCalled());
+ Assert.assertEquals("p25", anotherAService.getP25());
+ Assert.assertTrue(anotherAService.getP25SetterIsCalled());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/pom.xml
new file mode 100644
index 0000000000..261abb3ab9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-reference</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @Reference</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
new file mode 100644
index 0000000000..b28704a3b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.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.vtest.javaapi.annotations.reference;
+
+
+/**
+ * Simple Service that uses another Service
+ */
+public interface AService {
+
+ public String getName();
+ public String getB1Name();
+ public String getB2Name();
+ public String getB3Name();
+ public String getB4Name();
+ public String getB5Name();
+ public String getB6Name();
+ public String getB7Name();
+ public String getB8Name();
+ public String getB9Name();
+ public String getB10Name();
+ public String getB11Name();
+ public String getB12Name();
+ public String getB13Name(int i);
+ public String getB14Name(int i);
+ public String getB15Name(int i);
+
+ public int getB13Size();
+ public int getB14Size();
+ public int getB15Size();
+
+ public boolean isB7SetterCalled();
+ public boolean isB16Null();
+ public boolean isB17Null();
+
+ public boolean isB4Null();
+ public boolean isB5Null();
+ public boolean isB6Null();
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.java
new file mode 100644
index 0000000000..53b376d369
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/BService.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.vtest.javaapi.annotations.reference;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ String getName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
new file mode 100644
index 0000000000..67299d322d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.BService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ protected BService b1; // field injection
+
+ protected BService b2; // injected via constructor parameter
+
+ protected BService b3; // setter injection
+
+ public BService b4; // field injection (public, un-annotated)
+
+ protected BService b5; // field injection (non-public, un-annotated)
+
+ public BService b6; // setter injection (public, un-annotated)
+
+ @Reference
+ protected BService b7; // setter injection (field and setter annotated)
+
+ @Reference(name="b8", required=false)
+ protected BService bEight; // field injection (different reference and field name)
+
+ protected BService bNine; // setter injection (different reference and field name)
+
+ @Reference(required=false)
+ protected BService b10; // multiplicity="0..1" and required=false
+
+ @Reference(required=false)
+ protected BService b11; // multiplicity="1..1" and required=false
+
+ protected BService b12; // multiplicity="1..1" and required=true at setter
+
+ @Reference(required=false)
+ protected List<BService> b13; // multiplicity="0..n" and required=false
+
+ protected List<BService> b14; // multiplicity="1..n" and required=false at setter
+
+ @Reference(name="b15", required=true)
+ protected BService[] b15s; // multiplicity="1..n" and required=true
+
+ @Reference(required=false)
+ protected BService b16;
+
+ @Reference(required=false)
+ public BService b17;
+
+ protected boolean b7SetterCalled;
+
+ public AServiceImpl(@Reference(name = "b2")
+ BService b2) {
+ super();
+ this.b2 = b2;
+ b7SetterCalled = false;
+ }
+
+ @Reference
+ public void setB3(BService b3) {
+ this.b3 = b3;
+ }
+
+ public void setB6(BService b6) {
+ this.b6 = b6;
+ }
+
+ @Reference
+ public void setB7(BService b7) {
+ b7SetterCalled = true;
+ this.b7 = b7;
+ }
+
+ @Reference(name="b9", required=false)
+ public void setB9(BService bNine) {
+ this.bNine = bNine;
+ }
+
+ @Reference(required=true)
+ public void setB12(BService b12) {
+ this.b12 = b12;
+ }
+
+ @Reference(required=true)
+ public void setB14(List<BService> b14) {
+ this.b14 = b14;
+ }
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String getB1Name() {
+ return b1.getName();
+ }
+
+ public String getB2Name() {
+ return b2.getName();
+ }
+
+ public String getB3Name() {
+ return b3.getName();
+ }
+
+ public String getB4Name() {
+ return b4.getName();
+ }
+
+ public String getB5Name() {
+ return b5.getName();
+ }
+
+ public String getB6Name() {
+ return b6.getName();
+ }
+
+ public String getB7Name() {
+ return b7.getName();
+ }
+
+ public String getB8Name() {
+ return bEight.getName();
+ }
+
+ public String getB9Name() {
+ return bNine.getName();
+ }
+
+ public String getB10Name() {
+ return b10.getName();
+ }
+
+ public String getB11Name() {
+ return b11.getName();
+ }
+
+ public String getB12Name() {
+ return b12.getName();
+ }
+
+ public String getB13Name(int i) {
+ BService b = (BService) b13.get(i);
+ return b.getName();
+ }
+
+ public String getB14Name(int i) {
+ BService b = (BService) b14.get(i);
+ return b.getName();
+ }
+
+ public String getB15Name(int i) {
+ return b15s[i].getName();
+ }
+
+ public int getB13Size() {
+ return b13.size();
+ }
+
+ public int getB14Size() {
+ return b14.size();
+ }
+
+ public int getB15Size() {
+ return b15s.length;
+ }
+
+ public boolean isB7SetterCalled() {
+ return b7SetterCalled;
+ }
+
+ public boolean isB16Null() {
+ return b16 == null;
+ }
+
+ public boolean isB17Null() {
+ return b17 == null;
+ }
+
+ public boolean isB4Null() {
+ return b4 == null;
+ }
+
+ public boolean isB5Null() {
+ return b5 == null;
+ }
+
+ public boolean isB6Null() {
+ return b6 == null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java
new file mode 100644
index 0000000000..a819dfd87d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AUnannotatedServiceImpl implements AService {
+
+ public BService b4; // field injection (public, un-annotated)
+
+ protected BService b5; // field injection (non-public, un-annotated)
+
+ public BService b6; // setter injection (public, un-annotated)
+
+ public AUnannotatedServiceImpl() {
+ }
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String getB4Name() {
+ return b4.getName();
+ }
+
+ public String getB5Name() {
+ return b5.getName();
+ }
+
+ public void setB6(BService b6) {
+ this.b6 = b6;
+ }
+
+ public String getB6Name() {
+ return b6.getName();
+ }
+
+ public String getB1Name() {
+ return null;
+ }
+
+ public String getB2Name() {
+ return null;
+ }
+
+ public String getB3Name() {
+ return null;
+ }
+
+ public String getB7Name() {
+ return null;
+ }
+
+ public String getB8Name() {
+ return null;
+ }
+
+ public String getB9Name() {
+ return null;
+ }
+
+ public boolean isB7SetterCalled() {
+ return false;
+ }
+
+ public String getB10Name() {
+ return null;
+ }
+
+ public String getB11Name() {
+ return null;
+ }
+
+ public String getB12Name() {
+ return null;
+ }
+
+ public String getB13Name(int i) {
+ return null;
+ }
+
+ public int getB13Size() {
+ return 0;
+ }
+
+ public String getB14Name(int i) {
+ return null;
+ }
+
+ public int getB14Size() {
+ return 0;
+ }
+
+ public String getB15Name(int i) {
+ return null;
+ }
+
+ public int getB15Size() {
+ return 0;
+ }
+
+ public boolean isB16Null() {
+ return true;
+ }
+
+ public boolean isB17Null() {
+ return true;
+ }
+
+ public boolean isB4Null() {
+ return b4 == null;
+ }
+
+ public boolean isB5Null() {
+ return b5 == null;
+ }
+
+ public boolean isB6Null() {
+ return b6 == null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/BServiceImpl.java
new file mode 100644
index 0000000000..e8611d510f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/BServiceImpl.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.vtest.javaapi.annotations.reference.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/resources/ab.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/resources/ab.composite
new file mode 100644
index 0000000000..b4ad1e77d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/main/resources/ab.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"
+ targetNamespace="http://java-api-tests"
+ name="AB-Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent"/>
+ <reference name="b2" target="BComponent"/>
+ <reference name="b3" target="BComponent"/>
+ <reference name="b7" target="BComponent"/>
+ <reference name="b8" target="BComponent"/>
+ <reference name="b9" target="BComponent"/>
+ <reference name="b10" multiplicity="0..1" target="BComponent"/>
+ <reference name="b11" multiplicity="1..1" target="BComponent"/>
+ <reference name="b12" multiplicity="1..1" target="BComponent"/>
+ <reference name="b13" multiplicity="0..n" target=""/>
+ <reference name="b14" multiplicity="1..n" target="BComponent"/>
+ <reference name="b15" multiplicity="1..n" target="BComponent BComponent"/>
+ </component>
+
+ <component name="AUnannotatedComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AUnannotatedServiceImpl"/>
+ <reference name="b4" target="BComponent"/>
+ <reference name="b5" target="BComponent"/>
+ <reference name="b6" target="BComponent"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.BServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
new file mode 100644
index 0000000000..1fe50b4ea7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.annotations.reference;
+
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test class tests the "@Reference" annotation described in section 1.8.14
+ */
+public class ReferenceAnnotationTestCase {
+
+ protected static String compositeName = "ab.composite";
+ protected static AService a;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a = ServiceFinder.getService(AService.class, "AComponent");
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Temporary test unrelated to spec test effort. Remove after resolution of
+ */
+ @Test
+ @Ignore
+ // JIRA T-2145
+ public void bogusComponentName() throws Exception {
+ ServiceFinder.init(compositeName);
+ try {
+ AService a = ServiceFinder.getService(AService.class, "AReallyBogusComponentName");
+ if (a == null)
+ fail("Should have thrown an exception rather than return null");
+ else
+ fail("Should have thrown an exception rather than return a proxy");
+ } finally {
+ ServiceFinder.cleanup();
+ }
+
+ }
+
+ /**
+ * Lines 1404, 1405, 1406 <br>
+ * The "@Reference" annotation type is used to annotate a Java class field
+ * or a setter method that is used to inject a service that resolves the
+ * reference. The interface of the service injected is defined by the type
+ * of the Java class field or the type of the setter method input argument.
+ * <p>
+ * This tests the use of the three usages of the "@Reference" annotation<br>
+ * B1 is injected via field injection <br>
+ * B2 is injected via constructor parameter <br>
+ * B3 is injected via setter method
+ */
+ @Test
+ public void atReference1() throws Exception {
+
+ Assert.assertEquals("BService", a.getB1Name());
+ Assert.assertEquals("BService", a.getB2Name());
+ Assert.assertEquals("BService", a.getB3Name());
+
+ }
+
+ /**
+ * Lines 1407, 1408, 1409, 1410 <br>
+ * References may also be injected via public setter methods even when the
+ * "@Reference" annotation is not present. However, the "@Reference"
+ * annotation must be used in order to inject a reference onto a non public
+ * field. In the case where there is no "@Reference" annotation, the name of
+ * the reference is the same as the name of the field or setter.
+ * <p>
+ * B4 is injected via field injection. Public, Non-annotated <br>
+ * B5 is expected to fail field injection. Non-Public, Non-Annotated <br>
+ * B6 is injected via setter injection. Public, Non-Annotated
+ */
+ @Test
+ public void atReference2() throws Exception {
+ AService anotherA = ServiceFinder.getService(AService.class, "AUnannotatedComponent");
+
+ Assert.assertFalse(anotherA.isB4Null());
+ Assert.assertTrue(anotherA.isB5Null());
+ Assert.assertFalse(anotherA.isB6Null());
+
+ Assert.assertEquals("BService", anotherA.getB4Name());
+ try {
+ anotherA.getB5Name();
+ fail("getB5Name expected to fail with NPE");
+ } catch (NullPointerException e) {
+ }
+ Assert.assertEquals("BService", anotherA.getB6Name());
+
+ }
+
+ /**
+ * Lines 1411 <br>
+ * Where there is both a setter method and a field for a reference, the
+ * setter method is used.
+ * <p>
+ * B7 has both field and setter annotated. The setter must be called
+ */
+ @Test
+ public void atReference3() throws Exception {
+ Assert.assertTrue(a.isB7SetterCalled());
+ }
+
+ /**
+ * Lines 1413, 1414, 1415 <br>
+ * The "@Reference" annotation has the following attributes: <br> • name
+ * (optional) – the name of the reference, defaults to the name of the field
+ * of the Java class <br>
+ * required (optional) – whether injection of service or services is
+ * required. Defaults to true.
+ * <p>
+ * Reference and field have different names<br>
+ * B8 is field injected<br>
+ * B9 is setter injected
+ */
+ @Test
+ public void atReference4() throws Exception {
+ Assert.assertEquals("BService", a.getB8Name());
+ Assert.assertEquals("BService", a.getB9Name());
+ }
+
+ /**
+ * Lines 1457 to 1459<br>
+ * If the reference is not an array or collection, then the implied
+ * component type has a reference with a multiplicity of either 0..1 or 1..1
+ * depending on the value of the
+ *
+ * @Reference required attribute – 1..1 applies if required=true.<br>
+ * <p>
+ * B10 is field injected, required=false, and multiplicity="0..1"<br>
+ * B11 is field injected, required=false, and multiplicity="1..1"<br>
+ * B12 is setter injected, required=true, and multiplicity="1..1"
+ */
+ @Test
+ public void atReference5() throws Exception {
+ Assert.assertEquals("BService", a.getB10Name());
+ Assert.assertEquals("BService", a.getB11Name());
+ Assert.assertEquals("BService", a.getB12Name());
+ }
+
+ /**
+ * Lines 1461 to 1463<br>
+ * If the reference is defined as an array or as a java.util.Collection,
+ * then the implied component type has a reference with a multiplicity of
+ * either 1..n or 0..n, depending on whether the required attribute of the
+ * "@Reference" annotation is set to true or false – 1..n applies if
+ * required=true.<br>
+ * <p>
+ * B13 is a java.util.List, field injected, required=false,
+ * multiplicity="0..n", and no target<br>
+ * B14 is a java.util.List, setter injected, required=true,
+ * multiplicity="1..n", and one target<br>
+ * B15 is an array, field injected, required=true, multiplicity="1..n", and
+ * two targets
+ */
+ @Test
+ public void atReference6() throws Exception {
+ Assert.assertEquals(0, a.getB13Size());
+ Assert.assertEquals("BService", a.getB14Name(0));
+ Assert.assertEquals(1, a.getB14Size());
+ Assert.assertEquals("BService", a.getB15Name(0));
+ Assert.assertEquals("BService", a.getB15Name(1));
+ Assert.assertEquals(2, a.getB15Size());
+ }
+
+ /**
+ * Lines 1415 <br>
+ * required (optional) - whether injection of service or services is
+ * required. Defaults to true.
+ * <p>
+ * b16 and b17 is defined as "@Reference(required=false)" and AComponent
+ * does not define reference for them
+ */
+ @Test
+ public void atReference7() throws Exception {
+ Assert.assertTrue(a.isB16Null());
+ Assert.assertTrue(a.isB17Null());
+ }
+
+ /**
+ * Java Component Implementation Spec
+ * Section 1.2.7
+ * Line 361 when @Property and @Reference annotations are present
+ * then unannotated fields are ignored
+ */
+ @Test
+ public void atReference8() throws Exception {
+ Assert.assertTrue(a.isB4Null());
+ Assert.assertTrue(a.isB5Null());
+ Assert.assertTrue(a.isB6Null());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/pom.xml
new file mode 100644
index 0000000000..d7de001183
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-scope</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @Scope</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/AService.java
new file mode 100644
index 0000000000..b7cf3fba71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/AService.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.vtest.javaapi.annotations.scope;
+
+
+/**
+ * Simple Service
+ */
+public interface AService {
+
+ public String getName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/BService.java
new file mode 100644
index 0000000000..7da9d29424
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/BService.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.vtest.javaapi.annotations.scope;
+
+/**
+ * Simple Service
+ */
+public interface BService {
+
+ public String getName();
+
+ public boolean isInitReady();
+
+ public String getCurrentState();
+
+ public String setCurrentState(String currentState);
+
+ public int getDestroyCalledCounter();
+
+ public int getInitCalledCounter();
+
+ public int getInstanceCounter();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/CService.java
new file mode 100644
index 0000000000..208c6a78b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/CService.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.vtest.javaapi.annotations.scope;
+
+/**
+ * Simple Service
+ */
+public interface CService {
+
+ public String getName();
+
+ public boolean isInitReady();
+
+ public String getCurrentState();
+
+ public String setCurrentState(String currentState);
+
+ public int getDestroyCalledCounter();
+
+ public int getInitCalledCounter();
+
+ public int getInstanceCounter();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/DService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/DService.java
new file mode 100644
index 0000000000..d4cedcc979
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/DService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface DService {
+
+ public String getName();
+
+ public boolean isInitReady();
+
+ public String getCurrentState();
+
+ public String setCurrentState(String currentState);
+
+ public int getDestroyCalledCounter();
+
+ public int getInitCalledCounter();
+
+ public int getInstanceCounter();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/FService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/FService.java
new file mode 100644
index 0000000000..7844ba7b62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/FService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface FService {
+
+ public String getName();
+
+ public boolean isInitReady();
+
+ public String getCurrentState();
+
+ public String setCurrentState(String currentState);
+
+ public int getDestroyCalledCounter();
+
+ public int getInitCalledCounter();
+
+ public int getInstanceCounter();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/GService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/GService.java
new file mode 100644
index 0000000000..7a047414dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/GService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface GService {
+
+ public String getName();
+
+ public int getInitCalledCounter();
+
+ public int getDestroyCalledCounter();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/HService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/HService.java
new file mode 100644
index 0000000000..555cdd5be0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/HService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface HService {
+
+ public String getName();
+
+ public String test();
+
+ public String testCounters(int n);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/IService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/IService.java
new file mode 100644
index 0000000000..79e20a3879
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/IService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Simple Service
+ */
+@Conversational
+public interface IService {
+
+ public String getName();
+
+ public boolean isInitReady();
+
+ public String getCurrentState();
+
+ public String getConversationId();
+
+ public String setCurrentState(String currentState);
+
+ public int getDestroyCalledCounter();
+
+ public int getInitCalledCounter();
+
+ public int getInstanceCounter();
+
+ @EndsConversation
+ public void endConversation();
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/JService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/JService.java
new file mode 100644
index 0000000000..95813f0e32
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/JService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface JService {
+
+ public String getName();
+
+ public String getFailedReason();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/KService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/KService.java
new file mode 100644
index 0000000000..b4c95965ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/KService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface KService {
+
+ public String getName();
+
+ public String callL1();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/LService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/LService.java
new file mode 100644
index 0000000000..5c0fc12fa3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/LService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface LService {
+
+ public String getName();
+
+ public String getCurrentState();
+
+ public String setCurrentState(String currentState);
+
+ public int getDestroyCalledCounter();
+
+ public int getInitCalledCounter();
+
+ public int getInstanceCounter();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/MService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/MService.java
new file mode 100644
index 0000000000..ab6a3f946a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/MService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface MService {
+
+ public String getName();
+
+ public String getFailedReason();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/NService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/NService.java
new file mode 100644
index 0000000000..c544bf6e02
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/NService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface NService {
+
+ public String getName();
+
+ public String callO1(int nthTime);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/OService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/OService.java
new file mode 100644
index 0000000000..0104030f2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/OService.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.vtest.javaapi.annotations.scope;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface OService {
+
+ public String getName();
+
+ public String getCurrentState();
+
+ public String setCurrentState(String currentState);
+
+ public int getDestroyCalledCounter();
+
+ public int getInitCalledCounter();
+
+ public int getInstanceCounter();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/AServiceImpl.java
new file mode 100644
index 0000000000..9c17b06b16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/AServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.AService;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ public String getName() {
+ return "AService";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/BServiceImpl.java
new file mode 100644
index 0000000000..2a8bd80e9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/BServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.BService;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Destroy;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ private static int instanceCounter = 0;
+
+ private static int initCalledCounter = 0;
+
+ private static int destroyCalledCounter = 0;
+
+ public AService a1;
+
+ public String p1;
+
+ private int currentInstanceId = 0;
+
+ public String currentState = null;
+
+ private boolean isInitReady = false;
+
+ public BServiceImpl() {
+ currentInstanceId = ++instanceCounter;
+ isInitReady = false;
+ }
+
+ @Reference
+ public void setA1(AService a1) {
+ this.a1 = a1;
+ }
+
+ @Property
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+
+ @Init
+ public void initBService() throws Exception {
+ initCalledCounter++;
+ if (p1.equals("p1") && a1.getName().equals("AService"))
+ isInitReady = true;
+ }
+
+ @Destroy
+ public void destroyBService() {
+ destroyCalledCounter++;
+ }
+
+ public String getName() {
+ return "BService" + currentInstanceId;
+ }
+
+ public AService getA1() {
+ return a1;
+ }
+
+ public String getP1() {
+ return p1;
+ }
+
+ public String getCurrentState() {
+ return currentState;
+ }
+
+ public String setCurrentState(String currentState) {
+ this.currentState = currentState;
+ return this.currentState;
+ }
+
+ public boolean isInitReady() {
+ return isInitReady;
+ }
+
+ public int getDestroyCalledCounter() {
+ return destroyCalledCounter;
+ }
+
+ public int getInitCalledCounter() {
+ return initCalledCounter;
+ }
+
+ public int getInstanceCounter() {
+ return instanceCounter;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/CServiceImpl.java
new file mode 100644
index 0000000000..c99f5f5e74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/CServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.CService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(CService.class)
+@Scope("STATELESS")
+public class CServiceImpl implements CService {
+
+ public static int instanceCounter = 0;
+
+ public static int initCalledCounter = 0;
+
+ public static int destroyCalledCounter = 0;
+
+ public AService a1;
+
+ public String p1;
+
+ public int currentInstanceId = 0;
+
+ public String currentState = null;
+
+ public boolean isInitReady = false;
+
+ public CServiceImpl() {
+ currentInstanceId = ++instanceCounter;
+ isInitReady = false;
+ }
+
+ @Reference
+ public void setA1(AService a1) {
+ this.a1 = a1;
+ }
+
+ @Property
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+
+ @Init
+ public void initCService() throws Exception {
+ initCalledCounter++;
+ if (p1.equals("p1") && a1.getName().equals("AService"))
+ isInitReady = true;
+ }
+
+ @Destroy
+ public void destroyCService() {
+ destroyCalledCounter++;
+ }
+
+ public String getName() {
+ return "CService" + currentInstanceId;
+ }
+
+ public AService getA1() {
+ return a1;
+ }
+
+ public String getP1() {
+ return p1;
+ }
+
+ public String getCurrentState() {
+ return currentState;
+ }
+
+ public String setCurrentState(String currentState) {
+ this.currentState = currentState;
+ return this.currentState;
+ }
+
+ public boolean isInitReady() {
+ return isInitReady;
+ }
+
+ public int getDestroyCalledCounter() {
+ return destroyCalledCounter;
+ }
+
+ public int getInitCalledCounter() {
+ return initCalledCounter;
+ }
+
+ public int getInstanceCounter() {
+ return instanceCounter;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/DServiceImpl.java
new file mode 100644
index 0000000000..cc41994106
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/DServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.DService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(DService.class)
+@Scope("REQUEST")
+public class DServiceImpl implements DService {
+
+ public static int instanceCounter = 0;
+
+ public static int initCalledCounter = 0;
+
+ public static int destroyCalledCounter = 0;
+
+ public AService a1;
+
+ public String p1;
+
+ public int currentInstanceId = 0;
+
+ public String currentState = null;
+
+ public boolean isInitReady = false;
+
+ public DServiceImpl() {
+ currentInstanceId = ++instanceCounter;
+ isInitReady = false;
+ }
+
+ @Reference
+ public void setA1(AService a1) {
+ this.a1 = a1;
+ }
+
+ @Property
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+
+ @Init
+ public void initDService() throws Exception {
+ initCalledCounter++;
+ if (p1.equals("p1") && a1.getName().equals("AService"))
+ isInitReady = true;
+ System.out.println("DService" + currentInstanceId + "->initDService");
+ }
+
+ @Destroy
+ public void destroyDService() {
+ destroyCalledCounter++;
+ System.out.println("DService" + currentInstanceId + "->destroyDService");
+ }
+
+ public String getName() {
+ return "DService" + currentInstanceId;
+ }
+
+ public AService getA1() {
+ return a1;
+ }
+
+ public String getP1() {
+ return p1;
+ }
+
+ public String getCurrentState() {
+ return currentState;
+ }
+
+ public String setCurrentState(String currentState) {
+ this.currentState = "DService" + currentInstanceId + "-" + currentState;
+ return this.currentState;
+ }
+
+ public boolean isInitReady() {
+ return isInitReady;
+ }
+
+ public int getDestroyCalledCounter() {
+ return destroyCalledCounter;
+ }
+
+ public int getInitCalledCounter() {
+ return initCalledCounter;
+ }
+
+ public int getInstanceCounter() {
+ return instanceCounter;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/FServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/FServiceImpl.java
new file mode 100644
index 0000000000..4fb7386484
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/FServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.FService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(FService.class)
+@Scope("COMPOSITE")
+public class FServiceImpl implements FService {
+
+ public static int instanceCounter = 0;
+
+ public static int initCalledCounter = 0;
+
+ public static int destroyCalledCounter = 0;
+
+ public AService a1;
+
+ public String p1;
+
+ public int currentInstanceId = 0;
+
+ public String currentState = null;
+
+ public boolean isInitReady = false;
+
+ public FServiceImpl() {
+ currentInstanceId = ++instanceCounter;
+ isInitReady = false;
+ }
+
+ @Reference
+ public void setA1(AService a1) {
+ this.a1 = a1;
+ }
+
+ @Property
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+
+ @Init
+ public void initFService() throws Exception {
+ initCalledCounter++;
+ if (p1.equals("p1") && a1.getName().equals("AService"))
+ isInitReady = true;
+ System.out.println("FService" + currentInstanceId + "->initFService");
+ }
+
+ @Destroy
+ public void destroyFService() {
+ destroyCalledCounter++;
+ System.out.println("FService" + currentInstanceId + "->destroyFService");
+ }
+
+ public String getName() {
+ return "FService" + currentInstanceId;
+ }
+
+ public AService getA1() {
+ return a1;
+ }
+
+ public String getP1() {
+ return p1;
+ }
+
+ public String getCurrentState() {
+ return currentState;
+ }
+
+ public String setCurrentState(String currentState) {
+ this.currentState = "FService" + currentInstanceId + "-" + currentState;
+ return this.currentState;
+ }
+
+ public boolean isInitReady() {
+ return isInitReady;
+ }
+
+ public int getDestroyCalledCounter() {
+ return destroyCalledCounter;
+ }
+
+ public int getInitCalledCounter() {
+ return initCalledCounter;
+ }
+
+ public int getInstanceCounter() {
+ return instanceCounter;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/GServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/GServiceImpl.java
new file mode 100644
index 0000000000..994469cb3a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/GServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.GService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.EagerInit;
+
+@Scope("COMPOSITE")
+@EagerInit
+public class GServiceImpl implements GService {
+
+ public static int initCalledCounter = 0;
+
+ public static int destroyCalledCounter = 0;
+
+ public AService a1;
+
+ public String p1;
+
+ @Init
+ public void initGService() throws Exception {
+ initCalledCounter++;
+ System.out.println("GService->initGService");
+ }
+
+ @Destroy
+ public void destroyGService() {
+ destroyCalledCounter++;
+ System.out.println("GService->destroyGService");
+ }
+
+ @Reference
+ public void setA1(AService a1) {
+ this.a1 = a1;
+ }
+
+ @Property
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+
+ public String getName() {
+ return "GService";
+ }
+
+ public int getInitCalledCounter() {
+ return initCalledCounter;
+ }
+
+ public int getDestroyCalledCounter() {
+ return destroyCalledCounter;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/HServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/HServiceImpl.java
new file mode 100644
index 0000000000..2fa610def7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/HServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.IService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.HService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(HService.class)
+public class HServiceImpl implements HService {
+
+ @Reference
+ public IService i1;
+
+ public String getName() {
+ return "HService";
+ }
+
+ public String test() {
+
+ String serviceName = i1.getName();
+ String conversationIdBefore = i1.getConversationId();
+
+ for (int i = 0; i < 10; i++) {
+ String newState = "state-" + i;
+ i1.setCurrentState(newState);
+ String currentState = i1.getCurrentState();
+ if (currentState == null || !currentState.equals(serviceName + "-" + newState)) {
+ i1.endConversation();
+ return "CurrentStateLost - " + currentState;
+ }
+ }
+
+ boolean isInitReady = i1.isInitReady();
+
+ String conversationIdAfter = i1.getConversationId();
+
+ i1.endConversation();
+
+ if (!isInitReady)
+ return "InitNotReady";
+
+ if (!conversationIdBefore.equals(conversationIdAfter))
+ return "DifferentConversationId";
+
+ return "None";
+ }
+
+ public String testCounters(int n) {
+ int instanceCounter = i1.getInstanceCounter();
+ int initCalledCounter = i1.getInitCalledCounter();
+ int destroyCalledCounter = i1.getDestroyCalledCounter();
+
+ System.out.println("instanceCounter=" + instanceCounter);
+ System.out.println("initCalledCounter=" + initCalledCounter);
+ System.out.println("destroyCalledCounter=" + destroyCalledCounter);
+
+ if (instanceCounter != n + 1)
+ return "IncorrectInstanceCounter";
+ if (initCalledCounter != n + 1)
+ return "IncorrectInitCalledCounter";
+ if (destroyCalledCounter != n)
+ return "IncorrectDestroyCalledCounter";
+
+ return "None";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/IServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/IServiceImpl.java
new file mode 100644
index 0000000000..12566dc5e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/IServiceImpl.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.IService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(IService.class)
+@Scope("CONVERSATION")
+public class IServiceImpl implements IService {
+
+ public static int instanceCounter = 0;
+
+ public static int initCalledCounter = 0;
+
+ public static int destroyCalledCounter = 0;
+
+ @ConversationID
+ protected String conversationId;
+
+ public int currentInstanceId = 0;
+
+ public AService a1;
+
+ public String p1;
+
+ public String currentState = null;
+
+ public boolean isInitReady = false;
+
+ public IServiceImpl() {
+ synchronized (IServiceImpl.class) {
+ currentInstanceId = ++instanceCounter;
+ }
+ isInitReady = false;
+ }
+
+ @Reference
+ public void setA1(AService a1) {
+ this.a1 = a1;
+ }
+
+ @Property
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+
+ @Init
+ public void initIService() throws Exception {
+ initCalledCounter++;
+ if (p1.equals("p1") && a1.getName().equals("AService"))
+ isInitReady = true;
+ System.out.println("IService" + currentInstanceId + "->initIService");
+ }
+
+ @Destroy
+ public void destroyIService() {
+ destroyCalledCounter++;
+ System.out.println("IService" + currentInstanceId + "->destroyIService");
+ }
+
+ public void endConversation() {
+ System.out.println("IService" + currentInstanceId + "->endConversation");
+ }
+
+ public String getName() {
+ return "IService" + currentInstanceId;
+ }
+
+ public AService getA1() {
+ return a1;
+ }
+
+ public String getP1() {
+ return p1;
+ }
+
+ public String getCurrentState() {
+ return currentState;
+ }
+
+ public String getConversationId() {
+ return conversationId;
+ }
+
+ public String setCurrentState(String currentState) {
+ this.currentState = "IService" + currentInstanceId + "-" + currentState;
+ return this.currentState;
+ }
+
+ public boolean isInitReady() {
+ return isInitReady;
+ }
+
+ public int getDestroyCalledCounter() {
+ return destroyCalledCounter;
+ }
+
+ public int getInitCalledCounter() {
+ return initCalledCounter;
+ }
+
+ public int getInstanceCounter() {
+ return instanceCounter;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/JServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/JServiceImpl.java
new file mode 100644
index 0000000000..a5851598a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/JServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.KService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.JService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(JService.class)
+@Scope("COMPOSITE")
+public class JServiceImpl implements JService {
+
+ @Reference
+ public KService k1;
+
+ public static String failedReason = "";
+
+ public static Timer aTimer = null;
+
+ @Init
+ public void initJService() throws Exception {
+ aTimer = new Timer();
+ aTimer.schedule(new JTimerTask(), 1000);
+ System.out.println("JService->initJService");
+ }
+
+ @Destroy
+ public void destroyJService() {
+ aTimer.cancel();
+ System.out.println("JService->destroyJService");
+ }
+
+ public String getName() {
+ return "JService";
+ }
+
+ public String getFailedReason() {
+ return failedReason;
+ }
+
+ private class JTimerTask extends TimerTask {
+
+ public boolean cancel() {
+ return true;
+ }
+
+ public void run() {
+ String result = k1.callL1();
+ if (!result.equals("None"))
+ failedReason = failedReason + ";" + result;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/KServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/KServiceImpl.java
new file mode 100644
index 0000000000..7088562c57
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/KServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.KService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.LService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(KService.class)
+@Scope("STATELESS")
+public class KServiceImpl implements KService {
+
+ public static int instanceCounter = 0;
+
+ public String previousL1Name = null;
+
+ public int currentInstanceId = 0;
+
+ @Reference
+ public LService l1;
+
+ public KServiceImpl() {
+ currentInstanceId = ++instanceCounter;
+ }
+
+
+ public String getName() {
+ return "KService"+currentInstanceId;
+ }
+
+ public String callL1() {
+
+ for (int i = 1; i < 11; i++) {
+ System.out.println(getName() + " calls LService " + i + (i == 1 ? "st time:" : (i == 2 ? "nd time:" : (i == 3 ? "rd time:" : "th time"))));
+
+ String serviceName = l1.getName();
+ for (int j = 0; j < 10; j++) {
+ String newState = "state-" + j;
+ l1.setCurrentState(newState);
+ String currentState = l1.getCurrentState();
+ if (!currentState.equals(serviceName + "-" + newState)) {
+ return "CurrentStateLost - " + currentState;
+ }
+ }
+
+ System.out.print(" Name=" + serviceName);
+ System.out.print(", #Instance=" + l1.getInstanceCounter());
+ System.out.print(", #InitCalled=" + l1.getInitCalledCounter());
+ System.out.println(", #DestroyCalled=" + l1.getDestroyCalledCounter());
+
+ if (previousL1Name == null) {
+ previousL1Name = serviceName;
+ } else {
+ if (!previousL1Name.equals(serviceName))
+ return "DifferentLServiceInstance";
+ }
+ }
+ return "None";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/LServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/LServiceImpl.java
new file mode 100644
index 0000000000..274e0570d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/LServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.LService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(LService.class)
+@Scope("REQUEST")
+public class LServiceImpl implements LService {
+
+ public static int instanceCounter = 0;
+
+ public static int initCalledCounter = 0;
+
+ public static int destroyCalledCounter = 0;
+
+ public int currentInstanceId = 0;
+
+ public String currentState = null;
+
+ public LServiceImpl() {
+ currentInstanceId = ++instanceCounter;
+ }
+
+ @Init
+ public void initLService() throws Exception {
+ initCalledCounter++;
+ System.out.println("LService" + currentInstanceId + "->initLService");
+ }
+
+ @Destroy
+ public void destroyLService() {
+ destroyCalledCounter++;
+ System.out.println("LService" + currentInstanceId + "->destroyLService");
+ }
+
+ public String getName() {
+ return "LService" + currentInstanceId;
+ }
+
+ public String getCurrentState() {
+ return currentState;
+ }
+
+ public String setCurrentState(String currentState) {
+ this.currentState = "LService" + currentInstanceId + "-" + currentState;
+ return this.currentState;
+ }
+
+ public int getDestroyCalledCounter() {
+ return destroyCalledCounter;
+ }
+
+ public int getInitCalledCounter() {
+ return initCalledCounter;
+ }
+
+ public int getInstanceCounter() {
+ return instanceCounter;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/MServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/MServiceImpl.java
new file mode 100644
index 0000000000..681b0b3776
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/MServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.MService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.NService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(MService.class)
+@Scope("COMPOSITE")
+public class MServiceImpl implements MService {
+
+ @Reference
+ public NService n1;
+
+ public static String failedReason = "";
+
+ public static Timer aTimer = null;
+
+ public static int counter = 0;
+
+ @Init
+ public void initMService() throws Exception {
+ aTimer = new Timer();
+ aTimer.schedule(new MTimerTask(), 1000, 1000);
+ System.out.println("MService->initMService");
+ }
+
+ @Destroy
+ public void destroyMService() {
+ aTimer.cancel();
+ System.out.println("MService->destroyMService");
+ }
+
+ public String getName() {
+ return "MService";
+ }
+
+ public String getFailedReason() {
+ return failedReason;
+ }
+
+ private class MTimerTask extends TimerTask {
+
+ public boolean cancel() {
+ return true;
+ }
+
+ public void run() {
+ counter++;
+ String result = n1.callO1(counter);
+ if (!result.equals("None"))
+ failedReason = failedReason + ";" + result;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/NServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/NServiceImpl.java
new file mode 100644
index 0000000000..98b94a33c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/NServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.NService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.OService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(NService.class)
+@Scope("STATELESS")
+public class NServiceImpl implements NService {
+
+ public static int instanceCounter = 0;
+
+ public String previousL1Name = null;
+
+ public int currentInstanceId = 0;
+
+ @Reference
+ public OService o1;
+
+ public NServiceImpl() {
+ currentInstanceId = ++instanceCounter;
+ }
+
+
+ public String getName() {
+ return "NService"+currentInstanceId;
+ }
+
+ public String callO1(int nthTime) {
+
+ for (int i = 1; i < 11; i++) {
+ System.out.println(getName() + " calls OService " + i + (i == 1 ? "st time:" : (i == 2 ? "nd time:" : (i == 3 ? "rd time:" : "th time"))));
+
+ String serviceName = o1.getName();
+ for (int j = 0; j < 10; j++) {
+ String newState = "state-" + j;
+ o1.setCurrentState(newState);
+ String currentState = o1.getCurrentState();
+ if (!currentState.equals(serviceName + "-" + newState)) {
+ return "CurrentStateLost - " + currentState;
+ }
+ }
+
+ System.out.print(" Name=" + serviceName);
+ System.out.print(", #Instance=" + o1.getInstanceCounter());
+ System.out.print(", #InitCalled=" + o1.getInitCalledCounter());
+ System.out.println(", #DestroyCalled=" + o1.getDestroyCalledCounter());
+
+ if (previousL1Name == null) {
+ previousL1Name = serviceName;
+ } else {
+ if (!previousL1Name.equals(serviceName))
+ return "DifferentOServiceInstance";
+ }
+
+ }
+
+ if (o1.getInstanceCounter() < nthTime) {
+ return "SharedSameInstance";
+ }
+
+ return "None";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/OServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/OServiceImpl.java
new file mode 100644
index 0000000000..8cf39a072c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/OServiceImpl.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.vtest.javaapi.annotations.scope.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.OService;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Scope;
+
+@Service(OService.class)
+@Scope("REQUEST")
+public class OServiceImpl implements OService {
+
+ public static int instanceCounter = 0;
+
+ public static int initCalledCounter = 0;
+
+ public static int destroyCalledCounter = 0;
+
+ public int currentInstanceId = 0;
+
+ public String currentState = null;
+
+ public OServiceImpl() {
+ currentInstanceId = ++instanceCounter;
+ }
+
+ @Init
+ public void initOService() throws Exception {
+ initCalledCounter++;
+ System.out.println("OService" + currentInstanceId + "->initOService");
+ }
+
+ @Destroy
+ public void destroyOService() {
+ destroyCalledCounter++;
+ System.out.println("OService" + currentInstanceId + "->destroyOService");
+ }
+
+ public String getName() {
+ return "OService" + currentInstanceId;
+ }
+
+ public String getCurrentState() {
+ return currentState;
+ }
+
+ public String setCurrentState(String currentState) {
+ this.currentState = "OService" + currentInstanceId + "-" + currentState;
+ return this.currentState;
+ }
+
+ public int getDestroyCalledCounter() {
+ return destroyCalledCounter;
+ }
+
+ public int getInitCalledCounter() {
+ return initCalledCounter;
+ }
+
+ public int getInstanceCounter() {
+ return instanceCounter;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/resources/scope.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/resources/scope.composite
new file mode 100644
index 0000000000..7c195b2b5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/main/resources/scope.composite
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Scope-Composite">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.AServiceImpl" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.BServiceImpl" />
+ <reference name="a1" target="AComponent"/>
+ <property name="p1">p1</property>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.CServiceImpl" />
+ <reference name="a1" target="AComponent"/>
+ <property name="p1">p1</property>
+ </component>
+
+ <component name="DComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.DServiceImpl" />
+ <reference name="a1" target="AComponent"/>
+ <property name="p1">p1</property>
+ </component>
+
+ <component name="FComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.FServiceImpl" />
+ <reference name="a1" target="AComponent"/>
+ <property name="p1">p1</property>
+ </component>
+
+ <component name="GComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.GServiceImpl" />
+ <reference name="a1" target="AComponent"/>
+ <property name="p1">p1</property>
+ </component>
+
+ <component name="HComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.HServiceImpl" />
+ <reference name="i1" target="IComponent"/>
+ </component>
+
+ <component name="IComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.IServiceImpl" />
+ <reference name="a1" target="AComponent"/>
+ <property name="p1">p1</property>
+ </component>
+
+ <component name="JComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.JServiceImpl" />
+ <reference name="k1" target="KComponent"/>
+ </component>
+
+ <component name="KComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.KServiceImpl" />
+ <reference name="l1" target="LComponent"/>
+ </component>
+
+ <component name="LComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.LServiceImpl" />
+ </component>
+
+ <component name="MComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.MServiceImpl" />
+ <reference name="n1" target="NComponent"/>
+ </component>
+
+ <component name="NComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.NServiceImpl" />
+ <reference name="o1" target="OComponent"/>
+ </component>
+
+ <component name="OComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl.OServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/ScopeAnnotationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/ScopeAnnotationTestCase.java
new file mode 100644
index 0000000000..9821af4a27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/scope/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/ScopeAnnotationTestCase.java
@@ -0,0 +1,477 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.annotations.scope;
+
+import java.util.ArrayList;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test class tests the Scope annotation described in section 1.2.4
+ * including 1.8.7, 1.8.8, 1.8.9, 1.8.10, 1.8.11, and 1.8.16<br>
+ * <p>
+ * Check following:<br>
+ * <li>Number of service instances be created</li>
+ * <li>Init method be called and where all property and reference injection is
+ * complete.</li>
+ * <li>Destroy method be called</li>
+ * <li>State be preserved in request and conversation scopes but not others</li>
+ */
+public class ScopeAnnotationTestCase {
+
+ protected static String compositeName = "scope.composite";
+
+ protected static int numDThread = 5;
+ protected static int numFThread = 5;
+ protected static int numHThread = 5;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Line 259:<br>
+ * <li>STATELESS</li>
+ * <p>
+ * Line 284:<br>
+ * For stateless components, there is no implied correlation between
+ * service requests.<br>
+ * <p>
+ * Line 1589 to 1591:<br>
+ * The default value is 'STATELESS'. For 'STATELESS' implementations,
+ * a different implementation instance may be used to service each request.
+ * Implementation instances may be newly created or be drawn from a pool
+ * of instances.<br>
+ * <p>
+ * BComponent is not defined '@Scope'<br>
+ * CComponent is defined '@Scope("STATELESS")'<br>
+ * <p>
+ */
+ @Test
+ public void atScope1() throws Exception {
+ System.out.println("atScope1");
+ BThread b1 = new BThread("ThreadB1");
+ BThread b2 = new BThread("ThreadB2");
+ CThread c1 = new CThread("ThreadC1");
+ CThread c2 = new CThread("ThreadC2");
+
+ b1.start();
+ b2.start();
+ c1.start();
+ c2.start();
+ b1.join();
+ b2.join();
+ c1.join();
+ c2.join();
+
+ System.out.println("");
+
+ Assert.assertEquals("None", b1.failedReason);
+ Assert.assertEquals("None", b2.failedReason);
+ Assert.assertEquals("None", c1.failedReason);
+ Assert.assertEquals("None", c2.failedReason);
+ }
+
+ /**
+ * Line 260:<br>
+ * <li>REQUEST</li>
+ * <p>
+ * Lines 286 to 289:<br>
+ * The lifecycle of request scope extends from the point a request on a
+ * remotable interface enters the SCA runtime and a thread processes that
+ * request until the thread completes synchronously processing the request.
+ * During that time, all service requests will be delegated to the same
+ * implementation instance of a request-scoped component.<br>
+ * <p>
+ */
+ @Test
+ public void atScope2() throws Exception {
+ System.out.println("atScope2");
+ ArrayList<DThread> d = new ArrayList<DThread>();
+ for (int i = 0; i < numDThread; i++)
+ d.add(new DThread("ThreadD"+i));
+ for (int i = 0; i < numDThread; i++)
+ d.get(i).start();
+ for (int i = 0; i < numDThread; i++)
+ d.get(i).join();
+ System.out.println("");
+ for (int i = 0; i < numDThread; i++)
+ Assert.assertEquals("None", d.get(i).failedReason);
+ }
+
+ /**
+ * Line 262:<br>
+ * <li>COMPOSITE</li>
+ * <p>
+ * Lines 296 to 298:<br>
+ * All service requests are dispatched to the same implementation instance
+ * for the lifetime of the containing composite. The lifetime of the
+ * containing composite is defined as the time it becomes active in the
+ * runtime to the time it is deactivated, either normally or abnormally.<br>
+ * <p>
+ * Following lines should be found at System out<br>
+ * atScope3 - Cleaning up<br>
+ * FService1->destroyFService
+ */
+ @Test
+ public void atScope3() throws Exception {
+ System.out.println("atScope3");
+ FService fService = ServiceFinder.getService(FService.class, "FComponent");
+ String serviceName = fService.getName();
+ boolean isInitReady = fService.isInitReady();
+
+ ArrayList<FThread> f = new ArrayList<FThread>();
+ for (int i = 0; i < numFThread; i++)
+ f.add(new FThread("ThreadF"+i));
+ for (int i = 0; i < numFThread; i++)
+ f.get(i).start();
+ for (int i = 0; i < numFThread; i++)
+ f.get(i).join();
+ for (int i = 0; i < numFThread; i++) {
+ Assert.assertEquals(serviceName, f.get(i).serviceName);
+ }
+
+ int instanceCounter = fService.getInstanceCounter();
+ int initCalledCounter = fService.getInitCalledCounter();
+ int destroyCalledCounter = fService.getDestroyCalledCounter();
+ System.out.println("");
+
+ Assert.assertTrue(isInitReady);
+ Assert.assertEquals(1, instanceCounter);
+ Assert.assertEquals(1, initCalledCounter);
+ Assert.assertEquals(0, destroyCalledCounter);
+ }
+
+ /**
+ * Lines 299 to 302:<br>
+ * A composite scoped implementation may also specify eager initialization
+ * using the "@EagerInit" annotation. When marked for eager initialization,
+ * the composite scoped instance will be created when its containing
+ * component is started. If a method is marked with the "@Init" annotation,
+ * it will be called when the instance is created.<p>
+ * Section 1.8.9 "@EagerInit"<br>
+ * <p>
+ * GService is defined as eager initialization. It will be initialized
+ * when calls SCADomain.newInstance(compositeName), so the
+ * initCalledCounter is 1.
+ */
+ @Test
+ public void atScope4() throws Exception {
+ System.out.println("atScope4");
+
+ GService gService = ServiceFinder.getService(GService.class, "GComponent");
+ int initCalledCounter = gService.getInitCalledCounter();
+ int destroyCalledCounter = gService.getDestroyCalledCounter();
+
+ System.out.println("initCalledCounter="+ initCalledCounter);
+ System.out.println("destroyCalledCounter="+ destroyCalledCounter);
+ System.out.println("");
+
+ Assert.assertEquals(1, initCalledCounter);
+ Assert.assertEquals(0, destroyCalledCounter);
+ }
+
+ /**
+ * Line 261:<br>
+ * <li>CONVERSATION</li>
+ * <p>
+ * Lines 305 to 310:<br>
+ * A conversation is defined as a series of correlated interactions between
+ * a client and a target service. A conversational scope starts when the
+ * first service request is dispatched to an implementation instance
+ * offering a conversational service. A conversational scope completes
+ * after an end operation defined by the service contract is called and
+ * completes processing or the conversation expires. A conversation may be
+ * long-running and the SCA runtime may choose to passivate implementation
+ * instances. If this occurs, the runtime must guarantee implementation
+ * instance state is preserved.
+ */
+ @Test
+ public void atScope5() throws Exception {
+ System.out.println("atScope5");
+
+ ArrayList<HThread> g = new ArrayList<HThread>();
+ for (int i = 0; i < numHThread; i++)
+ g.add(new HThread("ThreadH"+i));
+ for (int i = 0; i < numHThread; i++)
+ g.get(i).start();
+ for (int i = 0; i < numHThread; i++)
+ g.get(i).join();
+
+ HService hService = ServiceFinder.getService(HService.class, "HComponent");
+ String failedReason = hService.testCounters(numHThread);
+ System.out.println("");
+
+ for (int i = 0; i < numHThread; i++)
+ Assert.assertEquals("None", g.get(i).failedReason);
+ Assert.assertEquals("None", failedReason);
+ }
+
+ /** Lines 290 to 293:<br>
+ * There are times when a local request scoped service is called without
+ * there being a remotable service earlier in the call stack, such as when
+ * a local service is called from a non-SCA entity. In these cases, a
+ * remote request is always considered to be present, but the lifetime of
+ * the request is implementation dependent. For example, a timer event
+ * could be treated as a remote request..<br>
+ * <p>
+ * When the composite runs, composite scope service JService kicks off a
+ * timer by the @Init method. When the timer expires, JService invokes a
+ * method that calls an operation on the reference to a stateless scope
+ * sevice KService. KService calls a request scope service LService
+ * multiple times. The results of the calls to LService should be set up to
+ * differ depending on whether the same instance is called each time -
+ * without the interface being declared Conversational.<br>
+ * <p>
+ */
+ @Test
+ public void atScope6() throws Exception {
+ System.out.println("atScope6");
+
+ JService jService = ServiceFinder.getService(JService.class, "JComponent");
+ jService.getName();
+ Thread.sleep(2000);
+ String failedReason = jService.getFailedReason();
+ System.out.println("");
+
+ Assert.assertEquals("", failedReason);
+ }
+
+ /**
+ * Same as atScope6 but the timer triggers KService multiple times.<br>
+ */
+ @Test
+ @Ignore
+ // JIRA T-2256
+ public void atScope7() throws Exception {
+ System.out.println("atScope7");
+
+ MService mService = ServiceFinder.getService(MService.class, "MComponent");
+ mService.getName();
+ Thread.sleep(6000);
+ String failedReason = mService.getFailedReason();
+ System.out.println("");
+
+ Assert.assertEquals("", failedReason);
+ }
+
+ private class BThread extends Thread {
+ private String name = null;
+ public String failedReason = "Unknown";
+
+ public BThread(String name) {
+ super();
+ this.name = name;
+ failedReason = "Unknown";
+ }
+
+ @Override
+ public void run() {
+ BService bService = ServiceFinder.getService(BService.class, "BComponent");
+ bService.setCurrentState(name + "-state-1");
+ System.out.println(name + "->" + bService.getName());
+ if (!bService.isInitReady()) {
+ failedReason = "InitNotReady";
+ return;
+ }
+ if (bService.getCurrentState() != null) {
+ failedReason = "CurrentStateNotNull";
+ return;
+ }
+ int counter = bService.getInstanceCounter();
+ if (counter < 2) {
+ failedReason = "OnlyOneInstance - " + counter;
+ return;
+ }
+ counter = bService.getInitCalledCounter();
+ if (counter < 2) {
+ failedReason = "InitBeCalledOnce - " + counter;
+ return;
+ }
+ counter = bService.getDestroyCalledCounter();
+ if (counter < 2) {
+ failedReason = "DestroyBeCalledOnce - " + counter;
+ return;
+ }
+ failedReason = "None";
+ }
+ }
+
+ private class CThread extends Thread {
+ private String name = null;
+ public String failedReason = "Unknown";
+
+ public CThread(String name) {
+ super();
+ this.name = name;
+ failedReason = "Unknown";
+ }
+
+ @Override
+ public void run() {
+ CService cService = ServiceFinder.getService(CService.class, "CComponent");
+ cService.setCurrentState(name + "-state-1");
+ System.out.println(name + "->" + cService.getName());
+ if (!cService.isInitReady()) {
+ failedReason = "InitNotReady";
+ return;
+ }
+ if (cService.getCurrentState() != null) {
+ failedReason = "CurrentStateNotNull";
+ return;
+ }
+ int counter = cService.getInstanceCounter();
+ if (counter < 2) {
+ failedReason = "OnlyOneInstance - " + counter;
+ return;
+ }
+ counter = cService.getInitCalledCounter();
+ if (counter < 2) {
+ failedReason = "InitBeCalledOnce - " + counter;
+ return;
+ }
+ counter = cService.getDestroyCalledCounter();
+ if (counter < 2) {
+ failedReason = "DestroyBeCalledOnce - " + counter;
+ return;
+ }
+ failedReason = "None";
+ }
+ }
+
+ private class DThread extends Thread {
+
+ private String name = null;
+ public String failedReason = "Unknown";
+
+ public DThread(String name) {
+ super();
+ this.name = name;
+ failedReason = "Unknown";
+ }
+
+ @Override
+ public void run() {
+ DService dService = ServiceFinder.getService(DService.class, "DComponent");
+ String serviceName = dService.getName();
+ System.out.println(name + "->" + serviceName);
+
+ for (int i = 0; i < 10; i++) {
+ String newState = name + "-state-" + i;
+ dService.setCurrentState(newState);
+ String currentState = dService.getCurrentState();
+ if (!currentState.equals(serviceName + "-" + newState)) {
+ failedReason = "CurrentStateLost - " + currentState;
+ return;
+ }
+ }
+
+ if (!dService.isInitReady()) {
+ failedReason = "InitNotReady";
+ return;
+ }
+
+ int counter = dService.getInstanceCounter();
+ if (counter > numDThread) {
+ failedReason = "TooMuchInstance - " + counter;
+ return;
+ }
+
+ counter = dService.getInitCalledCounter();
+ if (counter > numDThread) {
+ failedReason = "InitBeCalledTooMuch - " + counter;
+ return;
+ }
+
+ // JIRA T-2215
+ /* Don't know when destroy method be called
+ counter = dService.getDestroyCalledCounter();
+ if (counter > numDThreads) {
+ failedReason = "DestroyBeCalledTooMuch - " + counter;
+ return;
+ }
+ */
+ failedReason = "None";
+ }
+ }
+
+ private class FThread extends Thread {
+
+ private String name = null;
+
+ public String serviceName = null;
+
+ public FThread(String name) {
+ super();
+ this.name = name;
+ }
+
+ @Override
+ public void run() {
+ FService fService = ServiceFinder.getService(FService.class, "FComponent");
+ serviceName = fService.getName();
+ System.out.println(name + "->" + serviceName);
+
+ for (int i = 0; i < 10; i++) {
+ String newState = name + "-state-" + i;
+ fService.setCurrentState(newState);
+ fService.getCurrentState();
+ }
+ }
+ }
+
+ private class HThread extends Thread {
+
+ public String failedReason = "Unknown";
+
+ public HThread(String name) {
+ super();
+ failedReason = "Unknown";
+ }
+
+ @Override
+ public void run() {
+ HService hService = ServiceFinder.getService(HService.class, "HComponent");
+ failedReason = hService.test();
+ }
+ }
+
+}
+
+
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/pom.xml
new file mode 100644
index 0000000000..a5162ea4d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-annotations-service</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Annotations - @Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/AService.java
new file mode 100644
index 0000000000..a923faf5ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/AService.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.vtest.javaapi.annotations.service;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.AObject;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+public interface AService {
+
+ public String getName();
+
+ public String setAObject(AObject a);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/BService.java
new file mode 100644
index 0000000000..26bcf3b9db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/BService.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.vtest.javaapi.annotations.service;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.AObject;
+
+/**
+ * Simple Local Service
+ */
+public interface BService {
+
+ public String getName();
+
+ public String setAObject(AObject a);
+
+ public String testServices();
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/CService.java
new file mode 100644
index 0000000000..4f4f1e80c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/CService.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.vtest.javaapi.annotations.service;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.AObject;
+
+/**
+ * Simple Local Service without defining "@Service" at the implementation class
+ */
+public interface CService {
+
+ public String getName();
+
+ public String setAObject(AObject a);
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService1.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService1.java
new file mode 100644
index 0000000000..ffabb3619c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService1.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.vtest.javaapi.annotations.service;
+
+/**
+ * Simple Local Service
+ */
+public interface DService1 {
+
+ public String getName1();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService2.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService2.java
new file mode 100644
index 0000000000..83d7980dbc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService2.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.vtest.javaapi.annotations.service;
+
+/**
+ * Simple Local Service
+ */
+public interface DService2 {
+
+ public String getName2();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService3.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService3.java
new file mode 100644
index 0000000000..a416e33de7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/DService3.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.vtest.javaapi.annotations.service;
+
+/**
+ * Simple Local Service
+ */
+public interface DService3 {
+
+ public String getName3();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/EService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/EService.java
new file mode 100644
index 0000000000..ad44d2b93a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/EService.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.vtest.javaapi.annotations.service;
+
+/**
+ * Simple Local Service which implementation class defines
+ *
+ * @Service() with no attributes
+ */
+public interface EService {
+
+ public String getName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/FService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/FService.java
new file mode 100644
index 0000000000..52886131a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/FService.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.vtest.javaapi.annotations.service;
+
+/**
+ * Simple Local Service which implementation class defines
+ *
+ * @Service with full package name
+ */
+public interface FService {
+
+ public String getName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/GService1.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/GService1.java
new file mode 100644
index 0000000000..bd1a3a5fe6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/GService1.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.vtest.javaapi.annotations.service;
+
+/**
+ * Simple Local Service
+ */
+public interface GService1 {
+
+ public String getName();
+
+ public String getServiceName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/GService2.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/GService2.java
new file mode 100644
index 0000000000..0f8c7dabcb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/GService2.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.vtest.javaapi.annotations.service;
+
+/**
+ * Simple Local Service
+ */
+public interface GService2 extends GService1 {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/HService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/HService.java
new file mode 100644
index 0000000000..e50e230bd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/HService.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.vtest.javaapi.annotations.service;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.AObject;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+public interface HService {
+
+ public String getName();
+
+ public String setAObject1(AObject a);
+
+ public String setAObject2(AObject a);
+
+ public String getComponentName();
+
+ public String getAObject1String();
+
+ public String getAObject2String();
+
+ public String getAObject3String();
+
+ public AObject getAObject3();
+
+ public String getServiceName1();
+
+ public String getServiceName2();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/IService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/IService.java
new file mode 100644
index 0000000000..e3a1462f88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/IService.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.vtest.javaapi.annotations.service;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.AObject;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+public interface IService {
+
+ public String getName();
+
+ public String setAObject1(AObject a);
+
+ public String setAObject2(AObject a);
+
+ public void setComponentName1(String componentName1);
+
+ public String getComponentName1();
+
+ public String getComponentName2();
+
+ public String getAObject1String();
+
+ public String getAObject2String();
+
+ public String getAObject3String();
+
+ public AObject getAObject3();
+
+ public String getServiceName1();
+
+ public String getServiceName2();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/AObject.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/AObject.java
new file mode 100644
index 0000000000..0ab2e29194
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/AObject.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.vtest.javaapi.annotations.service.impl;
+
+/**
+ * A simple object to hold a string
+ */
+public class AObject {
+
+ public String aString;
+
+ public AObject() {
+ this.aString = null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/AServiceImpl.java
new file mode 100644
index 0000000000..7ce2235719
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/AServiceImpl.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.vtest.javaapi.annotations.service.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.AService;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String setAObject(AObject a) {
+ a.aString = "AService";
+ return "AService";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/BServiceImpl.java
new file mode 100644
index 0000000000..9c3f15743c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/BServiceImpl.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.vtest.javaapi.annotations.service.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.AService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.BService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.CService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.HService;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.IService;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Reference;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ @Reference(required=false)
+ public AService aService = null;
+
+ @Reference(required=false)
+ public CService cService = null;
+
+ @Reference(required=false)
+ public HService hService = null;
+
+ @Reference(required=false)
+ public IService iService = null;
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String setAObject(AObject a) {
+ a.aString = "BService";
+ return "BService";
+ }
+
+ public String testServices() {
+
+ AObject a = new AObject();
+ aService.setAObject(a);
+ if (a.aString != null)
+ return "AServiceNotPassByValue";
+
+ AObject c = new AObject();
+ cService.setAObject(c);
+ if (c.aString == null || !c.aString.equals("CService"))
+ return "CServiceNotPassByReference";
+
+
+ AObject h1 = new AObject();
+ hService.setAObject1(h1);
+ if (h1.aString == null || !h1.aString.equals("HService"))
+ return "HServiceSetAObject1NotPassByReference";
+ h1.aString = "testServices";
+ if (!hService.getAObject1String().equals("testServices"))
+ return "HServiceGetAObject1NotPassByReference";
+
+ AObject h2 = new AObject();
+ hService.setAObject2(h2);
+ if (h2.aString != null)
+ return "HServiceSetAObject2NotPassByValue";
+ h2.aString = "testServices";
+ if (!hService.getAObject2String().equals("HService"))
+ return "HServiceGetAObject1NotPassByValue";
+
+ AObject h3 = hService.getAObject3();
+ h3.aString = "testServices";
+ if (!hService.getAObject3String().equals("HService"))
+ return "HServiceGetAObject3NotPassByValue";
+
+ AObject i1 = new AObject();
+ iService.setAObject1(i1);
+ if (i1.aString == null || !i1.aString.equals("IService"))
+ return "IServiceSetAObject1NotPassByReference";
+ i1.aString = "testServices";
+ if (!iService.getAObject1String().equals("testServices"))
+ return "IServiceGetAObject1NotPassByReference";
+
+ AObject i2 = new AObject();
+ iService.setAObject2(i2);
+ if (i2.aString == null || !i2.aString.equals("IService"))
+ return "IServiceSetAObject2NotPassByReference";
+ i2.aString = "testServices";
+ if (!iService.getAObject2String().equals("testServices"))
+ return "IServiceGetAObject2NotPassByReference";
+
+ AObject i3 = iService.getAObject3();
+ i3.aString = "testServices";
+ if (!iService.getAObject3String().equals("testServices"))
+ return "IServiceGetAObject3NotPassByReference";
+
+ return "None";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/CServiceImpl.java
new file mode 100644
index 0000000000..3fc23d2f68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/CServiceImpl.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.vtest.javaapi.annotations.service.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.CService;
+
+public class CServiceImpl implements CService {
+
+ public String getName() {
+ return "CService";
+ }
+
+ public String setAObject(AObject a) {
+ a.aString = "CService";
+ return "CService";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/DServiceImpl.java
new file mode 100644
index 0000000000..4cc9430c74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/DServiceImpl.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.vtest.javaapi.annotations.service.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.DService1;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.DService2;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.DService3;
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces = {DService1.class, DService2.class})
+public class DServiceImpl implements DService1, DService2, DService3 {
+
+ public String getName1() {
+ return "DService1";
+ }
+
+ public String getName2() {
+ return "DService2";
+ }
+
+ public String getName3() {
+ return "DService3";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/EServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/EServiceImpl.java
new file mode 100644
index 0000000000..a64d434a46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/EServiceImpl.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.vtest.javaapi.annotations.service.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.EService;
+import org.osoa.sca.annotations.Service;
+
+@Service()
+public class EServiceImpl implements EService {
+
+ public String getName() {
+ return "EService";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/FServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/FServiceImpl.java
new file mode 100644
index 0000000000..49f34738ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/FServiceImpl.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.vtest.javaapi.annotations.service.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.FService;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(org.apache.tuscany.sca.vtest.javaapi.annotations.service.FService.class)
+public class FServiceImpl implements FService {
+
+ @Context
+ public RequestContext requestContext;
+
+ public String getName() {
+ return requestContext.getServiceName();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/FServiceImpl2.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/FServiceImpl2.java
new file mode 100644
index 0000000000..46370b7e19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/FServiceImpl2.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.vtest.javaapi.annotations.service.impl;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(FServiceImpl2.class)
+public class FServiceImpl2 extends FServiceImpl {
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/GServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/GServiceImpl.java
new file mode 100644
index 0000000000..a86d6e1da0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/GServiceImpl.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.vtest.javaapi.annotations.service.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.GService1;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.GService2;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.RequestContext;
+
+@Service(interfaces = {GService1.class, GService2.class})
+public class GServiceImpl implements GService1 {
+
+ @Context
+ public RequestContext requestContext;
+
+ public String getName() {
+ return "GService";
+ }
+
+ public String getServiceName() {
+ return requestContext.getServiceName();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/HServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/HServiceImpl.java
new file mode 100644
index 0000000000..ac525ea669
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/HServiceImpl.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.vtest.javaapi.annotations.service.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.HService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+@Service(HService.class)
+@Scope("REQUEST")
+public class HServiceImpl implements HService {
+
+ @ComponentName
+ protected String componentName;
+
+ private AObject aObject1 = null;
+
+ private AObject aObject2 = null;
+
+ private AObject aObject3 = null;
+
+ public RequestContext requestContext;
+
+ public ComponentContext componentContext;
+
+ public String getName() {
+ return "HService";
+ }
+
+ @AllowsPassByReference
+ public String setAObject1(AObject a) {
+ a.aString = "HService";
+ aObject1 = a;
+ return "HService";
+ }
+
+ public String setAObject2(AObject a) {
+ a.aString = "HService";
+ aObject2 = a;
+ return "HService";
+ }
+
+ @Context
+ public void setComponentContext(ComponentContext componentContext) {
+ this.componentContext = componentContext;
+ }
+
+ @Context
+ public void setRequestContext(RequestContext requestContext) {
+ this.requestContext = requestContext;
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public String getAObject1String() {
+ return aObject1.aString;
+ }
+
+ public String getAObject2String() {
+ return aObject2.aString;
+ }
+
+ public String getAObject3String() {
+ return aObject3.aString;
+ }
+
+ public AObject getAObject3() {
+ aObject3 = new AObject();
+ aObject3.aString = "HService";
+ return aObject3;
+ }
+
+ public String getServiceName1() {
+ return requestContext.getServiceName();
+ }
+
+ public String getServiceName2() {
+ return componentContext.getRequestContext().getServiceName();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/IServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/IServiceImpl.java
new file mode 100644
index 0000000000..f2760b96ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/impl/IServiceImpl.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.vtest.javaapi.annotations.service.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.IService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(IService.class)
+@Scope("REQUEST")
+@AllowsPassByReference
+public class IServiceImpl implements IService {
+
+ @ComponentName
+ public String componentName1;
+
+ public String componentName2;
+
+ private AObject aObject1 = null;
+
+ private AObject aObject2 = null;
+
+ private AObject aObject3 = null;
+
+ @Context
+ public RequestContext requestContext;
+
+ @Context
+ public ComponentContext componentContext;
+
+ public String getName() {
+ return "IService";
+ }
+
+ public String setAObject1(AObject a) {
+ a.aString = "IService";
+ aObject1 = a;
+ return "IService";
+ }
+
+ public String setAObject2(AObject a) {
+ a.aString = "IService";
+ aObject2 = a;
+ return "IService";
+ }
+
+ @ComponentName
+ public void setComponentName1(String componentName1) {
+ this.componentName2 = componentName1;
+ }
+
+ public String getAObject1String() {
+ return aObject1.aString;
+ }
+
+ public String getAObject2String() {
+ return aObject2.aString;
+ }
+
+ public String getAObject3String() {
+ return aObject3.aString;
+ }
+
+ public AObject getAObject3() {
+ aObject3 = new AObject();
+ aObject3.aString = "IService";
+ return aObject3;
+ }
+
+ public String getComponentName1() {
+ return componentName1;
+ }
+
+ public String getComponentName2() {
+ return componentName2;
+ }
+
+ public String getServiceName1() {
+ return requestContext.getServiceName();
+ }
+
+ public String getServiceName2() {
+ return componentContext.getRequestContext().getServiceName();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/resources/service.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/resources/service.composite
new file mode 100644
index 0000000000..0731986df2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/main/resources/service.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Service-Composite">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.AServiceImpl" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.BServiceImpl" />
+ </component>
+
+ <component name="BComponent1">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.BServiceImpl" />
+ <reference name="aService" target="AComponent"/>
+ <reference name="cService" target="CComponent"/>
+ <reference name="hService" target="HComponent"/>
+ <reference name="iService" target="IComponent"/>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.CServiceImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.DServiceImpl" />
+ </component>
+
+ <component name="EComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.EServiceImpl" />
+ </component>
+
+ <component name="FComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.FServiceImpl" />
+ </component>
+
+ <component name="FComponent2">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.FServiceImpl2" />
+ </component>
+
+ <component name="GComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.GServiceImpl" />
+ </component>
+
+ <component name="HComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.HServiceImpl" />
+ </component>
+
+ <component name="IComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.IServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/ServiceAnnotationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/ServiceAnnotationTestCase.java
new file mode 100644
index 0000000000..52f7821ebb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/annotations/service/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/ServiceAnnotationTestCase.java
@@ -0,0 +1,335 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.annotations.service;
+
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.AObject;
+import org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.FServiceImpl2;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * This test class tests the Service annotation described in section 1.2.1
+ * including 1.3.1, 1.8.1, 1.8.3, 1.8.6, 1.8.15 and 1.8.17<br>
+ * but not..<br>
+ * <li>Lines 1531 to 1534</li>
+ */
+public class ServiceAnnotationTestCase {
+
+ protected static String compositeName = "service.composite";
+ protected static AService aService = null;
+ protected static BService bService = null;
+ protected static BService bService1 = null;
+ protected static HService hService = null;
+ protected static IService iService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ bService = ServiceFinder.getService(BService.class, "BComponent");
+ bService1 = ServiceFinder.getService(BService.class, "BComponent1");
+ hService = ServiceFinder.getService(HService.class, "HComponent");
+ iService = ServiceFinder.getService(IService.class, "IComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Line 215:<br>
+ * <li>As a Java interface</li>
+ * <p>
+ * Line 1622 to 1623:<br>
+ * The
+ *
+ * @Service annotation type is used on a component implementation class to
+ * specify the SCA services offered by the implementation.<br>
+ */
+ @Test
+ public void atService1() throws Exception {
+ Assert.assertEquals("AService", aService.getName());
+ }
+
+ /**
+ * Line 216:<br>
+ * <li>As a Java class</li>
+ * <p>
+ * Line 1631:<br>
+ * <li>value – A shortcut for the case when the class provides only a
+ * single service interface.</li>
+ */
+ @Test
+ public void atService2() throws Exception {
+ Assert.assertEquals("BService", bService.getName());
+ }
+
+ /**
+ * Lines 222 to 224:<br>
+ * A remotable service is defined using the "@Remotable" annotation on the
+ * Java interface that defines the service. Remotable services are intended
+ * to be used for coarse grained services, and the parameters are passed
+ * by-value.<br>
+ * <p>
+ * Lines 321 to 323:<br>
+ * The "@Remotable" annotation on a Java interface indicates that the
+ * interface is designed to be used for remote communication. Remotable
+ * interfaces are intended to be used for coarse grained services.
+ * Operations parameters and return values are passed by-value.<br>
+ */
+ @Test
+ public void atService3() throws Exception {
+ AObject o = new AObject();
+ Assert.assertEquals("AService", aService.setAObject(o));
+ Assert.assertNull(o.aString);
+ }
+
+ /**
+ * Lines 227 to 242:<br>
+ * A local service can only be called by clients that are deployed within
+ * the same address space as the component implementing the local service.<br>
+ * ...<br>
+ * The data exchange semantic for calls to local services is by-reference.<br>
+ * ...<br>
+ * Lines 996 to 1028:<br>
+ * 1.8.1 "@AllowsPassByReference"<br>
+ * ...<br>
+ * Lines 1535 to 1540:<br>
+ * Independent of whether the remotable service is called from outside of
+ * the composite that contains it or from another component in the same
+ * composite, the data exchange semantics are by-value.<br>
+ * Implementations of remotable services may modify input data during or
+ * after an invocation and may modify return data after the invocation. If a
+ * remotable service is called locally or remotely, the SCA container is
+ * responsible for making sure that no modification of input data or
+ * post-invocation modifications to return data are seen by the caller.<br>
+ * <p>
+ * Test under Non-SCA <-> SCA
+ * <li>BService is local service to test by reference</li>
+ * <li>HService is remotable service to test "@AllowsPassByReference" at
+ * method level</li>
+ * <li>IService is remotable service to test "@AllowsPassByReference" at
+ * class level</li>
+ */
+ @Test
+ public void atService4() throws Exception {
+ AObject b = new AObject();
+ Assert.assertEquals("BService", bService.setAObject(b));
+ Assert.assertEquals("BService", b.aString);
+
+ AObject h1 = new AObject();
+ Assert.assertEquals("HService", hService.setAObject1(h1));
+ Assert.assertEquals("HService", h1.aString);
+ h1.aString = "atService4";
+ Assert.assertEquals("atService4", hService.getAObject1String());
+
+ AObject h2 = new AObject();
+ Assert.assertEquals("HService", hService.setAObject2(h2));
+ Assert.assertNull(h2.aString);
+ h2.aString = "atService4";
+ Assert.assertEquals("HService", hService.getAObject2String());
+
+ AObject h3 = hService.getAObject3();
+ h3.aString = "atService4";
+ Assert.assertEquals("HService", hService.getAObject3String());
+
+ AObject i1 = new AObject();
+ Assert.assertEquals("IService", iService.setAObject1(i1));
+ Assert.assertEquals("IService", i1.aString);
+ i1.aString = "atService4";
+ Assert.assertEquals("atService4", iService.getAObject1String());
+
+ AObject i2 = new AObject();
+ Assert.assertEquals("IService", iService.setAObject2(i2));
+ Assert.assertEquals("IService", i2.aString);
+ i2.aString = "atService4";
+ Assert.assertEquals("atService4", iService.getAObject2String());
+
+ AObject i3 = iService.getAObject3();
+ i3.aString = "atService4";
+ Assert.assertEquals("atService4", iService.getAObject3String());
+ }
+
+ /**
+ * Line 1624 to 1627:<br>
+ * A class used as the implementation of a service is not required to have
+ * an "@Service" annotation. If a class has no "@Service" annotation, then
+ * the rules determining which services are offered and what interfaces
+ * those services have are determined by the specific implementation type.
+ * <br>
+ */
+ @Test
+ public void atService5() throws Exception {
+ CService cService = ServiceFinder.getService(CService.class, "CComponent");
+ Assert.assertEquals("CService", cService.getName());
+ }
+
+ /**
+ * Line 1623 to 1624:<br>
+ * The class need not be declared as implementing all of the interfaces
+ * implied by the services, but all methods of the service interfaces must
+ * be present.<br>
+ * <p>
+ * Line 1629 to 1630:<br>
+ * <li>interfaces – The value is an array of interface or class objects
+ * that should be exposed as services by this component.</li>
+ */
+ @Test
+ public void atService6() throws Exception {
+ DService1 dService1 = ServiceFinder.getService(DService1.class, "DComponent/DService1");
+ Assert.assertEquals("DService1", dService1.getName1());
+ DService2 dService2 = ServiceFinder.getService(DService2.class, "DComponent/DService2");
+ Assert.assertEquals("DService2", dService2.getName2());
+ try {
+ ServiceFinder.getService(DService3.class, "DComponent/DService3");
+ fail("Should have failed to get this service");
+ } catch (Exception e) {
+ // Expect an exception
+ }
+ }
+
+ /**
+ * Line 1635 to 1636:<br>
+ * A "@Service" annotation with no attributes is meaningless, it is the same
+ * as not having the annotation there at all.<br>
+ */
+ @Test
+ public void atService7() throws Exception {
+ EService eService = ServiceFinder.getService(EService.class, "EComponent");
+ Assert.assertEquals("EService", eService.getName());
+ }
+
+ /**
+ * Line 1637 to 1638:<br>
+ * The service names of the defined services default to the names of the
+ * interfaces or class, without the package name.<br>
+ */
+ @Test
+ public void atService8() throws Exception {
+ FService fService = ServiceFinder.getService(FService.class, "FComponent");
+ Assert.assertEquals("FService", fService.getName());
+ FServiceImpl2 fServiceImpl2 = ServiceFinder.getService(FServiceImpl2.class, "FComponent2");
+ Assert.assertEquals("FServiceImpl2", fServiceImpl2.getName());
+ fService = ServiceFinder.getService(FService.class, "FComponent2");
+ Assert.assertEquals("FServiceImpl2", fService.getName());
+ }
+
+ /**
+ * Line 1639 to 1641:<br>
+ * If a Java implementation needs to realize two services with the same
+ * interface, then this is achieved through subclassing of the interface.
+ * The subinterface must not add any methods. Both interfaces are listed in
+ * the "@Service" annotation of the Java implementation class. <br>
+ */
+ @Test
+ public void atService9() throws Exception {
+ GService1 gService1 = ServiceFinder.getService(GService1.class, "GComponent/GService1");
+ GService2 gService2 = ServiceFinder.getService(GService2.class, "GComponent/GService2");
+ Assert.assertEquals("GService", gService1.getName());
+ Assert.assertEquals("GService1", gService1.getServiceName());
+ Assert.assertEquals("GService", gService2.getName());
+ Assert.assertEquals("GService2", gService2.getServiceName());
+ }
+
+ /**
+ * Lines 227 to 242:<br>
+ * A local service can only be called by clients that are deployed within
+ * the same address space as the component implementing the local service.<br>
+ * ...<br>
+ * The data exchange semantic for calls to local services is by-reference.<br>
+ * ...<br>
+ * Lines 996 to 1028:<br>
+ * 1.8.1 "@AllowsPassByReference"<br>
+ * ...<br>
+ * Lines 1535 to 1540:<br>
+ * Independent of whether the remotable service is called from outside of
+ * the composite that contains it or from another component in the same
+ * composite, the data exchange semantics are by-value.<br>
+ * Implementations of remotable services may modify input data during or
+ * after an invocation and may modify return data after the invocation. If a
+ * remotable service is called locally or remotely, the SCA container is
+ * responsible for making sure that no modification of input data or
+ * post-invocation modifications to return data are seen by the caller.<br>
+ * <p>
+ * Test under SCA <-> SCA<br>
+ * <li>AService is remotable service to test by value</li>
+ * <li>CService is local service to test by-reference</li>
+ * <li>HService is remotable service to test "@AllowsPassByReference" at
+ * method level</li>
+ * <li>IService is remotable service to test "@AllowsPassByReference" at
+ * class level</li>
+ */
+ @Test
+ public void atService10() throws Exception {
+ Assert.assertEquals("None", bService1.testServices());
+ }
+
+ /**
+ * Lines 1095 to 1124:<br>
+ * 1.8.3. "@ComponentName"<br>
+ * ...<br>
+ * The "@ComponentName" annotation type is used to annotate a Java class
+ * field or setter method that is used to inject the component name.<br>
+ * ...<br>
+ */
+ @Test
+ public void atService11() throws Exception {
+ Assert.assertEquals("HComponent", hService.getComponentName());
+ Assert.assertNull(iService.getComponentName1());
+ Assert.assertEquals("IComponent", iService.getComponentName2());
+ }
+
+ /**
+ * Lines 1164 to 1187:<br>
+ * 1.8.6. "@Context"<br>
+ * ...<br>
+ * The "@Context" annotation type is used to annotate a Java class field or
+ * a setter method that is used to inject a composite context for the
+ * component. The type of context to be injected is defined by the type of
+ * the Java class field or type of the setter method input argument, the
+ * type is either ComponentContext or RequestContext.<br>
+ * ...<br>
+ * <p>
+ * HService - "@Context" is used to annotate setter methods<br>
+ * IService - "@Context" is used to annotate class fields<br>
+ * <br>
+ */
+ @Test
+ public void atService12() throws Exception {
+ Assert.assertEquals("HService", hService.getServiceName1());
+ Assert.assertEquals("HService", hService.getServiceName2());
+ Assert.assertEquals("IService", iService.getServiceName1());
+ Assert.assertEquals("IService", iService.getServiceName2());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/pom.xml
new file mode 100644
index 0000000000..d4af5b79db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/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>java-api-apis</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-apis-callablereference</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs - CallableReference</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/AComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/AComponent.java
new file mode 100644
index 0000000000..a3f6d48685
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/AComponent.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.vtest.javaapi.apis.callablereference;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service A.
+ */
+@Conversational
+public interface AComponent {
+
+ public String getName();
+
+ public String getServiceName();
+ public String getBusinessInterfaceName();
+ public boolean isConversational();
+ public void testConversationID();
+ public String getCallbackResult();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/BCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/BCallback.java
new file mode 100644
index 0000000000..707568e507
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/BCallback.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.vtest.javaapi.apis.callablereference;
+
+public interface BCallback {
+
+ public void processResults(String result);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/BComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/BComponent.java
new file mode 100644
index 0000000000..1a62b86c22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/BComponent.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.vtest.javaapi.apis.callablereference;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service B.
+ */
+@Conversational
+@Callback(BCallback.class)
+public interface BComponent {
+
+ public String getName();
+
+ public void testCallback();
+ public void testConversationID();
+ public void testNonNullConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/impl/AComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/impl/AComponentImpl.java
new file mode 100644
index 0000000000..51ee68a393
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/impl/AComponentImpl.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.vtest.javaapi.apis.callablereference.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.callablereference.AComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.callablereference.BCallback;
+import org.apache.tuscany.sca.vtest.javaapi.apis.callablereference.BComponent;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+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(AComponent.class)
+@Scope("CONVERSATION")
+public class AComponentImpl implements AComponent, BCallback {
+
+ private static Object monitor = new Object();
+ private static String returnMessage = null;
+
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected CallableReference<BComponent> bReference;
+
+ @ConversationID
+ protected String cid;
+
+ public String getName() {
+ return "ComponentA";
+ }
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public String getServiceName() {
+ return bReference.getService().getName();
+ }
+
+ public String getBusinessInterfaceName() {
+ return bReference.getBusinessInterface().getSimpleName();
+ }
+
+ public boolean isConversational() {
+ return bReference.isConversational();
+ }
+
+ public void testConversationID() {
+ ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+ bSR.setConversationID("AConversationID");
+ bSR.getService().testConversationID();
+
+ Assert.assertEquals("AConversationID", bSR.getConversation().getConversationID());
+ }
+
+ public String getCallbackResult() {
+ ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+ String cbID = "ComponentACallBack";
+ bSR.setCallbackID(cbID);
+ bSR.getService().testCallback();
+
+ // Wait for 30s max.
+ int count = 0;
+ synchronized(monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return returnMessage;
+ }
+
+ public void processResults(String result) {
+ returnMessage = result;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/impl/BComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/impl/BComponentImpl.java
new file mode 100644
index 0000000000..f66db33a83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/impl/BComponentImpl.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.vtest.javaapi.apis.callablereference.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.callablereference.BCallback;
+import org.apache.tuscany.sca.vtest.javaapi.apis.callablereference.BComponent;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+@Scope("CONVERSATION")
+public class BComponentImpl implements BComponent {
+
+ protected ComponentContext componentContext;
+
+ @Callback
+ protected BCallback callback;
+
+ @ConversationID
+ protected String cid;
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public String getName() {
+ return "ComponentB";
+ }
+
+ public void testCallback() {
+ callback = componentContext.getRequestContext().getCallback();
+ callback.processResults("CallBackFromB");
+
+ CallableReference<BCallback> bCR = componentContext.getRequestContext().getCallbackReference();
+ Assert.assertEquals("ComponentACallBack", bCR.getCallbackID());
+ }
+
+ public void testConversationID() {
+ Assert.assertEquals("AConversationID", cid);
+ }
+
+ public void testNonNullConversation() {
+ Assert.assertNotNull(componentContext.getRequestContext().getServiceReference().getConversation());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/resources/callablereference.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/resources/callablereference.composite
new file mode 100644
index 0000000000..f997d78bb5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/main/resources/callablereference.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java-api-tests"
+ name="CallableReference-Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.callablereference.impl.AComponentImpl"/>
+ <reference name="bReference" target="BComponent"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.callablereference.impl.BComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/CallableReferenceTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/CallableReferenceTestCase.java
new file mode 100644
index 0000000000..4d0d8338ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/callablereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/CallableReferenceTestCase.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.vtest.javaapi.apis.callablereference;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * This test class tests the CallableReference interface described in 1.7.3 of
+ * the SCA Java Annotations & APIs Specification 1.0.
+ */
+public class CallableReferenceTestCase {
+
+ protected static String compositeName = "callablereference.composite";
+ protected static AComponent a;
+ protected static BComponent b;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a = ServiceFinder.getService(AComponent.class, "AComponent");
+ b = ServiceFinder.getService(BComponent.class, "BComponent");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Lines 884 <br>
+ * getService() - Returns a type-safe reference to the target of this
+ * reference. The instance returned is guaranteed to implement the business
+ * interface for this reference. The value returned is a proxy to the target
+ * that implements the business interface associated with this reference.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetService() throws Exception {
+ Assert.assertEquals("ComponentB", a.getServiceName());
+ }
+
+ /**
+ * Lines 885 <br>
+ * getBusinessInterface() – Returns the Java class for the business
+ * interface associated with this reference.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetBusinessInterface() throws Exception {
+ Assert.assertEquals("BComponent", a.getBusinessInterfaceName());
+ }
+
+ /**
+ * Lines 886 <br>
+ * isConversational() – Returns true if this reference is conversational.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testIsConversational() throws Exception {
+ Assert.assertEquals(true, a.isConversational());
+ }
+
+ /**
+ * Lines 887 <br>
+ * getConversation() – Returns the conversation associated with this
+ * reference. Returns null if no conversation is currently active.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetConversation() throws Exception {
+ a.testConversationID();
+ b.testNonNullConversation();
+ }
+
+ /**
+ * Lines 888 <br>
+ * getCallbackID() – Returns the callback ID.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetCallbackID() throws Exception {
+ // Actual test is in BComponentImpl. Below is an extra test.
+ Assert.assertEquals("CallBackFromB", a.getCallbackResult());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/pom.xml
new file mode 100644
index 0000000000..9af4b21f8a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/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>java-api-apis</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-apis-componentcontext</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs - ComponentContext</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/AComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/AComponent.java
new file mode 100644
index 0000000000..b2c8c07866
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/AComponent.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.vtest.javaapi.apis.componentcontext;
+
+/**
+ * Simple Service A.
+ */
+public interface AComponent {
+
+ public String getName();
+
+ public String getContextURI();
+ public String getServiceBName();
+ public String getServiceReferenceBName();
+ public String getSelfReferenceName();
+ public String getProperty();
+ public String getRequestContextServiceName();
+ public String getCastCallableReferenceServiceName();
+ public String getCastServiceReferenceServiceName();
+ public void illegalCast();
+
+ public String testServiceLookup();
+ public String getRequestContextContent();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BComponent.java
new file mode 100644
index 0000000000..7e425c740f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BComponent.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.vtest.javaapi.apis.componentcontext;
+
+/**
+ * Simple Service B.
+ */
+public interface BComponent {
+
+ String getName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java
new file mode 100644
index 0000000000..eff7cc5a88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.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.vtest.javaapi.apis.componentcontext;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service B.
+ */
+@Remotable
+public interface BService {
+
+ String getBName();
+
+ String getSelfReferenceWithServiceName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/CService.java
new file mode 100644
index 0000000000..d0da012f6f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/CService.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.vtest.javaapi.apis.componentcontext;
+
+/**
+ * Simple Service C.
+ */
+public interface CService {
+
+ String getCName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java
new file mode 100644
index 0000000000..a221ba11fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.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.vtest.javaapi.apis.componentcontext;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface DComponent {
+
+ public String getName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java
new file mode 100644
index 0000000000..606443a480
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.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.vtest.javaapi.apis.componentcontext.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.AComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.BService;
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.DComponent;
+import org.osoa.sca.CallableReference;
+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.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+@Scope("COMPOSITE")
+@EagerInit
+public class AComponentImpl implements AComponent {
+
+ public static String rcContent = null;
+
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected BService bReference;
+
+ @Reference
+ protected DComponent dReference;
+
+ @Property(name="aProperty", required=true)
+ protected String aProperty;
+
+ public String getName() {
+ return "ComponentA";
+ }
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ @Init
+ public void init() {
+ RequestContext rc = componentContext.getRequestContext();
+ if (rc != null) {
+ rcContent = "NotNull";
+ } else {
+ rcContent = "Null";
+ }
+ }
+
+ public String getContextURI() {
+ return componentContext.getURI();
+ }
+
+ public String getServiceBName() {
+ return componentContext.getService(BService.class, "bReference").getBName();
+ }
+
+ public String getServiceReferenceBName() {
+ ServiceReference<BService> bSR = componentContext.getServiceReference(BService.class, "bReference");
+ return bSR.getService().getBName();
+ }
+
+ public String getSelfReferenceName() {
+ ServiceReference<AComponent> aSR = componentContext.createSelfReference(AComponent.class);
+ return aSR.getService().getName();
+ }
+
+ public String getProperty() {
+ return componentContext.getProperty(String.class, "aProperty");
+ }
+
+ public String getRequestContextServiceName() {
+ return componentContext.getRequestContext().getServiceName();
+ }
+
+ public String getCastCallableReferenceServiceName() {
+ BService b = componentContext.getService(BService.class, "bReference");
+ CallableReference<BService> bCR = componentContext.cast(b);
+ return bCR.getService().getBName();
+ }
+
+ public String getCastServiceReferenceServiceName() {
+ BService b = componentContext.getService(BService.class, "bReference");
+ ServiceReference<BService> bSR = componentContext.cast(b);
+ return bSR.getService().getBName();
+ }
+
+ public void illegalCast() {
+ componentContext.cast("");
+ }
+
+ public String testServiceLookup() {
+ return componentContext.getService(DComponent.class, "dReference").getName();
+ }
+
+ public String getRequestContextContent() {
+ return rcContent;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java
new file mode 100644
index 0000000000..34a71e1318
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.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.vtest.javaapi.apis.componentcontext.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.AComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.BService;
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.DComponent;
+import org.osoa.sca.CallableReference;
+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.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+@Scope("COMPOSITE")
+@EagerInit
+public class AUnannotatedComponentImpl implements AComponent {
+
+ public static String rcContent = null;
+
+ protected ComponentContext componentContext;
+
+ protected BService bReference;
+
+ protected DComponent dReference;
+
+ protected String aProperty;
+
+ public String getName() {
+ return "ComponentA";
+ }
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ @Init
+ public void init() {
+ RequestContext rc = componentContext.getRequestContext();
+ if (rc != null) {
+ rcContent = "NotNull";
+ } else {
+ rcContent = "Null";
+ }
+ }
+
+ public String getContextURI() {
+ return componentContext.getURI();
+ }
+
+ public String getServiceBName() {
+ return componentContext.getService(BService.class, "bReference").getBName();
+ }
+
+ public String getServiceReferenceBName() {
+ ServiceReference<BService> bSR = componentContext.getServiceReference(BService.class, "bReference");
+ return bSR.getService().getBName();
+ }
+
+ public String getSelfReferenceName() {
+ ServiceReference<AComponent> aSR = componentContext.createSelfReference(AComponent.class);
+ return aSR.getService().getName();
+ }
+
+ public String getProperty() {
+ return componentContext.getProperty(String.class, "aProperty");
+ }
+
+ public String getRequestContextServiceName() {
+ return componentContext.getRequestContext().getServiceName();
+ }
+
+ public String getCastCallableReferenceServiceName() {
+ BService b = componentContext.getService(BService.class, "bReference");
+ CallableReference<BService> bCR = componentContext.cast(b);
+ return bCR.getService().getBName();
+ }
+
+ public String getCastServiceReferenceServiceName() {
+ BService b = componentContext.getService(BService.class, "bReference");
+ ServiceReference<BService> bSR = componentContext.cast(b);
+ return bSR.getService().getBName();
+ }
+
+ public void illegalCast() {
+ componentContext.cast("");
+ }
+
+ public String testServiceLookup() {
+ return componentContext.getService(DComponent.class, "dReference").getName();
+ }
+
+ public String getRequestContextContent() {
+ return rcContent;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/BComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/BComponentImpl.java
new file mode 100644
index 0000000000..71d2eade2b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/BComponentImpl.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.vtest.javaapi.apis.componentcontext.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.BService;
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.CService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces={BService.class, CService.class})
+public class BComponentImpl implements BService, CService {
+
+ protected ComponentContext componentContext;
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public String getBName() {
+ return "ServiceB";
+ }
+
+ public String getCName() {
+ return "ServiceC";
+ }
+
+ public String getSelfReferenceWithServiceName() {
+ ServiceReference<CService> cSR = componentContext.createSelfReference(CService.class, "CService");
+ return cSR.getService().getCName();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/DComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/DComponentImpl.java
new file mode 100644
index 0000000000..4b2c8c183b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/DComponentImpl.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.vtest.javaapi.apis.componentcontext.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.DComponent;
+import org.osoa.sca.annotations.Service;
+
+@Service(DComponent.class)
+public class DComponentImpl implements DComponent {
+
+ public String getName() {
+ return "ComponentD";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite
new file mode 100644
index 0000000000..19f110d5dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/main/resources/ab.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java-api-tests"
+ name="AB-Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.impl.AComponentImpl"/>
+ <reference name="bReference" target="BComponent/BService"/>
+ <reference name="dReference" target="DComponent"/>
+ <property name="aProperty" type="xsd:string">PropertyA</property>
+ </component>
+
+ <component name="AUnannotatedComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.impl.AUnannotatedComponentImpl"/>
+ <reference name="bReference" target="BComponent/BService"/>
+ <reference name="dReference" target="DComponent"/>
+ <property name="aProperty" type="xsd:string">PropertyA</property>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.impl.BComponentImpl"/>
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.impl.DComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java
new file mode 100644
index 0000000000..4e05aa2252
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.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.vtest.javaapi.apis.componentcontext;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * This test class tests the ComponentContext interface described in 1.7.1 of
+ * the SCA Java Annotations & APIs Specification 1.0. Relevant sections of 1.4
+ * will also be covered here.
+ */
+public class ComponentContextTestCase {
+
+ protected static String compositeName = "ab.composite";
+ protected static AComponent a;
+ protected static AComponent aUnannotated;
+ protected static BService b;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a = ServiceFinder.getService(AComponent.class, "AComponent");
+ aUnannotated = ServiceFinder.getService(AComponent.class, "AUnannotatedComponent");
+ b = ServiceFinder.getService(BService.class, "BComponent/BService");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Lines 776 <br>
+ * getURI() - Returns the absolute URI of the component within the SCA
+ * domain.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetURI() throws Exception {
+ Assert.assertEquals("AComponent", a.getContextURI());
+ Assert.assertEquals("AUnannotatedComponent", aUnannotated.getContextURI());
+ }
+
+ /**
+ * Lines 778 <br>
+ * getService(Class&lt;B&gt; businessInterface, String referenceName) ?
+ * Returns a proxy for the reference defined by the current component.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetService() throws Exception {
+ Assert.assertEquals(a.getServiceBName(), "ServiceB");
+ }
+
+ /**
+ * Lines 780 <br>
+ * getServiceReference(Class&lt;B&gt; businessInterface, String
+ * referenceName) ? Returns a ServiceReference defined by the current
+ * component.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetServiceReference() throws Exception {
+ Assert.assertEquals(a.getServiceReferenceBName(), "ServiceB");
+ }
+
+ /**
+ * Lines 783 <br>
+ * createSelfReference(Class&lt;B&gt; businessInterface) ? Returns a
+ * ServiceReference that can be used to invoke this component over the
+ * designated service.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCreateSelfReference() throws Exception {
+ Assert.assertEquals(a.getSelfReferenceName(), "ComponentA");
+ }
+
+ /**
+ * Lines 785 <br>
+ * getSelfReference(Class&lt;B&gt; businessInterface, String serviceName) -
+ * Returns a ServiceReference that can be used to invoke this component over
+ * the designated service. Service name explicitly declares the service name
+ * to invoke.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCreateSelfReferenceWithServiceName() throws Exception {
+ Assert.assertEquals("ServiceC", b.getSelfReferenceWithServiceName());
+ }
+
+ /**
+ * Lines 788 <br>
+ * getProperty (Class&lt;B&gt; type, String propertyName) - Returns the
+ * value of an SCA property defined by this component.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetProperty() throws Exception {
+ Assert.assertEquals("PropertyA", a.getProperty());
+ }
+
+ /**
+ * Lines 793 <br>
+ * getRequestContext() - Returns the context for the current SCA service
+ * request, or null if there is no current request or if the context is
+ * unavailable.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetRequestContext() throws Exception {
+ Assert.assertEquals("AComponent", a.getRequestContextServiceName());
+ Assert.assertEquals("NotNull", a.getRequestContextContent());
+ }
+
+ /**
+ * Lines 790,794 <br>
+ * cast(B target) - Casts a type-safe reference to a CallableReference.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCast() throws Exception {
+ Assert.assertEquals("ServiceB", a.getCastCallableReferenceServiceName());
+ Assert.assertEquals("ServiceB", a.getCastServiceReferenceServiceName());
+
+ String check = "";
+ try {
+ a.illegalCast();
+ } catch (IllegalArgumentException iae) {
+ check = "IllegalCast";
+ } catch (ServiceRuntimeException sre) {
+ if (sre.getCause() instanceof IllegalArgumentException) {
+ check = "IllegalCast";
+ }
+ }
+ Assert.assertEquals("IllegalCast", check);
+ }
+
+ /**
+ * Lines 342-344 <br>
+ * When a component implementation needs access to a service where the
+ * reference to the service is not known at compile time, the reference can
+ * be located using the component?s ComponentContext.
+ *
+ * @throws Exception
+ */
+ @Ignore
+ public void testServiceLookup() throws Exception {
+ Assert.assertEquals("ComponentD", a.testServiceLookup());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/pom.xml
new file mode 100644
index 0000000000..143d6f1788
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/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>java-api-apis</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-apis-conversation</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs - Conversation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/AComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/AComponent.java
new file mode 100644
index 0000000000..805c1f2750
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/AComponent.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.vtest.javaapi.apis.conversation;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service A.
+ */
+@Conversational
+public interface AComponent {
+
+ public String getName();
+
+ public void testConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/BComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/BComponent.java
new file mode 100644
index 0000000000..abd8602705
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/BComponent.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.vtest.javaapi.apis.conversation;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Simple Service B.
+ */
+@Conversational
+public interface BComponent {
+
+ public String getName();
+
+ public void testCustomConversationID();
+ public void testGeneratedConversationID(Object id);
+
+ @EndsConversation
+ public void endsConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/impl/AComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/impl/AComponentImpl.java
new file mode 100644
index 0000000000..616155ccdf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/impl/AComponentImpl.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.vtest.javaapi.apis.conversation.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.conversation.AComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.conversation.BComponent;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.Conversation;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+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(AComponent.class)
+@Scope("CONVERSATION")
+public class AComponentImpl implements AComponent {
+
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected CallableReference<BComponent> bReference;
+
+ @ConversationID
+ protected String cid;
+
+ public String getName() {
+ return "ComponentA";
+ }
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public void testConversation() {
+ ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+ bSR.setConversationID("AConversationID");
+ bSR.getService().testCustomConversationID();
+
+ Conversation bc = bSR.getConversation();
+ Assert.assertEquals("AConversationID", bc.getConversationID());
+ bc.end();
+
+ Assert.assertEquals("ComponentB", bReference.getService().getName());
+ bReference.getService().testGeneratedConversationID(bReference.getConversation().getConversationID());
+ bReference.getConversation().end();
+
+ Assert.assertEquals(1, BComponentImpl.customInitCount);
+ Assert.assertEquals(1, BComponentImpl.customDestroyCount);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/impl/BComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/impl/BComponentImpl.java
new file mode 100644
index 0000000000..66a3d3c72c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/impl/BComponentImpl.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.vtest.javaapi.apis.conversation.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.conversation.BComponent;
+import org.junit.Assert;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+@Scope("CONVERSATION")
+public class BComponentImpl implements BComponent {
+
+ public static int customInitCount = 0;
+ public static int customDestroyCount = 0;
+
+ protected ComponentContext componentContext;
+
+ @ConversationID
+ protected String cid;
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public String getName() {
+ return "ComponentB";
+ }
+
+ public void testCustomConversationID() {
+ Assert.assertEquals("AConversationID", cid);
+ }
+
+ public void testGeneratedConversationID(Object id) {
+ Assert.assertEquals(id.toString(), cid);
+ }
+
+ public void endsConversation() {
+ }
+
+ @Init
+ public void initB() {
+ if (cid.equals("AConversationID")) {
+ customInitCount++;
+ }
+ }
+
+ @Destroy
+ public void destroyB() {
+ if (cid.equals("AConversationID")) {
+ customDestroyCount++;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/resources/conversation.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/resources/conversation.composite
new file mode 100644
index 0000000000..87cab2f479
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/main/resources/conversation.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java-api-tests"
+ name="Conversation-Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.conversation.impl.AComponentImpl"/>
+ <reference name="bReference" target="BComponent"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.conversation.impl.BComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ConversationTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ConversationTestCase.java
new file mode 100644
index 0000000000..9b46ac5e08
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ConversationTestCase.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.vtest.javaapi.apis.conversation;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * This test class tests the Conversation interface described in 1.7.5 of the
+ * SCA Java Annotations & APIs Specification 1.0.
+ */
+public class ConversationTestCase {
+
+ protected static String compositeName = "conversation.composite";
+ protected static AComponent a;
+ protected static BComponent b;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a = ServiceFinder.getService(AComponent.class, "AComponent");
+ b = ServiceFinder.getService(BComponent.class, "BComponent");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Lines 941, 942 <br>
+ * getConversationID() – 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. <br>
+ * end() – Ends this conversation.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testConversation() throws Exception {
+ a.testConversation();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/pom.xml
new file mode 100644
index 0000000000..e3325aaa07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/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>java-api-apis</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-apis-exception</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs - Exception</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java
new file mode 100644
index 0000000000..5c3755b19f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.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.vtest.javaapi.apis.exception;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service A.
+ */
+@Conversational
+public interface AComponent {
+
+ public String getName();
+
+ public void testConversation();
+ public void testCallBack();
+
+ public boolean testServiceRuntimeException();
+ public boolean testServiceUnavailableException();
+
+ public boolean testCheckedException();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java
new file mode 100644
index 0000000000..c1c1c6544c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.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.vtest.javaapi.apis.exception;
+
+public interface BCallback {
+
+ public void processResults(String result);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java
new file mode 100644
index 0000000000..6893a3b4b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.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.vtest.javaapi.apis.exception;
+
+import org.osoa.sca.annotations.Callback;
+
+/**
+ * Simple Service B.
+ */
+@Callback(BCallback.class)
+public interface BComponent {
+
+ public String getName();
+
+ public void testCallback();
+ public void testRedirectedCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java
new file mode 100644
index 0000000000..519e66f1ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.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.vtest.javaapi.apis.exception;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service C.
+ */
+@Conversational
+public interface CComponent {
+
+ public String getName();
+
+ public void testConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java
new file mode 100644
index 0000000000..d0ef71a926
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.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.vtest.javaapi.apis.exception;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remote Service D.
+ */
+@Remotable
+public interface DComponent {
+
+ public String getName();
+ public void testException() throws DException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DException.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DException.java
new file mode 100644
index 0000000000..82873ed96d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DException.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.vtest.javaapi.apis.exception;
+
+public class DException extends Exception {
+
+ private static final long serialVersionUID = -3819913841563109423L;
+
+ public DException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java
new file mode 100644
index 0000000000..b4d6e929c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.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.vtest.javaapi.apis.exception.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.AComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.BComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.CComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.DComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.DException;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ConversationEndedException;
+import org.osoa.sca.NoRegisteredCallbackException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+@Scope("CONVERSATION")
+public class AComponentImpl implements AComponent {
+
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected CallableReference<BComponent> bReference;
+
+ @Reference
+ protected ServiceReference<CComponent> cReference;
+
+ @Reference
+ protected ServiceReference<DComponent> dReference;
+
+ @ConversationID
+ protected String cid;
+
+ public String getName() {
+ return "ComponentA";
+ }
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public void testConversation() {
+ ServiceReference<CComponent> cSR = componentContext.getServiceReference(CComponent.class, "cReference");
+ cSR.setConversationID("AConversationID");
+ Assert.assertEquals("ComponentC", cSR.getService().getName());
+
+ try {
+ Thread.sleep(1100);
+ cSR.getService().testConversation();
+
+ Assert.fail();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ } catch (ConversationEndedException cee) {
+ // Expected
+ }
+ }
+
+ public void testCallBack() {
+ ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+ bSR.setCallbackID("ComponentACallBack");
+
+ try {
+ bSR.getService().testCallback();
+ Assert.fail();
+ } catch (NoRegisteredCallbackException e) {
+ // Expected
+ }
+ }
+
+ public boolean testServiceRuntimeException() {
+ try {
+ componentContext.getServiceReference(BComponent.class, "dummyBReference").getService().getName();
+ } catch (ServiceRuntimeException sre) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean testServiceUnavailableException() {
+ return false;
+ }
+
+ public boolean testCheckedException() {
+ try {
+ dReference.getService().testException();
+ } catch (DException e) {
+ if (e.getMessage().equals("ADException")) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Destroy
+ public void destroy() {
+ System.out.println("This is a Destroy of AComponent ..");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java
new file mode 100644
index 0000000000..245401e8aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.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.vtest.javaapi.apis.exception.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.BCallback;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.BComponent;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+public class BComponentImpl implements BComponent {
+
+ protected ComponentContext componentContext;
+
+ @Callback
+ protected BCallback callback;
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public String getName() {
+ return "ComponentB";
+ }
+
+ public void testCallback() {
+ callback = componentContext.getRequestContext().getCallback();
+ callback.processResults("CallBackFromB");
+
+ CallableReference<BCallback> bCR = componentContext.getRequestContext().getCallbackReference();
+ Assert.assertEquals("ComponentACallBack", bCR.getCallbackID());
+ }
+
+ public void testRedirectedCallback() {
+ callback = componentContext.getRequestContext().getCallback();
+ callback.processResults("RedirectedCallBackFromB");
+
+ CallableReference<BCallback> bCR = componentContext.getRequestContext().getCallbackReference();
+ Assert.assertEquals("RedirectedCallBack", bCR.getCallbackID());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java
new file mode 100644
index 0000000000..2546548e1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.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.vtest.javaapi.apis.exception.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.CComponent;
+import org.junit.Assert;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CComponent.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class CComponentImpl implements CComponent {
+
+ @Context
+ protected RequestContext requestContext;
+
+ @ConversationID
+ protected String cid;
+
+ public String getName() {
+ return "ComponentC";
+ }
+
+ public void testConversation() {
+ Assert.assertEquals("AConversationID", cid);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java
new file mode 100644
index 0000000000..1cbda7e10b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.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.vtest.javaapi.apis.exception.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.DComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.DException;
+import org.osoa.sca.annotations.Service;
+
+@Service(DComponent.class)
+public class DComponentImpl implements DComponent {
+
+ public String getName() {
+ return "ComponentD";
+ }
+
+ public void testException() throws DException {
+ throw new DException("ADException");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/resources/exception.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/resources/exception.composite
new file mode 100644
index 0000000000..5bd933ce96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/main/resources/exception.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java-api-tests"
+ name="Exception-Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.exception.impl.AComponentImpl"/>
+ <reference name="bReference" target="BComponent"/>
+ <reference name="cReference" target="CComponent"/>
+ <reference name="dReference" target="DComponent"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.exception.impl.BComponentImpl"/>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.exception.impl.CComponentImpl"/>
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.exception.impl.DComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java
new file mode 100644
index 0000000000..9ff7e8e28f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.apis.exception;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test class tests the Exceptions described in 1.7.6, 1.7.7, 1.7.8, and 1.7.9 of the SCA Java Annotations & APIs Specification 1.0.
+ * This also covers 1.5 of the specification.
+ */
+public class ExceptionTestCase {
+
+ protected static SCADomain domain;
+ protected static String compositeName = "exception.composite";
+ protected static AComponent a;
+ protected static BComponent b;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ domain = SCADomain.newInstance(compositeName);
+ a = domain.getService(AComponent.class, "AComponent");
+ b = domain.getService(BComponent.class, "BComponent");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ /**
+ * Lines 951 <br>
+ * NoRegisteredCallbackException.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testNoRegisteredCallbackException() throws Exception {
+ a.testCallBack();
+ }
+
+ /**
+ * Lines 960 <br>
+ * ServiceRuntimeException - This exception signals problems in the management of SCA component execution.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testServiceRuntimeException() throws Exception {
+ Assert.assertTrue(a.testServiceRuntimeException());
+ }
+
+ /**
+ * Lines 970 <br>
+ * ServiceUnavailableException – This exception signals problems in the interaction with remote services.
+ *
+ * @throws Exception
+ */
+ @Ignore
+ public void testServiceUnavailableException() throws Exception {
+ domain.getComponentManager().stopComponent("AComponent");
+
+ try {
+ a.getName();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ try {
+ AComponent ac = domain.getService(AComponent.class, "AComponent");
+ ac.getName();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ domain.getComponentManager().startComponent("AComponent");
+ }
+
+ /**
+ * Lines 983 <br>
+ * ConversationEndedException.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testConversationEndedException() throws Exception {
+ a.testConversation();
+ }
+
+ /**
+ * Lines 360-361 <br>
+ * Business exceptions are thrown by the implementation of the called service method,
+ * and are defined as checked exceptions on the interface that types the service.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCheckedException() throws Exception {
+ Assert.assertTrue(a.testCheckedException());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/pom.xml
new file mode 100644
index 0000000000..b1b2fc3e6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/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>vtest-java-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>java-api-apis</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>componentcontext</module>
+ <module>requestcontext</module>
+ <module>callablereference</module>
+ <module>servicereference</module>
+ <module>conversation</module>
+ <module>exception</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/pom.xml
new file mode 100644
index 0000000000..7f18df910c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/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>java-api-apis</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-apis-requestcontext</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs - RequestContext</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java
new file mode 100644
index 0000000000..6fec5cada3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.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.vtest.javaapi.apis.requestcontext;
+
+/**
+ * Simple Service A.
+ */
+public interface AComponent {
+
+ public String getName();
+
+ public boolean isJAASSubject();
+ public String getServiceName();
+ public String getCallbackResult();
+ public String getServiceReferenceName();
+ public String getCallbackServiceReferenceName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java
new file mode 100644
index 0000000000..4dd2088f90
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.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.vtest.javaapi.apis.requestcontext;
+
+public interface BCallback {
+
+ public String getCallbackName();
+ public void processResults(String result);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java
new file mode 100644
index 0000000000..34f709d175
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.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.vtest.javaapi.apis.requestcontext;
+
+import org.osoa.sca.annotations.Callback;
+
+/**
+ * Simple Service B.
+ */
+@Callback(BCallback.class)
+public interface BComponent {
+
+ public String getName();
+
+ public void testCallback();
+ public String getServiceReferenceName();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java
new file mode 100644
index 0000000000..c6fa589ed4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.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.vtest.javaapi.apis.requestcontext.impl;
+
+import javax.security.auth.Subject;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.AComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.BCallback;
+import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.BComponent;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+public class AComponentImpl implements AComponent, BCallback {
+
+ private static Object monitor = new Object();
+ private static String returnMessage = null;
+ private static CallableReference<BCallback> cbCR;
+
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected BComponent bReference;
+
+ public String getName() {
+ return "ComponentA";
+ }
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public boolean isJAASSubject() {
+ return componentContext.getRequestContext().getSecuritySubject() instanceof Subject;
+ }
+
+ public String getServiceName() {
+ return componentContext.getRequestContext().getServiceName();
+ }
+
+ public String getCallbackResult() {
+ ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+ String cbID = "ComponentACallBack";
+ bSR.setCallbackID(cbID);
+ bSR.getService().testCallback();
+
+ // Wait for 30s max.
+ int count = 0;
+ synchronized(monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return returnMessage;
+ }
+
+ public void processResults(String result) {
+ returnMessage = result;
+ cbCR = componentContext.getRequestContext().getServiceReference();
+ }
+
+ public String getServiceReferenceName() {
+ CallableReference<AComponent> aCR = componentContext.getRequestContext().getServiceReference();
+ return aCR.getService().getName();
+ }
+
+ public String getCallbackServiceReferenceName() {
+ return cbCR.getService().getCallbackName();
+ }
+
+ public String getCallbackName() {
+ return "CallBackB";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java
new file mode 100644
index 0000000000..33ff829357
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.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.vtest.javaapi.apis.requestcontext.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.BCallback;
+import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.BComponent;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+public class BComponentImpl implements BComponent {
+
+ protected ComponentContext componentContext;
+
+ @Callback
+ protected BCallback callback;
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public String getName() {
+ return "ComponentB";
+ }
+
+ public void testCallback() {
+ callback = componentContext.getRequestContext().getCallback();
+ callback.processResults("CallBackFromB");
+
+ CallableReference<BCallback> bCR = componentContext.getRequestContext().getCallbackReference();
+ Assert.assertEquals("ComponentACallBack", bCR.getCallbackID());
+ }
+
+ public String getServiceReferenceName() {
+ CallableReference<BComponent> bCR = componentContext.getRequestContext().getServiceReference();
+ return bCR.getService().getName();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite
new file mode 100644
index 0000000000..4aa5eeb25a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java-api-tests"
+ name="RequestContext-Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.impl.AComponentImpl"/>
+ <reference name="bReference" target="BComponent"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.impl.BComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java
new file mode 100644
index 0000000000..65a1dbf88b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.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.vtest.javaapi.apis.requestcontext;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test class tests the RequestContext interface described in 1.7.2 of the
+ * SCA Java Annotations & APIs Specification 1.0.
+ */
+public class RequestContextTestCase {
+
+ protected static String compositeName = "requestcontext.composite";
+ protected static AComponent a;
+ protected static BComponent b;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a = ServiceFinder.getService(AComponent.class, "AComponent");
+ b = ServiceFinder.getService(BComponent.class, "BComponent");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Lines 858 <br>
+ * getSecuritySubject() – Returns the JAAS Subject of the current request.
+ *
+ * @throws Exception
+ */
+ @Ignore
+ public void testGetSecuritySubject() throws Exception {
+ Assert.assertTrue(a.isJAASSubject());
+ }
+
+ /**
+ * Lines 860 <br>
+ * getServiceName() – Returns the name of the service on the Java
+ * implementation the request came in on.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetServiceName() throws Exception {
+ Assert.assertEquals("AComponent", a.getServiceName());
+ }
+
+ /**
+ * Lines 861, 862 <br>
+ * getCallbackReference() – Returns a callable reference to the callback as
+ * specified by the caller. getCallback() – Returns a proxy for the callback
+ * as specified by the caller.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetCallback() throws Exception {
+ Assert.assertEquals("CallBackFromB", a.getCallbackResult());
+ }
+
+ /**
+ * Lines 863 <br>
+ * getServiceReference() – When invoked during the execution of a service
+ * operation, this API MUST return a CallableReference that represents the
+ * service. When invoked during the execution of a callback operation, this
+ * API MUST return a CallableReference that represents the callback service.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetServiceReference() throws Exception {
+ Assert.assertEquals("ComponentA", a.getServiceReferenceName());
+ Assert.assertEquals("ComponentB", b.getServiceReferenceName());
+ Assert.assertEquals("CallBackB", a.getCallbackServiceReferenceName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/pom.xml
new file mode 100644
index 0000000000..f792cff7e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/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>java-api-apis</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-apis-servicereference</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs - ServiceReference</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/AComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/AComponent.java
new file mode 100644
index 0000000000..a1745f400e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/AComponent.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.vtest.javaapi.apis.servicereference;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service A.
+ */
+@Conversational
+public interface AComponent {
+
+ public String getName();
+
+ public void testConversationID();
+ public String getCallbackResult();
+ public void redirectCallback();
+ public void testGetCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/BCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/BCallback.java
new file mode 100644
index 0000000000..f8c5c1272f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/BCallback.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.vtest.javaapi.apis.servicereference;
+
+public interface BCallback {
+
+ public void processResults(String result);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/BComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/BComponent.java
new file mode 100644
index 0000000000..33a4d6edcc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/BComponent.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.vtest.javaapi.apis.servicereference;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service B.
+ */
+@Conversational
+@Callback(BCallback.class)
+public interface BComponent {
+
+ public String getName();
+
+ public void testCallback();
+ public void testConversationID();
+ public void testRedirectedCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/CComponent.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/CComponent.java
new file mode 100644
index 0000000000..28c90e2071
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/CComponent.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.vtest.javaapi.apis.servicereference;
+
+/**
+ * Simple Service C.
+ */
+public interface CComponent extends BCallback {
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/AComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/AComponentImpl.java
new file mode 100644
index 0000000000..545d037c53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/AComponentImpl.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.vtest.javaapi.apis.servicereference.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.AComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.BCallback;
+import org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.BComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.CComponent;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+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(AComponent.class)
+@Scope("CONVERSATION")
+public class AComponentImpl implements AComponent, BCallback {
+
+ private static Object monitor = new Object();
+ private static String returnMessage = null;
+
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected CallableReference<BComponent> bReference;
+
+ @Reference
+ protected ServiceReference<CComponent> cReference;
+
+ @ConversationID
+ protected String cid;
+
+ public String getName() {
+ return "ComponentA";
+ }
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public void testConversationID() {
+ ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+ bSR.setConversationID("AConversationID");
+ bSR.getService().testConversationID();
+
+ Assert.assertEquals("AConversationID", bSR.getConversation().getConversationID());
+ }
+
+ public String getCallbackResult() {
+ ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+ String cbID = "ComponentACallBack";
+ bSR.setCallbackID(cbID);
+ bSR.getService().testCallback();
+
+ // Wait for 30s max.
+ int count = 0;
+ synchronized(monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return returnMessage;
+ }
+
+ public void processResults(String result) {
+ returnMessage = result;
+ }
+
+ public void redirectCallback() {
+ ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+ bSR.setCallbackID("RedirectedCallBack");
+ bSR.setCallback(cReference);
+ bSR.getService().testRedirectedCallback();
+ }
+
+ public void testGetCallback() {
+ ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+ bSR.setCallback(cReference);
+ Assert.assertEquals(cReference, bSR.getCallback());
+
+ TestObject aCallback = new TestObject();
+ bSR.setCallback(aCallback);
+ Assert.assertEquals(aCallback, bSR.getCallback());
+ Assert.assertEquals(1, ((TestObject) bSR.getCallback()).getId());
+
+ TestObject bCallback = new TestObject();
+ bSR.setCallback(bCallback);
+ Assert.assertEquals(bCallback, bSR.getCallback());
+ Assert.assertEquals(2, ((TestObject) bSR.getCallback()).getId());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/BComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/BComponentImpl.java
new file mode 100644
index 0000000000..f4307667b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/BComponentImpl.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.vtest.javaapi.apis.servicereference.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.BCallback;
+import org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.BComponent;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+@Scope("CONVERSATION")
+public class BComponentImpl implements BComponent {
+
+ protected ComponentContext componentContext;
+
+ @Callback
+ protected BCallback callback;
+
+ @ConversationID
+ protected String cid;
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ public String getName() {
+ return "ComponentB";
+ }
+
+ public void testCallback() {
+ callback = componentContext.getRequestContext().getCallback();
+ callback.processResults("CallBackFromB");
+
+ CallableReference<BCallback> bCR = componentContext.getRequestContext().getCallbackReference();
+ Assert.assertEquals("ComponentACallBack", bCR.getCallbackID());
+ }
+
+ public void testConversationID() {
+ Assert.assertEquals("AConversationID", cid);
+ }
+
+ public void testRedirectedCallback() {
+ callback = componentContext.getRequestContext().getCallback();
+ callback.processResults("RedirectedCallBackFromB");
+
+ CallableReference<BCallback> bCR = componentContext.getRequestContext().getCallbackReference();
+ Assert.assertEquals("RedirectedCallBack", bCR.getCallbackID());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/CComponentImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/CComponentImpl.java
new file mode 100644
index 0000000000..099655ea22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/CComponentImpl.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.vtest.javaapi.apis.servicereference.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.CComponent;
+import org.junit.Assert;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(CComponent.class)
+public class CComponentImpl implements CComponent {
+
+ @Context
+ protected RequestContext requestContext;
+
+ public void processResults(String result) {
+ Assert.assertEquals("RedirectedCallBackFromB", result);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/TestObject.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/TestObject.java
new file mode 100644
index 0000000000..ba3edf13ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/impl/TestObject.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.vtest.javaapi.apis.servicereference.impl;
+
+public class TestObject {
+
+ public static int count = 0;
+
+ private int id;
+
+ public TestObject() {
+ count++;
+ id = count;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/resources/servicereference.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/resources/servicereference.composite
new file mode 100644
index 0000000000..9bded61947
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/main/resources/servicereference.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:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java-api-tests"
+ name="ServiceReference-Composite">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.impl.AComponentImpl"/>
+ <reference name="bReference" target="BComponent"/>
+ <reference name="cReference" target="CComponent"/>
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.impl.BComponentImpl"/>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.impl.CComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/ServiceReferenceTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/ServiceReferenceTestCase.java
new file mode 100644
index 0000000000..fda917d60a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/apis/servicereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/ServiceReferenceTestCase.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.vtest.javaapi.apis.servicereference;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * This test class tests the ServiceReference interface described in 1.7.4 of
+ * the SCA Java Annotations & APIs Specification 1.0.
+ */
+public class ServiceReferenceTestCase {
+
+ protected static String compositeName = "servicereference.composite";
+ protected static AComponent a;
+ protected static BComponent b;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a = ServiceFinder.getService(AComponent.class, "AComponent");
+ b = ServiceFinder.getService(BComponent.class, "BComponent");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Lines 915-916 <br>
+ * getConversationID() - Returns the id supplied by the user that will be
+ * associated with conversations initiated through this reference. <br>
+ * setConversationID(Object conversationId) – 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. Throws an
+ * IllegalStateException if a conversation is currently associated with this
+ * reference.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testConversationID() throws Exception {
+ a.testConversationID();
+ }
+
+ /**
+ * Lines 917 <br>
+ * setCallbackID(Object callbackID) – Sets the callback ID.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testSetCallbackID() throws Exception {
+ Assert.assertEquals("CallBackFromB", a.getCallbackResult());
+ }
+
+ /**
+ * Lines 918 <br>
+ * getCallback() – Returns the callback object.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetCallback() throws Exception {
+ a.testGetCallback();
+ }
+
+ /**
+ * Lines 919 <br>
+ * setCallback(Object callback) – Sets the callback object.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testSetCallback() throws Exception {
+ a.redirectCallback();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/pom.xml
new file mode 100644
index 0000000000..c8abe7ced7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-conversation-callback</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Conversation - Callback</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/AService.java
new file mode 100644
index 0000000000..e78736d4df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/AService.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.vtest.javaapi.conversation.callback;
+
+/**
+ * Simple Service
+ */
+public interface AService {
+
+ public void testCallback();
+
+ public void testCallback2();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/AServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/AServiceCallback.java
new file mode 100644
index 0000000000..0a90f9c99a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/AServiceCallback.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.vtest.javaapi.conversation.callback;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+@Conversational
+public interface AServiceCallback {
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/BService.java
new file mode 100644
index 0000000000..0e61247294
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/BService.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.vtest.javaapi.conversation.callback;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AServiceCallback;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+@Conversational
+@Callback(AServiceCallback.class)
+public interface BService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/BServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/BServiceCallback.java
new file mode 100644
index 0000000000..e317a6e7e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/BServiceCallback.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.vtest.javaapi.conversation.callback;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+@Conversational
+public interface BServiceCallback {
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CService.java
new file mode 100644
index 0000000000..6446e006bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CService.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.vtest.javaapi.conversation.callback;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+@Conversational
+@Callback(BServiceCallback.class)
+public interface CService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/Utilities.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/Utilities.java
new file mode 100644
index 0000000000..15672f9ee0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/Utilities.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.vtest.javaapi.conversation.callback;
+
+public class Utilities {
+
+ public static void delayQuarterSecond() {
+ try {
+ Thread.sleep(250);// millisecs
+ } catch (InterruptedException ex) {
+ throw new Error(ex);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/AServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/AServiceCallback.java
new file mode 100644
index 0000000000..400c696d82
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/AServiceCallback.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.vtest.javaapi.conversation.callback.accessing;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+@Conversational
+public interface AServiceCallback {
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/BService.java
new file mode 100644
index 0000000000..33421cb4d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/BService.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.vtest.javaapi.conversation.callback.accessing;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+@Conversational
+@Callback(AServiceCallback.class)
+public interface BService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+
+ public void testCallBack2(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/impl/AServiceImpl.java
new file mode 100644
index 0000000000..1b220abf69
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/impl/AServiceImpl.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.vtest.javaapi.conversation.callback.accessing.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.accessing.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.accessing.BService;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService, AServiceCallback {
+
+ @Reference
+ protected ServiceReference<BService> b;
+
+ private String someState;
+
+ public void callBack(String someState) {
+ System.out.println("A-callback called with this state => " + someState);
+ this.someState = someState;
+ }
+
+ public void testCallback() {
+ b.getService().testCallBack("Some string");
+ int count = 4;
+ while (someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (someState == null)
+ Assert.fail("Callback not received by this instance");
+ }
+
+ public void testCallback2() {
+ b.getService().testCallBack2("Some string");
+ int count = 4;
+ while (someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (someState == null)
+ Assert.fail("Callback not received by this instance");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/impl/BServiceImpl.java
new file mode 100644
index 0000000000..957957a2e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/accessing/impl/BServiceImpl.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.vtest.javaapi.conversation.callback.accessing.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.accessing.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.accessing.BService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+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(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService {
+
+ String someState;
+
+ @Callback
+ protected CallableReference<AServiceCallback> callback;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testCallBack(String someState) {
+ callback.getService().callBack(someState);
+ }
+
+ public void testCallBack2(String someState) {
+ AServiceCallback callback = componentContext.getRequestContext().getCallback();
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/AServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/AServiceCallback.java
new file mode 100644
index 0000000000..4ef741c1c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/AServiceCallback.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.vtest.javaapi.conversation.callback.custom;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+@Conversational
+public interface AServiceCallback {
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/BService.java
new file mode 100644
index 0000000000..bba4bf2611
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/BService.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.vtest.javaapi.conversation.callback.custom;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+@Conversational
+@Callback(AServiceCallback.class)
+public interface BService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/CustomCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/CustomCallback.java
new file mode 100644
index 0000000000..4fb4fa53de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/CustomCallback.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.vtest.javaapi.conversation.callback.custom;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+@Conversational
+public interface CustomCallback {
+
+ public void someMethod();
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/AServiceImpl.java
new file mode 100644
index 0000000000..83453397b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/AServiceImpl.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.vtest.javaapi.conversation.callback.custom.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.custom.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.custom.CustomCallback;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService {
+
+ @Reference
+ protected ServiceReference<BService> b;
+
+ @Reference
+ protected CustomCallback customCallback;
+
+ protected static String someState;
+
+ public void testCallback() {
+ b.setCallback(customCallback);
+ b.getService().testCallBack("Some string");
+ int count = 4;
+ while (someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (someState == null)
+ Assert.fail("Callback not received by this instance");
+ }
+
+ public void testCallback2() {
+ Assert.fail("Should never get here");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/BServiceImpl.java
new file mode 100644
index 0000000000..c165aa51da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/BServiceImpl.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.vtest.javaapi.conversation.callback.custom.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.custom.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.custom.BService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService {
+
+ String someState;
+
+ @Callback
+ protected AServiceCallback callback;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testCallBack(String someState) {
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/CustomCallbackImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/CustomCallbackImpl.java
new file mode 100644
index 0000000000..c0440a2b1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/custom/impl/CustomCallbackImpl.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.vtest.javaapi.conversation.callback.custom.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.custom.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.custom.CustomCallback;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class CustomCallbackImpl implements CustomCallback, AServiceCallback {
+
+ public void someMethod() {
+ System.out.println("Custom-callback some method called");
+ }
+
+ public void callBack(String someState) {
+ System.out.println("Custom-callback called with this state => " + someState);
+ AServiceImpl.someState = someState;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/AServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/AServiceCallback.java
new file mode 100644
index 0000000000..8a237af0ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/AServiceCallback.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.vtest.javaapi.conversation.callback.id;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+@Conversational
+public interface AServiceCallback {
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/BService.java
new file mode 100644
index 0000000000..9c185ddee3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/BService.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.vtest.javaapi.conversation.callback.id;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+@Conversational
+@Callback(AServiceCallback.class)
+public interface BService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+
+ public void testCallBack2(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/impl/AServiceImpl.java
new file mode 100644
index 0000000000..2e79d135f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/impl/AServiceImpl.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.vtest.javaapi.conversation.callback.id.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.id.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.id.BService;
+import org.junit.Assert;
+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.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService, AServiceCallback {
+
+ @Reference
+ protected ServiceReference<BService> b;
+
+ @Context
+ protected RequestContext requestContext;
+
+ private String someState;
+
+ public void callBack(String someState) {
+ System.out.println("A-callback called with this state => " + someState);
+ Assert.assertNotNull(requestContext.getServiceReference().getCallbackID());
+ this.someState = someState;
+ }
+
+ public void testCallback() {
+ b.getService().testCallBack("Some string");
+ int count = 4;
+ while (someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (someState == null)
+ Assert.fail("Callback not received by this instance");
+ }
+
+ public void testCallback2() {
+ b.getService().testCallBack2("Some string");
+ int count = 4;
+ while (someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (someState == null)
+ Assert.fail("Callback not received by this instance");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/impl/BServiceImpl.java
new file mode 100644
index 0000000000..fb0d6b8a50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/id/impl/BServiceImpl.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.vtest.javaapi.conversation.callback.id.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.id.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.id.BService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+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(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService {
+
+ String someState;
+
+ @Callback
+ protected CallableReference<AServiceCallback> callback;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testCallBack(String someState) {
+ callback.getService().callBack(someState);
+ }
+
+ public void testCallBack2(String someState) {
+ AServiceCallback callback = componentContext.getRequestContext().getCallback();
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/AServiceImpl.java
new file mode 100644
index 0000000000..1ace5858b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/AServiceImpl.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.vtest.javaapi.conversation.callback.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService, AServiceCallback {
+
+ @Reference
+ protected ServiceReference<BService> b;
+
+ private String someState;
+
+ public void callBack(String someState) {
+ System.out.println("A-callback called with this state => " + someState);
+ this.someState = someState;
+ }
+
+ public void testCallback() {
+ b.getService().testCallBack("Some string");
+ int count = 4;
+ while (someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (someState == null)
+ Assert.fail("Callback not received by this instance");
+ }
+
+ public void testCallback2() {
+ Assert.fail("Should not be called");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/BServiceImpl.java
new file mode 100644
index 0000000000..52d8fe5a7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/BServiceImpl.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.vtest.javaapi.conversation.callback.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService, BServiceCallback {
+
+ String someState;
+
+ @Callback
+ protected AServiceCallback callback;
+
+ @Reference
+ protected ServiceReference<CService> c;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void callBack(String someState) {
+ System.out.println("B-callback called with this state => " + someState);
+ this.someState = someState;
+ }
+
+ public void testCallBack(String someState) {
+
+ c.getService().testCallBack(someState);
+ int count = 4;
+ while (this.someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (this.someState == null)
+ Assert.fail("Callback not received by this instance");
+
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/CServiceImpl.java
new file mode 100644
index 0000000000..eea769b2fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/impl/CServiceImpl.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.vtest.javaapi.conversation.callback.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.CService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+@Scope("CONVERSATION")
+public class CServiceImpl implements CService {
+
+ String someState;
+
+ @Callback
+ protected BServiceCallback callback;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testCallBack(String someState) {
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/AServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/AServiceCallback.java
new file mode 100644
index 0000000000..1caa467348
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/AServiceCallback.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.vtest.javaapi.conversation.callback.local;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ *
+ */
+@Conversational
+public interface AServiceCallback {
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/BService.java
new file mode 100644
index 0000000000..a7f471aa26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/BService.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.vtest.javaapi.conversation.callback.local;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Local Service
+ */
+@Conversational
+@Callback(AServiceCallback.class)
+public interface BService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/BServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/BServiceCallback.java
new file mode 100644
index 0000000000..4aeeca6dc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/BServiceCallback.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.vtest.javaapi.conversation.callback.local;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service
+ */
+@Conversational
+public interface BServiceCallback {
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/CService.java
new file mode 100644
index 0000000000..014f1edd33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/CService.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.vtest.javaapi.conversation.callback.local;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service
+ */
+@Conversational
+@Callback(BServiceCallback.class)
+public interface CService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/AServiceImpl.java
new file mode 100644
index 0000000000..4e6dce6fb9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/AServiceImpl.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.vtest.javaapi.conversation.callback.local.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.BService;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService, AServiceCallback {
+
+ @Reference
+ protected ServiceReference<BService> b;
+
+ private String someState;
+
+ public void callBack(String someState) {
+ System.out.println("A-callback called with this state => " + someState);
+ this.someState = someState;
+ }
+
+ public void testCallback() {
+ b.getService().testCallBack("Some local string");
+ int count = 4;
+ while (someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (someState == null)
+ Assert.fail("Callback not received by this instance");
+ }
+
+ public void testCallback2() {
+ Assert.fail("Not implemented");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/BServiceImpl.java
new file mode 100644
index 0000000000..2f560fe87b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/BServiceImpl.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.vtest.javaapi.conversation.callback.local.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.CService;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService, BServiceCallback {
+
+ String someState;
+
+ @Callback
+ protected AServiceCallback callback;
+
+ @Reference
+ protected ServiceReference<CService> c;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void callBack(String someState) {
+ System.out.println("B-callback called with this state => " + someState);
+ this.someState = someState;
+ }
+
+ public void testCallBack(String someState) {
+
+ c.getService().testCallBack(someState);
+ int count = 4;
+ while (this.someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (this.someState == null)
+ Assert.fail("Callback not received by this instance");
+
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/CServiceImpl.java
new file mode 100644
index 0000000000..23e0d0e70b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/local/impl/CServiceImpl.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.vtest.javaapi.conversation.callback.local.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.CService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+@Scope("CONVERSATION")
+public class CServiceImpl implements CService {
+
+ String someState;
+
+ @Callback
+ protected BServiceCallback callback;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testCallBack(String someState) {
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/CService.java
new file mode 100644
index 0000000000..705e101a01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/CService.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.vtest.javaapi.conversation.callback.mixed;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BServiceCallback;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service
+ */
+@Conversational
+@Callback(BServiceCallback.class)
+public interface CService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/impl/BServiceImpl.java
new file mode 100644
index 0000000000..c03b1aedc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/impl/BServiceImpl.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.vtest.javaapi.conversation.callback.mixed.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.mixed.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService, BServiceCallback {
+
+ String someState;
+
+ @Callback
+ protected AServiceCallback callback;
+
+ @Reference
+ protected ServiceReference<CService> c;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void callBack(String someState) {
+ System.out.println("B-callback called with this state => " + someState);
+ this.someState = someState;
+ }
+
+ public void testCallBack(String someState) {
+
+ c.getService().testCallBack(someState);
+ int count = 4;
+ while (this.someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (this.someState == null)
+ Assert.fail("Callback not received by this instance");
+
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/impl/CServiceImpl.java
new file mode 100644
index 0000000000..8e068c8be4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/mixed/impl/CServiceImpl.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.vtest.javaapi.conversation.callback.mixed.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.mixed.CService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+@Scope("CONVERSATION")
+public class CServiceImpl implements CService {
+
+ String someState;
+
+ @Callback
+ protected BServiceCallback callback;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testCallBack(String someState) {
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/AServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/AServiceCallback.java
new file mode 100644
index 0000000000..16b2932afc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/AServiceCallback.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.vtest.javaapi.conversation.callback.multi;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+@Conversational
+public interface AServiceCallback {
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/AServiceCallback2.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/AServiceCallback2.java
new file mode 100644
index 0000000000..56b7006581
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/AServiceCallback2.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.vtest.javaapi.conversation.callback.multi;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+@Conversational
+public interface AServiceCallback2 {
+
+ public void callBack2(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/BService.java
new file mode 100644
index 0000000000..580cf5a612
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/BService.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.vtest.javaapi.conversation.callback.multi;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+@Conversational
+@Callback(AServiceCallback.class)
+public interface BService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/BService2.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/BService2.java
new file mode 100644
index 0000000000..144492984a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/BService2.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.vtest.javaapi.conversation.callback.multi;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+@Conversational
+@Callback(AServiceCallback2.class)
+public interface BService2 {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack2(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/impl/AServiceImpl.java
new file mode 100644
index 0000000000..ce7214dba1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/impl/AServiceImpl.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.vtest.javaapi.conversation.callback.multi.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.AServiceCallback2;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.BService2;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService, AServiceCallback , AServiceCallback2 {
+
+ @Reference
+ protected ServiceReference<BService> b;
+
+ @Reference
+ protected ServiceReference<BService2> b2;
+
+
+ private String someState;
+ private String someState2;
+
+ public void callBack(String someState) {
+ System.out.println("A-callback called with this state => " + someState);
+ this.someState = someState;
+ }
+
+ public void callBack2(String someState) {
+ System.out.println("A-callback2 called with this state => " + someState);
+ this.someState2 = someState;
+ }
+
+ public void testCallback() {
+ b.getService().testCallBack("Some string");
+ int count = 4;
+ while (someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (someState == null)
+ Assert.fail("Callback not received by this instance");
+ }
+
+ public void testCallback2() {
+ b2.getService().testCallBack2("Some string");
+ int count = 4;
+ while (someState2 == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (someState2 == null)
+ Assert.fail("Callback not received by this instance");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/impl/BServiceImpl.java
new file mode 100644
index 0000000000..b61a15cbee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/multi/impl/BServiceImpl.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.vtest.javaapi.conversation.callback.multi.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.AServiceCallback2;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.BService2;
+import org.junit.Assert;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces= {BService.class,BService2.class})
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService, BService2 {
+
+ String someState;
+
+ @Callback
+ protected AServiceCallback callback;
+
+ @Callback
+ protected AServiceCallback2 callback2;
+
+ @Callback
+ protected AServiceCallback2 callback3;
+
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testCallBack(String someState) {
+ callback.callBack(someState);
+ }
+
+ public void testCallBack2(String someState) {
+ Assert.assertNotNull(callback3); //Spec lines 670,671
+ callback2.callBack2(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/BServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/BServiceCallback.java
new file mode 100644
index 0000000000..cb9aee2b9f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/BServiceCallback.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.vtest.javaapi.conversation.callback.stateless;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+public interface BServiceCallback {
+
+ public void callBack(String someState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/CService.java
new file mode 100644
index 0000000000..1fe70344af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/CService.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.vtest.javaapi.conversation.callback.stateless;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service
+ */
+@Remotable
+@Conversational
+@Callback(BServiceCallback.class)
+public interface CService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testCallBack(String string);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl.java
new file mode 100644
index 0000000000..033fa9d097
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl.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.vtest.javaapi.conversation.callback.stateless.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService, BServiceCallback {
+
+ String someState;
+
+ @Callback
+ protected AServiceCallback callback;
+
+ @Reference
+ protected ServiceReference<CService> c;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void callBack(String someState) {
+ System.out.println("B-callback called with this state => " + someState);
+ this.someState = someState;
+ }
+
+ public void testCallBack(String someState) {
+
+ c.getService().testCallBack(someState);
+ int count = 4;
+ while (this.someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (this.someState != null)
+ Assert.fail("Callback should NOT have been received by this instance");
+
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl2.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl2.java
new file mode 100644
index 0000000000..5f7d8d9c94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl2.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.vtest.javaapi.conversation.callback.stateless.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.junit.Assert;
+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.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl2 implements BService, BServiceCallback {
+
+ String someState;
+
+ @Context
+ protected RequestContext rc;
+
+ @Callback
+ protected AServiceCallback callback;
+
+ @Reference
+ protected ServiceReference<CService> c;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void callBack(String someState) {
+ System.out.println("B-callback called with this state => " + someState);
+ this.someState = someState;
+ Assert.assertSame("1234", rc.getServiceReference().getCallbackID());
+ }
+
+ public void testCallBack(String someState) {
+
+ c.setCallbackID("1234");
+
+ c.getService().testCallBack(someState);
+ int count = 4;
+ while (this.someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (this.someState != null)
+ Assert.fail("Callback should NOT have been received by this instance");
+
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl3.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl3.java
new file mode 100644
index 0000000000..47d5d53821
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/BServiceImpl3.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.vtest.javaapi.conversation.callback.stateless.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.Utilities;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl3 implements BService, BServiceCallback {
+
+ String someState;
+
+ @Callback
+ protected AServiceCallback callback;
+
+ @Reference
+ protected ServiceReference<CService> c;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void callBack(String someState) {
+ System.out.println("B-callback called with this state => " + someState);
+ this.someState = someState;
+ Assert.assertSame(null, callback);
+ }
+
+ public void testCallBack(String someState) {
+
+ c.getService().testCallBack(someState);
+ int count = 4;
+ while (this.someState == null && count > 0) {
+ Utilities.delayQuarterSecond();
+ count--;
+ }
+ if (this.someState != null)
+ Assert.fail("Callback should NOT have been received by this instance");
+
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/CServiceImpl.java
new file mode 100644
index 0000000000..18ce5edebe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/stateless/impl/CServiceImpl.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.vtest.javaapi.conversation.callback.stateless.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.BServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.CService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+@Scope("CONVERSATION")
+public class CServiceImpl implements CService {
+
+ String someState;
+
+ @Callback
+ protected BServiceCallback callback;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testCallBack(String someState) {
+ callback.callBack(someState);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-accessing.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-accessing.composite
new file mode 100644
index 0000000000..802c9c30db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-accessing.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://java-api-tests" name="Conversation-callback-multi">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.accessing.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.accessing.impl.BServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-custom.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-custom.composite
new file mode 100644
index 0000000000..e66ea5d537
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-custom.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Conversation-callback-custom">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.custom.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ <reference name="customCallback" target="CComponent/CustomCallback" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.custom.impl.BServiceImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.custom.impl.CustomCallbackImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-id.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-id.composite
new file mode 100644
index 0000000000..4d93d2279d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-id.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://java-api-tests" name="Conversation-callback-id">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.id.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.id.impl.BServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-local.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-local.composite
new file mode 100644
index 0000000000..cd8c589a59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-local.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Conversation-Callback-local">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.impl.BServiceImpl" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.local.impl.CServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-mixed.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-mixed.composite
new file mode 100644
index 0000000000..d2d9956103
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-mixed.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Conversation-callback-mixed">
+<!-- TODO: TUSCANY-2291
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.mixed.impl.BServiceImpl" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.mixed.impl.CServiceImpl" />
+ </component>
+-->
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-multi.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-multi.composite
new file mode 100644
index 0000000000..6c69330ce5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-multi.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"
+ targetNamespace="http://java-api-tests" name="Conversation-callback-multi">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.impl.AServiceImpl" />
+ <reference name="b" target="BComponent/BService" />
+ <reference name="b2" target="BComponent/BService2" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.multi.impl.BServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless-callbackfieldnull.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless-callbackfieldnull.composite
new file mode 100644
index 0000000000..72c08e8344
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless-callbackfieldnull.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Conversation-callback-stateless">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.impl.BServiceImpl3" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.impl.CServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless-callbackid.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless-callbackid.composite
new file mode 100644
index 0000000000..144f7f3d00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless-callbackid.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Conversation-callback-stateless">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.impl.BServiceImpl2" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.impl.CServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless.composite
new file mode 100644
index 0000000000..ace06b245c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback-stateless.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://java-api-tests" name="Conversation-callback-stateless">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.impl.BServiceImpl" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.stateless.impl.CServiceImpl" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback.composite
new file mode 100644
index 0000000000..4623f17ca2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/main/resources/callback.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Conversation-callback">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.impl.BServiceImpl" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.callback.impl.CServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CallbackTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CallbackTestCase.java
new file mode 100644
index 0000000000..dc681a4e7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/callback/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CallbackTestCase.java
@@ -0,0 +1,377 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.conversation.callback;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ *
+ */
+public class CallbackTestCase {
+
+ protected static AService aService = null;
+
+ @Before
+ public void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @After
+ public void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+
+ /**
+ * Lines 529-610
+ * <p>
+ * A callback service is a service that is used for asynchronous
+ * communication from a service provider back to its client in contrast to
+ * the communication through return values from synchronous operations.
+ * Callbacks are used by bidirectional services, which are services that
+ * have two interfaces: • an interface for the provided service • a callback
+ * interface that must be provided by the client
+ * <p>
+ * Callbacks may be used for both remotable and local services. Either both
+ * interfaces of a bidirectional service must be remotable, or both must be
+ * local. It is illegal to mix the two. There are two basic forms of
+ * callbacks: stateless callbacks and stateful callbacks. A callback
+ * interface is declared by using the "@Callback" annotation on a remotable
+ * service interface, which takes the Java Class object of the interface as
+ * a parameter. The annotation may also be applied to a method or to a field
+ * of an implementation, which is used in order to have a callback injected,
+ * as explained in the next section.
+ * <p>
+ * 1.6.7.1. Stateful Callbacks A stateful callback represents a specific
+ * implementation instance of the component that is the client of the
+ * service. The interface of a stateful callback should be marked as
+ * conversational. The following example interfaces define an interaction
+ * over stateful callback.
+ * <p>
+ * An implementation of the service in this example could use the
+ * "@Callback" annotation to request that a stateful callback be injected.
+ * The following is a fragment of an implementation of the example service.
+ * In this example, the request is passed on to some other component, so
+ * that the example service acts essentially as an intermediary. Because the
+ * service is conversation scoped, the callback will still be available when
+ * the backend service sends back its asynchronous response.
+ * <p>
+ * This fragment must come from an implementation that offers two services,
+ * one that it offers to it clients (MyService) and one that is used for
+ * receiving callbacks from the back end (MyServiceCallback). The client of
+ * this service would also implement the methods defined in
+ * MyServiceCallback.
+ * <p>
+ * Stateful callbacks support some of the same use cases as are supported by
+ * the ability to pass service references as parameters. The primary
+ * difference is that stateful callbacks do not require any additional
+ * parameters be passed with service operations. This can be a great
+ * convenience. If the service has many operations and any of those
+ * operations could be the first operation of the conversation, it would be
+ * unwieldy to have to take a callback parameter as part of every operation,
+ * just in case it is the first operation of the conversation. It is also
+ * more natural than requiring the application developers to invoke an
+ * explicit operation whose only purpose is to pass the callback object that
+ * should be used.
+ * <p>
+ * This tests the *remote* bidirectional interfaces option
+ */
+ @Test
+ public void statefulCallback() throws Exception {
+ System.out.println("Setting up for callback tests");
+ ServiceFinder.init("callback.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+ }
+
+ /**
+ * Lines 529-610
+ * <p>
+ * A callback service is a service that is used for asynchronous
+ * communication from a service provider back to its client in contrast to
+ * the communication through return values from synchronous operations.
+ * Callbacks are used by bidirectional services, which are services that
+ * have two interfaces: • an interface for the provided service • a callback
+ * interface that must be provided by the client
+ * <p>
+ * Callbacks may be used for both remotable and local services. Either both
+ * interfaces of a bidirectional service must be remotable, or both must be
+ * local. It is illegal to mix the two. There are two basic forms of
+ * callbacks: stateless callbacks and stateful callbacks. A callback
+ * interface is declared by using the "@Callback" annotation on a remotable
+ * service interface, which takes the Java Class object of the interface as
+ * a parameter. The annotation may also be applied to a method or to a field
+ * of an implementation, which is used in order to have a callback injected,
+ * as explained in the next section.
+ * <p>
+ * 1.6.7.1. Stateful Callbacks A stateful callback represents a specific
+ * implementation instance of the component that is the client of the
+ * service. The interface of a stateful callback should be marked as
+ * conversational. The following example interfaces define an interaction
+ * over stateful callback.
+ * <p>
+ * An implementation of the service in this example could use the
+ * "@Callback" annotation to request that a stateful callback be injected.
+ * The following is a fragment of an implementation of the example service.
+ * In this example, the request is passed on to some other component, so
+ * that the example service acts essentially as an intermediary. Because the
+ * service is conversation scoped, the callback will still be available when
+ * the backend service sends back its asynchronous response.
+ * <p>
+ * This fragment must come from an implementation that offers two services,
+ * one that it offers to it clients (MyService) and one that is used for
+ * receiving callbacks from the back end (MyServiceCallback). The client of
+ * this service would also implement the methods defined in
+ * MyServiceCallback.
+ * <p>
+ * Stateful callbacks support some of the same use cases as are supported by
+ * the ability to pass service references as parameters. The primary
+ * difference is that stateful callbacks do not require any additional
+ * parameters be passed with service operations. This can be a great
+ * convenience. If the service has many operations and any of those
+ * operations could be the first operation of the conversation, it would be
+ * unwieldy to have to take a callback parameter as part of every operation,
+ * just in case it is the first operation of the conversation. It is also
+ * more natural than requiring the application developers to invoke an
+ * explicit operation whose only purpose is to pass the callback object that
+ * should be used.
+ * <p>
+ * This tests the *local* bidirectional interfaces option
+ */
+ @Test
+ public void localstatefulCallback() throws Exception {
+ System.out.println("Setting up for local callback tests");
+ ServiceFinder.init("callback-local.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+ }
+
+ /**
+ * Lines 534, 535
+ * <p>
+ * Callbacks may be used for both remotable and local services. Either both
+ * interfaces of a bidirectional service must be remotable, or both must be
+ * local. It is illegal to mix the two.
+ * <p>
+ * In this test configuration BServiceCallback is remotable and CService is
+ * not
+ */
+ @Test(expected = ServiceRuntimeException.class)
+ @Ignore("TUSCANY-2291")
+ public void statefulMixedCallback() throws Exception {
+ System.out.println("Setting up for mixed local/remote callback tests");
+ ServiceFinder.init("callback-mixed.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+ }
+
+ /**
+ * Lines 613-615
+ * <p>
+ * A stateless callback interface is a callback whose interface is not
+ * marked as conversational. Unlike stateless services, the client of that
+ * uses stateless callbacks will not have callback methods routed to an
+ * instance of the client that contains any state that is relevant to the
+ * conversation.
+ * <p>
+ * This test is identical in structure to the stateful test except that
+ * BServiceCallback is not conversational and we test that the callback is
+ * NOT routed to the same instance.
+ */
+ @Test
+ public void statelessCallback() throws Exception {
+ System.out.println("Setting up for stateless callback tests");
+ ServiceFinder.init("callback-stateless.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+ }
+
+ /**
+ * Lines 616-621
+ * <p>
+ * The only information that the client has to work with (other than the
+ * parameters of the callback method) is a callback ID object that is passed
+ * with requests to the service and is guaranteed to be returned with any
+ * callback.
+ * <p>
+ * The following is a repeat of the client code fragment above, but with the
+ * assumption that in this case the MyServiceCallback is stateless. The
+ * client in this case needs to set the callback ID before invoking the
+ * service and then needs to get the callback ID when the response is
+ * received.
+ * <p>
+ * Lines 747-755
+ * <p>
+ * The identity that is used to identify a callback request is, by default,
+ * generated by the system. However, it is possible to provide an
+ * application specified identity that should be used to identify the
+ * callback by calling the ServiceReference.setCallbackID() method. This can
+ * be used even either stateful or stateless callbacks. The identity will be
+ * sent to the service provider, and the binding must guarantee that the
+ * service provider will send the ID back when any callback method is
+ * invoked. The callback identity has the same restrictions as the
+ * conversation ID. It should either be a string or an object that can be
+ * serialized into XML. Bindings determine the particular mechanisms to use
+ * for transmission of the identity and these may lead to further
+ * restrictions when using a given binding.
+ * <p>
+ * TODO - Need to add explicit test back to stateful for 747-755
+ */
+ @Test
+ public void statelessCallback2() throws Exception {
+ System.out.println("Setting up for stateless callback id tests");
+ ServiceFinder.init("callback-stateless-callbackid.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+
+ }
+
+ /**
+ * Lines 650-654
+ * <p>
+ * The difference for stateless services is that the callback field would
+ * not be available if the component is servicing a request for anything
+ * other than the original client. So, the technique used in the previous
+ * section, where there was a response from the backend Service which was
+ * forwarded as a callback from MyService would not work because the
+ * callback field would be null when the message from the backend system was
+ * received.
+ * <p>
+ */
+ @Test
+ public void statelessCallback3() throws Exception {
+ System.out.println("Setting up for stateless callback ref null tests");
+ ServiceFinder.init("callback-stateless-callbackfieldnull.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+
+ }
+
+ /**
+ * Lines 658-669
+ * <p>
+ * Since it is possible for a single implementation class to implement
+ * multiple services, it is also possible for callbacks to be defined for
+ * each of the services that it implements. The service implementation can
+ * include an injected field for each of its callbacks. The runtime injects
+ * the callback onto the appropriate field based on the type of the
+ * callback. The following shows the declaration of two fields, each of
+ * which corresponds to a particular service offered by the implementation.
+ * <p>
+ * Lines 670,671
+ * <p>
+ * If a single callback has a type that is compatible with multiple declared
+ * callback fields, then all of them will be set.
+ */
+ @Test
+ public void statefulMultiBidirectional() throws Exception {
+ System.out.println("Setting up for multi-bidirectional interfaces tests");
+ ServiceFinder.init("callback-multi.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+ aService.testCallback2(); // Includes test for 670,671
+
+ }
+
+ /**
+ * Lines 675-706
+ * <p>
+ * In addition to injecting a reference to a callback service, it is also
+ * possible to obtain a reference to a Callback instance by annotating a
+ * field or method with the "@Callback" annotation. A reference implementing
+ * the callback service interface may be obtained using
+ * CallableReference.getService(). The following fragments come from a
+ * service implementation that uses the callback API:
+ * <p>
+ * Alternatively a callback may be retrieved programmatically using the
+ * RequestContext API. The snippet below show how to retrieve a callback in
+ * a method programmatically:
+ * <p>
+ * Lines 695, 696
+ * <p>
+ * Alternatively a callback may be retrieved programmatically using the
+ * RequestContext API. The snippet below show how to retrieve a callback in
+ * a method programmatically:
+ */
+ @Test
+ public void accessingCallbacks() throws Exception {
+ System.out.println("Setting up for callback accessing tests");
+ ServiceFinder.init("callback-accessing.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+ aService.testCallback2(); // Lines 695-696
+
+ }
+
+ /**
+ * Lines 708-724
+ * <p>
+ * On the client side, the service that implements the callback can access
+ * the callback ID (i.e. reference parameters) that was returned with the
+ * callback operation also by accessing the request context, as follows:
+ * <p>
+ * On the client side, the object returned by the getServiceReference()
+ * method represents the service reference that was used to send the
+ * original request. The object returned by getCallbackID() represents the
+ * identity associated with the callback, which may be a single String or
+ * may be an object (as described below in “Customizing the Callback
+ * Identity”).
+ */
+ @Test
+ public void callbackId() throws Exception {
+ System.out.println("Setting up for callback id tests");
+ ServiceFinder.init("callback-id.composite");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+
+ }
+
+ /**
+ * Lines 728-732
+ * <p>
+ * By default, the client component of a service is assumed to be the
+ * callback service for the bidirectional service. However, it is possible
+ * to change the callback by using the ServiceReference.setCallback()
+ * method. The object passed as the callback should implement the interface
+ * defined for the callback, including any additional SCA semantics on that
+ * interface such as its scope and whether or not it is remotable.
+ * <p>
+ * TODO - Need to complete testing of 1.6.7.5 after resolution of t-2312
+ */
+ @Test
+ public void customCallback() throws Exception {
+ System.out.println("Setting up for custom callback tests; create domain instance");
+ ServiceFinder.init("callback-custom.composite");
+ System.out.println("Setting up for custom callback tests; get AService handle");
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ aService.testCallback();
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/pom.xml
new file mode 100644
index 0000000000..77a52c6237
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-conversation-id</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Conversation - ID</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/AService.java
new file mode 100644
index 0000000000..f49952828c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/AService.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.vtest.javaapi.conversation.id;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+public interface AService {
+
+ public void testAnnotation();
+
+ public void testAnnotation2();
+
+ public void testAnnotation3();
+
+ public void testAnnotation4();
+
+ public void testAnnotation5();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/BService.java
new file mode 100644
index 0000000000..d4641c5ee6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/BService.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.vtest.javaapi.conversation.id;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Local Service
+ */
+@Remotable
+@Conversational
+public interface BService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testAnnotation();
+
+ public void testAnnotation2();
+
+ public void testAnnotation3();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.java
new file mode 100644
index 0000000000..66a9b3b6c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CService.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.vtest.javaapi.conversation.id;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Local Service
+ */
+@Remotable
+@Conversational
+public interface CService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ public void testAnnotation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.java
new file mode 100644
index 0000000000..ac40c56ee6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/CustomConversationId.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.vtest.javaapi.conversation.id;
+
+
+public class CustomConversationId {
+
+ int id;
+ String name;
+
+ public CustomConversationId(int id, String name) {
+ super();
+ this.id = id;
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getNumber() {
+ return id;
+ }
+
+ public void setName(String someName) {
+ name = someName;
+ }
+
+ public void setNumber(int someInt) {
+ id = someInt;
+ }
+
+ public String toString() {
+ return "id->" + id + " name->" + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/AServiceImpl.java
new file mode 100644
index 0000000000..517976ff73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/AServiceImpl.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.vtest.javaapi.conversation.id.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.AService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.CustomConversationId;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService {
+
+ @Reference
+ protected ServiceReference<BService> b;
+
+ @Reference
+ protected ServiceReference<CService> c;
+
+ public void testAnnotation() {
+ b.getService().testAnnotation();
+ }
+
+ public void testAnnotation2() {
+ b.getService().testAnnotation2();
+ }
+
+ public void testAnnotation3() {
+ b.getService().testAnnotation3();
+ }
+
+ public void testAnnotation4() {
+ CustomConversationId id = new CustomConversationId (1, "One");
+ c.setConversationID(id);
+ c.getService().testAnnotation();
+ }
+
+ public void testAnnotation5() {
+ b.getService().getState();
+ Assert.assertNotNull(b.getConversation().getConversationID());
+// Assert.assertNotNull(b.getConversationID());
+
+ CustomConversationId id = new CustomConversationId (1, "One");
+ c.setConversationID(id);
+ Assert.assertSame(id, c.getConversationID());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/BServiceImpl.java
new file mode 100644
index 0000000000..752476ebf7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/BServiceImpl.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.vtest.javaapi.conversation.id.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.BService;
+import org.junit.Assert;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge = "1 seconds")
+public class BServiceImpl implements BService {
+
+ String someState;
+
+ @ConversationID
+ protected String conversationID;
+
+ @ConversationID
+ protected Object conversationID2;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testAnnotation() {
+ Assert.assertNotNull(conversationID);
+ System.out.println(conversationID);
+ }
+
+ public void testAnnotation2() {
+ Assert.assertNotNull(conversationID2);
+ System.out.println(conversationID);
+ }
+
+ public void testAnnotation3() {
+ Assert.assertTrue(conversationID2 instanceof String);
+ System.out.println(conversationID);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.java
new file mode 100644
index 0000000000..a01ceb7be4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/impl/CServiceImpl.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.vtest.javaapi.conversation.id.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.id.CustomConversationId;
+import org.junit.Assert;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+@Scope("CONVERSATION")
+public class CServiceImpl implements CService {
+
+ String someState;
+
+ @ConversationID
+ protected Object conversationID;
+
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void testAnnotation() {
+ Assert.assertNotNull(conversationID);
+ Assert.assertTrue(conversationID instanceof CustomConversationId);
+
+ Assert.assertSame(1, ((CustomConversationId)conversationID).getNumber());
+ Assert.assertSame("One", ((CustomConversationId)conversationID).getName());
+ System.out.println(conversationID);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/resources/conversation-id.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/resources/conversation-id.composite
new file mode 100644
index 0000000000..25e7154fca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/main/resources/conversation-id.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Converstion-ID">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.id.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.id.impl.BServiceImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.id.impl.CServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ConversationIDTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ConversationIDTestCase.java
new file mode 100644
index 0000000000..d3cb107a61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/id/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/id/ConversationIDTestCase.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.vtest.javaapi.conversation.id;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ConversationIDTestCase {
+
+ protected static String compositeName = "conversation-id.composite";
+ protected static AService aService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Lines 504, 505
+ * <p>
+ * If a protected or public field or setter method is annotated with
+ * "@ConversationID", then the conversation ID for the conversation is
+ * injected onto the field
+ */
+ @Test
+ public void idAnnotation() throws Exception {
+ aService.testAnnotation();
+ }
+
+ /**
+ * Lines 505
+ * <p>
+ * The type of the field is not necessarily String
+ */
+ @Test
+ public void idAnnotation2() throws Exception {
+ aService.testAnnotation2();
+ }
+
+ /**
+ * Lines 505, 506
+ * <p>
+ * System generated conversation IDs are always strings
+ */
+ @Test
+ public void idAnnotation3() throws Exception {
+ aService.testAnnotation3();
+ }
+
+ /**
+ * Lines 506, 507
+ * <p>
+ * ... but application generated conversation IDs may be other complex
+ * types.
+ * <p>
+ * Lines 513, 514
+ * <p>
+ * ... To do this, the client would not use reference injection, but would
+ * use the of ServiceReference.setConversationID() API.
+ */
+ @Test
+ public void idAnnotation4() throws Exception {
+ aService.testAnnotation4();
+ }
+
+ /**
+ * Lines 522, 523
+ * <p>
+ * Whether the conversation ID is chosen by the client or is generated by
+ * the system, the client may access the conversation ID by calling
+ * ServiceReference.getConversationID().
+ * <p>
+ * This test is following updates to this section of the specification per
+ * the OASIS TC under issue JAVA-31. The updated text reads: "...by calling
+ * getConversationID() on the current conversation object".
+ */
+ @Test
+ public void idAnnotation5() throws Exception {
+ aService.testAnnotation5();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/pom.xml
new file mode 100644
index 0000000000..0d6c0f763c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-conversation-lifetime</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Conversation - Lifetime</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/AService.java
new file mode 100644
index 0000000000..8deef5df31
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/AService.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.vtest.javaapi.conversation.lifetime;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+public interface AService {
+
+ public void testConversationStarted();
+
+ public void testConversationStarted2();
+
+ public void testConversationContinue();
+
+ public void testConversationContinue2();
+
+ public void testConversationContinue3();
+
+ public void testConversationEnd();
+
+ public void testConversationEnd2();
+
+ public void testConversationEnd3();
+
+ public void testConversationEnd4();
+
+ public void testConversationEnd5();
+
+ public void testConversationEnd6();
+
+ public void testConversationEnd7();
+
+ public void testConversationEnd8();
+
+ public void testConversationEnd9();
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/AServiceCallback.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/AServiceCallback.java
new file mode 100644
index 0000000000..5a20f4d960
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/AServiceCallback.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.vtest.javaapi.conversation.lifetime;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remotable Service
+ */
+@Remotable
+@Conversational
+public interface AServiceCallback {
+
+ @EndsConversation
+ public void endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/BService.java
new file mode 100644
index 0000000000..6368b1157b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/BService.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.vtest.javaapi.conversation.lifetime;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Local Service
+ */
+@Remotable
+@Conversational
+@Callback(AServiceCallback.class)
+public interface BService {
+
+ public void setState(String someState);
+
+ public String getState();
+
+ @EndsConversation
+ public void endConversation();
+
+ public void endConversationViaCallback();
+
+ public void throwNonBusinessException();
+
+ public void throwBusinessException() throws BServiceBusinessException;
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/BServiceBusinessException.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/BServiceBusinessException.java
new file mode 100644
index 0000000000..ab186ee7eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/BServiceBusinessException.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.vtest.javaapi.conversation.lifetime;
+
+
+/**
+ * Denotes an error starting the runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public class BServiceBusinessException extends Exception {
+
+ static final long serialVersionUID = 2096658015909178325L;
+
+ private String message;
+
+ public BServiceBusinessException() {
+ }
+
+ public BServiceBusinessException(String message) {
+ super(message);
+ setMessage(message);
+ }
+
+ public BServiceBusinessException(Throwable cause) {
+ super(cause);
+ setMessage(cause.getMessage());
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/CService.java
new file mode 100644
index 0000000000..dcc2e5d9c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/CService.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.vtest.javaapi.conversation.lifetime;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Local Service
+ */
+@Remotable
+@Conversational
+public interface CService {
+
+ public void setState(String someState);
+ public String getState();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/DService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/DService.java
new file mode 100644
index 0000000000..06d40accd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/DService.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.vtest.javaapi.conversation.lifetime;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Local Service
+ */
+@Remotable
+@Conversational
+public interface DService {
+
+ public void setState(String someState);
+ public String getState();
+
+ public void continueConversation(ServiceReference<BService> b, Object convId);
+ public void continueConversation2(String filename, Object id, String serializedState);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/AServiceImpl.java
new file mode 100644
index 0000000000..56bfcabfc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/AServiceImpl.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.vtest.javaapi.conversation.lifetime.impl;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.AService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.BServiceBusinessException;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.CService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.DService;
+import org.junit.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.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService, AServiceCallback {
+
+ @Context
+ public ComponentContext context;
+
+ @Reference
+ protected ServiceReference<BService> b;
+
+ @Reference
+ protected DService d;
+
+ public void testConversationStarted() {
+ b.getService().setState("Some state");
+ Assert.assertNotNull(b.getConversation().getConversationID());
+ }
+
+ public void testConversationStarted2() {
+ ServiceReference<BService> ref = context.getServiceReference(BService.class, "b");
+ ref.getService().setState("Some state");
+ Assert.assertNotNull(ref.getConversation().getConversationID());
+ }
+
+ public void testConversationContinue() {
+
+ b.getService().setState("Some state");
+ Object id = b.getConversation().getConversationID();
+ b.getService().setState("Some more state");
+ Assert.assertEquals(id, b.getConversation().getConversationID());
+ }
+
+ public void testConversationContinue2() {
+
+ b.getService().setState("Some state");
+ d.continueConversation(b, b.getConversation().getConversationID());
+
+ }
+
+ public void testConversationContinue3() {
+
+ String serializedState = "Serialized State";
+
+ String filename = "target/Serialized-Reference.txt";
+ b.getService().setState(serializedState);
+ Object id = b.getConversation().getConversationID();
+ writeReference(b, filename);
+ d.continueConversation2(filename, id, serializedState);
+
+ }
+
+ // Utilities
+
+ private void delayForSeconds(int numSeconds) {
+ try {
+ Thread.sleep(numSeconds * 1000);// millisecs
+ } catch (InterruptedException ex) {
+ throw new Error(ex);
+ }
+ }
+
+ private void writeReference(ServiceReference<BService> ref, String filename) {
+
+ FileOutputStream fos = null;
+ ObjectOutputStream out = null;
+ try {
+ fos = new FileOutputStream(filename);
+ out = new ObjectOutputStream(fos);
+ out.writeObject(ref);
+ out.close();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ public void testConversationEnd() {
+ String someState = "Some state";
+ b.getService().setState(someState);
+ b.getService().endConversation();
+ Assert.assertNotSame(someState, b.getService().getState());
+ }
+
+ public void testConversationEnd2() {
+ String someState = "Some state";
+ b.getService().setState(someState);
+ b.getService().endConversationViaCallback();
+ Assert.assertNotSame(someState, b.getService().getState());
+ }
+
+ public void endConversation() {
+ System.out.println("A-callback to end conversation");
+ }
+
+ public void testConversationEnd3() {
+ String someState = "Some state";
+ b.getService().setState(someState);
+ delayForSeconds(2);
+ try {
+ b.getService().getState();
+ } catch (ConversationEndedException e) {
+ b.getConversation().end();// need to clean up to avoid exception
+ }
+ Assert.assertNotSame(someState, b.getService().getState());
+ }
+
+ public void testConversationEnd4() {
+ String someState = "Some state";
+ b.getService().setState(someState);
+ b.getConversation().end();
+ Assert.assertNotSame(someState, b.getService().getState());
+ }
+
+ public void testConversationEnd5() {
+ String someState = "Some state";
+ b.getService().setState(someState);
+ try {
+ b.getService().throwNonBusinessException();
+ } catch (Error e) {
+ // Expected
+ }
+ Assert.assertNotSame(someState, b.getService().getState());
+ }
+
+ public void testConversationEnd6() {
+ String someState = "Some state";
+ b.getService().setState(someState);
+ Object id = b.getConversation().getConversationID();
+ b.getService().endConversation();
+ Assert.assertNotSame(someState, b.getService().getState());
+ Assert.assertNotSame(id, b.getConversation().getConversationID());
+ }
+
+ public void testConversationEnd7() {
+ b.getService().setState("Some state");
+ b.getService().endConversation();
+ Assert.assertNull(b.getConversationID());
+ }
+
+ public void testConversationEnd8() {
+ String someState = "Some state";
+ b.getService().setState(someState);
+ delayForSeconds(2);
+ b.getService().getState();
+ }
+
+ public void testConversationEnd9() {
+ String someState = "Some state";
+ b.getService().setState(someState);
+ try {
+ b.getService().throwBusinessException();
+ } catch (BServiceBusinessException e) {
+ // Expected
+ }
+ Assert.assertSame(someState, b.getService().getState());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/BServiceImpl.java
new file mode 100644
index 0000000000..0919734c7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/BServiceImpl.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.vtest.javaapi.conversation.lifetime.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.AServiceCallback;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.BServiceBusinessException;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="1 seconds")
+public class BServiceImpl implements BService {
+
+ String someState;
+
+ @Callback
+ protected AServiceCallback callback;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void endConversation() {
+ System.out.println("Someone called Bservice.endsConversation()");
+ }
+
+ public void endConversationViaCallback() {
+ callback.endConversation();
+ }
+
+ public void throwNonBusinessException() {
+ throw new Error();
+ }
+
+ public void throwBusinessException() throws BServiceBusinessException {
+ throw new BServiceBusinessException("Business Exception");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/CServiceImpl.java
new file mode 100644
index 0000000000..d9910d445c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/CServiceImpl.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.vtest.javaapi.conversation.lifetime.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.CService;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+@Scope("CONVERSATION")
+public class CServiceImpl implements CService {
+
+ String someState;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/DServiceImpl.java
new file mode 100644
index 0000000000..34c57e402e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/impl/DServiceImpl.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.vtest.javaapi.conversation.lifetime.impl;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.DService;
+import org.junit.Assert;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(DService.class)
+@Scope("CONVERSATION")
+public class DServiceImpl implements DService {
+
+ String someState;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public void continueConversation(ServiceReference<BService> b, Object convId) {
+
+ b.getService().setState("Some more state");
+ Assert.assertEquals(convId, b.getConversation().getConversationID());
+ }
+
+ public void continueConversation2(String filename, Object convId, String serializedState) {
+ ServiceReference<BService> b = readReference(filename);
+ Assert.assertEquals(serializedState, b.getService().getState());
+ Assert.assertEquals(convId, b.getConversation().getConversationID());
+ }
+
+ // Utilities
+ @SuppressWarnings("unchecked")
+ private ServiceReference<BService> readReference(String filename) {
+ ServiceReference<BService> b = null;
+ FileInputStream fis = null;
+ ObjectInputStream in = null;
+ try {
+ fis = new FileInputStream(filename);
+ in = new ObjectInputStream(fis);
+ ServiceReference<BService> readObject = (ServiceReference<BService>)in.readObject();
+ b = readObject;
+ in.close();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ } catch (ClassNotFoundException ex) {
+ ex.printStackTrace();
+ }
+ return b;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/resources/lifetime.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/resources/lifetime.composite
new file mode 100644
index 0000000000..21ee8acac1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/main/resources/lifetime.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://java-api-tests" name="Converstion-Lifetime">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ <reference name="d" target="DComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.impl.BServiceImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.impl.CServiceImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.impl.DServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/LifetimeTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/LifetimeTestCase.java
new file mode 100644
index 0000000000..987ac3539f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/lifetime/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/LifetimeTestCase.java
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.osoa.sca.ConversationEndedException;
+
+/**
+ *
+ */
+public class LifetimeTestCase {
+
+ protected static String compositeName = "lifetime.composite";
+ protected static AService aService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Lines 475, 476
+ * <p>
+ * Conversations start on the client side when one of the following occur: A
+ * "@Reference" to a conversational service is injected, ... and then a
+ * method of the service is called
+ */
+ @Test
+ public void lifetime1() throws Exception {
+ aService.testConversationStarted();
+ }
+
+ /**
+ * Lines 477, 478, 479
+ * <p>
+ * Conversations start on the client side when one of the following occur
+ * ... A call is made to CompositeContext.getServiceReference and then a
+ * method of the service is called.
+ */
+ @Test
+ //@Ignore("TUSCANY-2243")
+ public void lifetime2() throws Exception {
+ aService.testConversationStarted2();
+ }
+
+ /**
+ * Line 481, 482
+ * <p>
+ * The client can continue an existing conversation, by: Holding the service
+ * reference that was created when the conversation started
+ */
+ @Test
+ public void lifetime3() throws Exception {
+ aService.testConversationContinue();
+ }
+
+ /**
+ * Line 481, 483
+ * <p>
+ * The client can continue an existing conversation, by: ... • Getting the
+ * service reference object passed as a parameter from another service, even
+ * remotely
+ */
+ @Test
+ public void lifetime4() throws Exception {
+ // aService.testConversationContinue2();
+ }
+
+ /**
+ * Line 481, 484
+ * <p>
+ * The client can continue an existing conversation, by:<br> • Loading a
+ * service reference that had been written to some form of persistent
+ * storage
+ */
+ @Test
+ public void lifetime6() throws Exception {
+ aService.testConversationContinue3();
+ }
+
+ /**
+ * Line 487, 488
+ * <p>
+ * A conversation ends, and any state associated with the conversation is
+ * freed up, when: <br>
+ * ...A server operation that has been annotated "@EndConveration" has been
+ * called
+ */
+ @Test
+ public void lifetime7() throws Exception {
+ aService.testConversationEnd();
+ }
+
+ /**
+ * Line 487, 489
+ * <p>
+ * A conversation ends, and any state associated with the conversation is
+ * freed up, when: <br>
+ * ...The server calls an "@EndsConversation" method on the "@Callback"
+ * reference <br>
+ */
+ @Test
+ public void lifetime8() throws Exception {
+ aService.testConversationEnd2();
+ }
+
+ /**
+ * Line 487, 490
+ * <p>
+ * 487 A conversation ends, and any state associated with the conversation
+ * is freed up, when: <br>
+ * ... The server's conversation lifetime timeout occurs
+ */
+ @Test
+ public void lifetime9() throws Exception {
+ aService.testConversationEnd3();
+ }
+
+ /**
+ * Line 487, 491
+ * <p>
+ * A conversation ends, and any state associated with the conversation is
+ * freed up, when: <br>
+ * ...The client calls Conversation.end()
+ */
+ @Test
+ public void lifetime10() throws Exception {
+ aService.testConversationEnd4();
+ }
+
+ /**
+ * Line 487, 492
+ * <p>
+ * A conversation ends, and any state associated with the conversation is
+ * freed up, when: <br>
+ * ...Any non-business exception is thrown by a conversational operation
+ */
+ @Test
+ //@Ignore("TUSCANY-2283")
+ public void lifetime11() throws Exception {
+ aService.testConversationEnd5();
+ aService.testConversationEnd9();
+ }
+
+ /**
+ * Line 494, 495
+ * <p>
+ * If a method is invoked on a service reference after an
+ * "@EndsConversation" method has been called then a new conversation will
+ * automatically be started.
+ */
+ @Test
+ public void lifetime12() throws Exception {
+ aService.testConversationEnd6();
+ }
+
+ /**
+ * Line 495, 496, 497
+ * <p>
+ * If ServiceReference.getConversationID() is called after the
+ * "@EndsConversation" method: is called, but before the next conversation
+ * has been started, it will return null.
+ */
+ @Test
+ public void lifetime13() throws Exception {
+ aService.testConversationEnd7();
+ }
+
+ /**
+ * Line 498, 499
+ * <p>
+ * If a service reference is used after the service provider's conversation
+ * timeout has caused the conversation to be ended, then
+ * ConversationEndedException will be thrown.
+ */
+ @Test(expected = ConversationEndedException.class)
+ public void lifetime14() throws Exception {
+ aService.testConversationEnd8();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/pom.xml
new file mode 100644
index 0000000000..c6e46cb95c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/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>java-api-annotations</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-conversation-parameters</artifactId>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Conversation - Parameters</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/AService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/AService.java
new file mode 100644
index 0000000000..bd19b504d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/AService.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.vtest.javaapi.conversation.parameters;
+
+/**
+ * Simple Remotable Service
+ */
+public interface AService {
+
+ public void setBStateThenGetCState();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/BService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/BService.java
new file mode 100644
index 0000000000..8a5ef43a4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/BService.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.vtest.javaapi.conversation.parameters;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Local Service
+ */
+@Remotable
+@Conversational
+public interface BService {
+
+ public void setState(String someState);
+ public String getState();
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/CService.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/CService.java
new file mode 100644
index 0000000000..e9a6dc469d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/CService.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.vtest.javaapi.conversation.parameters;
+
+import org.osoa.sca.ServiceReference;
+
+/**
+ * Simple Local Service
+ */
+public interface CService {
+
+ public void setState(String someState);
+ public String getState();
+ public Object continueConversation(ServiceReference<BService> bref);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/AServiceImpl.java
new file mode 100644
index 0000000000..0ef2f219f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/AServiceImpl.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.vtest.javaapi.conversation.parameters.impl;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.parameters.AService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.parameters.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.parameters.CService;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ protected ServiceReference<BService> b;
+
+ @Reference
+ protected CService c;
+
+ public void setBStateThenGetCState() {
+ String someState = "set by A";
+ b.getService().setState(someState);
+ Assert.assertEquals(someState, c.continueConversation(b));
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/BServiceImpl.java
new file mode 100644
index 0000000000..ab0b05d163
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/BServiceImpl.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.vtest.javaapi.conversation.parameters.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.parameters.BService;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService {
+
+ String someState;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/CServiceImpl.java
new file mode 100644
index 0000000000..27d0210fca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/impl/CServiceImpl.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.vtest.javaapi.conversation.parameters.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.conversation.parameters.BService;
+import org.apache.tuscany.sca.vtest.javaapi.conversation.parameters.CService;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl implements CService {
+
+ String someState;
+
+ public void setState(String someState) {
+ this.someState = someState;
+ }
+
+ public String getState() {
+ return someState;
+ }
+
+ public String continueConversation(ServiceReference<BService> bref) {
+ return bref.getService().getState();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/resources/parameters.composite b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/resources/parameters.composite
new file mode 100644
index 0000000000..a8500dfb09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/main/resources/parameters.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://java-api-tests" name="Converstion-Composite">
+
+ <component name="AComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.parameters.impl.AServiceImpl" />
+ <reference name="b" target="BComponent" />
+ <reference name="c" target="CComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.parameters.impl.BServiceImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java
+ class="org.apache.tuscany.sca.vtest.javaapi.conversation.parameters.impl.CServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/ConversationParametersTestCase.java b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/ConversationParametersTestCase.java
new file mode 100644
index 0000000000..929fe06115
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/parameters/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/parameters/ConversationParametersTestCase.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.vtest.javaapi.conversation.parameters;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * This test class tests the Service annotation described in section 1.2.1 and
+ * 1.8.17
+ */
+public class ConversationParametersTestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "parameters.composite";
+ protected static AService aService = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ aService = ServiceFinder.getService(AService.class, "AComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+
+ }
+
+ /**
+ * Line 423, 424, 425:<br>
+ * <p>
+ * The service reference which represents a single conversation can be
+ * passed as a parameter to another service, even if that other service is
+ * remote. This may be used in order to allow one component to continue a
+ * conversation that had been started by another.
+ */
+ @Test
+ public void passParameter1() throws Exception {
+ aService.setBStateThenGetCState();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/pom.xml
new file mode 100644
index 0000000000..67aa9702be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/conversation/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>vtest-java-api</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api-conversation</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - Conversation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>parameters</module>
+ <module>lifetime</module>
+ <module>id</module>
+ <module>callback</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/java-api/pom.xml b/sca-java-1.x/branches/sca-android/vtest/java-api/pom.xml
new file mode 100644
index 0000000000..198af57bbc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/java-api/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-vtest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-java-api</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>vtest-utilities</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>annotations</module>
+ <module>apis</module>
+ <module>conversation</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/pom.xml b/sca-java-1.x/branches/sca-android/vtest/pom.xml
new file mode 100644
index 0000000000..63086d522d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/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-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-vtest</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Specification Verification Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <!--
+ <module>java-api</module>
+ <module>wsbinding</module>
+ <module>utilities</module>
+ <module>assembly</module>
+ -->
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/processcomments.rb b/sca-java-1.x/branches/sca-android/vtest/processcomments.rb
new file mode 100644
index 0000000000..b7a7fc1cc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/processcomments.rb
@@ -0,0 +1,198 @@
+=begin
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+Scans java test source files, recursively from the current directory,
+and produces a list of test metods sorted by specification line number.
+
+The implementation makes heavy use of my scant knowledge of regex. I'll
+comeback and clean this up as time allows.
+
+Assumes a test comment convention like this:
+
+ /**
+ * Lines 410,411,412,413:
+ * <p>
+ * A method of a conversational interface may be marked with an
+ * "@EndsConversation" annotation. Once a method marked with
+ * "@EndsConversation" has been called, the conversation between client and
+ * service provider is at an end, which implies no further methods may be
+ * called on that service within the *same* conversation.
+ */
+ @Test
+ public void atEndsConversation1() throws Exception {
+
+Example command line usage
+>ruby processcomments.rb > comment_scan.txt
+
+Current output is formatted for a cwiki page and can be directly pasted to a blank page
+
+Some TODO's:
+ Add logic to process number ranges such as "Lines 523-556" or "Lines 523 to 556"
+=end
+class TestMethod
+
+ attr_accessor :lines_tested, :first_line_tested
+
+ def initialize(text, parent)
+ @text = text
+ @parent = parent
+ @lines_tested = init_lines_tested
+ @first_line_tested = @lines_tested.first
+ end
+
+ #Define sort criteria
+ def <=>(test_method)
+ @first_line_tested.<=>(test_method.first_line_tested)
+ end
+
+ def name
+ regex = /void\s*\S*\(\) /
+ str = @text[regex]
+ str.sub(/void\s*/, '')
+ end
+
+ def init_lines_tested
+ lines_regex = /Line.*?$/
+ lines_array = @text.scan(lines_regex)
+ nums_regex = /\d{1,4}/
+ line_numbers = Array.new
+ lines_array.each do |line_text|
+ number_strings =line_text.scan(nums_regex)
+ number_strings.each {|num_string| line_numbers<<num_string.to_i}
+ end
+ line_numbers
+ end
+
+ def lines_tested_string
+ lts = String.new
+ lines_tested.each {|n| lts = lts +"," + n.to_s }
+ lts[1..lts.length]
+ end
+
+ def ignore_line
+ @text[/^\s*@Ignore.*/]
+ end
+
+ def jira
+ result = ignore_line
+ result = result[/\d{4,5}/]
+ result ? "T-" + result : "x"
+ end
+
+ def ignore_string
+ ignore_line ? jira : ""
+ end
+
+ def package_name
+ @parent.package_name
+ end
+
+ def testcase_name
+ @parent.testcase_name
+ end
+
+ def long_name
+ self.package_name + "." + testcase_name + "." + self.name
+ end
+
+ def to_s
+ long_name + "\n" + "Lines tested: " + lines_tested_string + "\n\n"
+ end
+
+ def to_cwiki_s
+ "|" + lines_tested_string + "|" + long_name + "|" + ignore_string + "|\n"
+ end
+end
+
+class TestCase
+ attr_accessor :text, :test_methods
+
+ def initialize(text)
+ @text = text
+ @test_methods = Array.new
+ create_test_methods
+ end
+
+ def create_test_methods
+ regex = /\/\*\*\W*?$\W*?Line.*?\{/m
+ test_method_text_array = text.scan(regex)
+ test_method_text_array.each do |t|
+ @test_methods<<TestMethod.new(t, self)
+ $num_test_methods +=1
+ end
+ end
+
+ def package_name
+ line = @text[/pack.*$/]
+ line.sub!(/package /, '')
+ line.sub(/;/, '')
+ end
+
+ def testcase_name
+ text[/\S*TestCase/]
+ end
+end
+
+def process_file(fn)
+ text = String.new
+ File.open(fn) { |f| text = f.read }
+ $testcases << TestCase.new(text)
+end
+
+def spec_tested (dir_pwd)
+ subfolder_name = dir_pwd[/\/[^\/\\]*$/]
+ subfolder_name = subfolder_name[1..subfolder_name.length-1]
+ result = case subfolder_name
+ when "java-api" : "SCA Java Common Annotations and APIs V1.00"
+ when "wsbinding" : "SCA Web Services Binding V1.00"
+ else "Unknown!"
+ end
+end
+
+$num_files_processed = $num_test_methods = 0
+$testcases = Array.new
+svn_info = `svn info`
+svn_revision = svn_info[/Revision: \d*/]
+
+Dir["**/*TestCase.java"].each do |filename|
+ process_file(filename)
+ $num_files_processed += 1
+end
+
+all_test_methods = Array.new
+$testcases.each do |tc|
+ tc.test_methods.each {|m| all_test_methods<<m}
+end
+
+#confluence wiki output
+puts "Content generated by /vtest/processcomments.rb"
+puts "h1. " + spec_tested(Dir.pwd) + " - Test map"
+puts "h3. Test case files scanned " + Date.today.to_s + " (svn:" + svn_revision + ")"
+puts "* Total files processed = #{$num_files_processed}"
+puts "* Number of test cases = #{$testcases.length}"
+puts "* Number of test methods = #{$num_test_methods}"
+
+puts "||Specification Line Numbers|| package/testcase/method ||ignored||"
+all_test_methods.sort.each {|tm| puts tm.to_cwiki_s}
+
+
+
+
diff --git a/sca-java-1.x/branches/sca-android/vtest/utilities/pom.xml b/sca-java-1.x/branches/sca-android/vtest/utilities/pom.xml
new file mode 100644
index 0000000000..de25c30cce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/utilities/pom.xml
@@ -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.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-vtest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-utilities</artifactId>
+ <name>Apache Tuscany SCA Verification Tests - Utilities</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/utilities/src/main/java/org/apache/tuscany/sca/vtest/utilities/ServiceFinder.java b/sca-java-1.x/branches/sca-android/vtest/utilities/src/main/java/org/apache/tuscany/sca/vtest/utilities/ServiceFinder.java
new file mode 100644
index 0000000000..9b6792e51b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/utilities/src/main/java/org/apache/tuscany/sca/vtest/utilities/ServiceFinder.java
@@ -0,0 +1,104 @@
+/*
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.vtest.utilities;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ *
+ *
+ */
+public class ServiceFinder {
+
+ private static SCADomain domain;
+
+ protected ServiceFinder() {
+ super();
+ }
+
+ public static void init(String compositeFileName) {
+ if (domain != null)
+ System.out.println("VTEST WARNING: domain already exists and is will be overwritten!");
+ domain = SCADomain.newInstance(compositeFileName);
+ }
+
+
+ public static <B> B getService(Class<B> businessInterface, String serviceName) {
+ return domain.getService(businessInterface, serviceName);
+ }
+
+ public static void cleanup() {
+ domain.close();
+ domain = null;
+ }
+
+ private static String getUri(String component, String service, String binding) {
+
+ List<ComponentService> csList = domain.getComponentManager().getComponent(component).getServices();
+
+ for (int i = 0; i < csList.size(); i++) {
+ ComponentService cs = csList.get(i);
+ if (service.equals(cs.getName())) {
+ List<Binding> bList = cs.getBindings();
+ for (int j = 0; j < bList.size(); j++) {
+ String bName = bList.get(j).getName();
+ if (bName.equals(binding)) {
+ String bUri = bList.get(j).getURI();
+ System.out.println(component + "/" + service + "-> binding name: " + bName + ", uri: " + bUri);
+ return bUri;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public static Definition getWSDLDefinition(String component, String service) {
+ return getWSDLDefinition(component, service, service);
+ }
+
+ public static Definition getWSDLDefinition(String component, String service, String binding) {
+
+ String uri = getUri(component, service, binding);
+
+ if (uri == null)
+ return null;
+
+ try {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose",false);
+ wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+ return wsdlReader.readWSDL(uri + "?wsdl");
+ } catch (WSDLException e) {
+ e.printStackTrace(System.out);
+ }
+ return null;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/pom.xml
new file mode 100644
index 0000000000..c2a276df13
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/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>vtest-wsbinding-nowsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-nowsdl-defaultbinding</artifactId>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - No WSDL Default Binding</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/AService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/AService.java
new file mode 100644
index 0000000000..cba68beb65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/AService.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.vtest.wsbinding.nowsdl.defaultbinding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+public interface AService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/BService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/BService.java
new file mode 100644
index 0000000000..43e35564b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/BService.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.vtest.wsbinding.nowsdl.defaultbinding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/CService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/CService.java
new file mode 100644
index 0000000000..8838c07899
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/CService.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.vtest.wsbinding.nowsdl.defaultbinding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface CService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public Integer getInteger(Integer i);
+
+ public float getFloat(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/DService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/DService.java
new file mode 100644
index 0000000000..27eee2de0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/DService.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.vtest.wsbinding.nowsdl.defaultbinding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for DService.
+ */
+@Remotable
+public interface DService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getC1String(String aString);
+
+ public String getC1String2(String aString, String bString);
+
+ public Integer getC1Integer(Integer i);
+
+ public float getC1Float(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/AServiceImpl.java
new file mode 100644
index 0000000000..da767518ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/AServiceImpl.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.vtest.wsbinding.nowsdl.defaultbinding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.BService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ public BService b1;
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/BServiceImpl.java
new file mode 100644
index 0000000000..4402b76f3a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/BServiceImpl.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.vtest.wsbinding.nowsdl.defaultbinding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/CServiceImpl.java
new file mode 100644
index 0000000000..8392f5ed81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/CServiceImpl.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.vtest.wsbinding.nowsdl.defaultbinding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.CService;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl implements CService {
+
+ public String getName() {
+ return "CService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public Integer getInteger(Integer i) {
+ return i;
+ }
+
+ public float getFloat(float f) {
+ return f;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/DServiceImpl.java
new file mode 100644
index 0000000000..8064abf235
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/impl/DServiceImpl.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.vtest.wsbinding.nowsdl.defaultbinding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.CService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.DService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(DService.class)
+public class DServiceImpl implements DService {
+
+ @Reference
+ public BService b1;
+
+ @Reference
+ public CService c1;
+
+ public String getName() {
+ return "DService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getC1String(String aString) {
+ return c1.getString(aString);
+ }
+
+ public String getC1String2(String aString, String bString) {
+ return c1.getString2(aString, bString);
+ }
+
+ public Integer getC1Integer(Integer i) {
+ return c1.getInteger(i);
+ }
+
+ public float getC1Float(float f) {
+ return c1.getFloat(f);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/resources/nowsdl.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/resources/nowsdl.composite
new file mode 100644
index 0000000000..39d66fa365
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/main/resources/nowsdl.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest.wsbinding.nowsdl.defaultbinding"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="nowsdl.defaultbinding">
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.BService"/>
+ <binding.ws uri="http://localhost:8085/BComponent"/>
+ </service>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.impl.CServiceImpl"/>
+ <service name="CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.CService"/>
+ <binding.ws uri="http://localhost:8085/CComponent"/>
+ </service>
+ </component>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.BService"/>
+ <binding.ws uri="http://localhost:8085/BComponent"/>
+ </reference>
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.impl.DServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.BService"/>
+ <binding.ws uri="http://localhost:8085/BComponent"/>
+ </reference>
+ <reference name="c1" target="CComponent/CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.CService"/>
+ <binding.ws uri="http://localhost:8085/CComponent"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/NoWsdlDefaultBindingTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/NoWsdlDefaultBindingTestCase.java
new file mode 100644
index 0000000000..b50774cfa9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/defaultbinding/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/defaultbinding/NoWsdlDefaultBindingTestCase.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.vtest.wsbinding.nowsdl.defaultbinding;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.defaultbinding.DService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element without WSDL document
+ * described in section section 2.2.2 of SCA Web Services Binding V1.00
+ *
+ * @TODO - will add following tests<br>
+ * <li>promoted service</li>
+ * <li>with complex type object</li>
+ */
+public class NoWsdlDefaultBindingTestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "nowsdl.composite";
+ protected static AService a;
+ protected static DService d;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a = ServiceFinder.getService(AService.class, "AComponent");
+ d = ServiceFinder.getService(DService.class, "DComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 169-181:<br>
+ * 2.2.2 Examples Without a WSDL Document<br>
+ * The next example shows the simplest form of the binding element without
+ * WSDL document,<br>
+ * ...<br>
+ * which itself uses all the defaults.<br>
+ */
+ @Test
+ public void testNoWsdl1() throws Exception {
+ String aName = a.getName();
+ String b1Str1 = a.getB1String("string1");
+ String b1Str2 = a.getB1String2("string2", "string3");
+ int b1Int = a.getB1Int(4000);
+
+ System.out.println(aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ }
+
+ /**
+ * Lines 169-181:<br>
+ * Test two references using binding.ws but without WSDL documents.<br>
+ */
+ @Test
+ public void testNoWsdl2() throws Exception {
+ String dName = d.getName();
+ String b1Str1 = d.getB1String("string1");
+ String b1Str2 = d.getB1String2("string2", "string3");
+ String c1Str1 = d.getC1String("string5");
+ String c1Str2 = d.getC1String2("string6", "string7");
+
+ int b1Int = d.getB1Int(4000);
+ float c1Float = d.getC1Float((float) 8.8);
+
+ Integer c1Integer = d.getC1Integer(new Integer(9000));
+
+ System.out.println(dName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int + ", " + c1Str1 + ", " + c1Str2 + ", " + c1Float + ", " + c1Integer);
+ Assert.assertEquals("DService", dName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ Assert.assertEquals("string5", c1Str1);
+ Assert.assertEquals("string6string7", c1Str2);
+ Assert.assertEquals((float) 8.8, c1Float);
+ Assert.assertEquals(new Integer(9000), c1Integer);
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/pom.xml
new file mode 100644
index 0000000000..6cdab80d1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/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>vtest-wsbinding-nowsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-nowsdl-multisoapbindings</artifactId>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - No WSDL Multi Soap Bindings</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/AService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/AService.java
new file mode 100644
index 0000000000..4acfc5ca3f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/AService.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.vtest.wsbinding.nowsdl.multisoapbindings;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+public interface AService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/BService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/BService.java
new file mode 100644
index 0000000000..fa2f11b495
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/BService.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.vtest.wsbinding.nowsdl.multisoapbindings;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/CService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/CService.java
new file mode 100644
index 0000000000..b55df2c0ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/CService.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.vtest.wsbinding.nowsdl.multisoapbindings;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface CService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public Integer getInteger(Integer i);
+
+ public float getFloat(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/DService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/DService.java
new file mode 100644
index 0000000000..e39103a436
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/DService.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.vtest.wsbinding.nowsdl.multisoapbindings;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for DService.
+ */
+@Remotable
+public interface DService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getC1String(String aString);
+
+ public String getC1String2(String aString, String bString);
+
+ public Integer getC1Integer(Integer i);
+
+ public float getC1Float(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/AServiceImpl.java
new file mode 100644
index 0000000000..650d3295a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/AServiceImpl.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.vtest.wsbinding.nowsdl.multisoapbindings.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ public BService b1;
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/BServiceImpl.java
new file mode 100644
index 0000000000..69d993251b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/BServiceImpl.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.vtest.wsbinding.nowsdl.multisoapbindings.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/CServiceImpl.java
new file mode 100644
index 0000000000..ddcfc01416
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/CServiceImpl.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.vtest.wsbinding.nowsdl.multisoapbindings.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.CService;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl implements CService {
+
+ public String getName() {
+ return "CService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public Integer getInteger(Integer i) {
+ return i;
+ }
+
+ public float getFloat(float f) {
+ return f;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/DServiceImpl.java
new file mode 100644
index 0000000000..a3081b3bf4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/impl/DServiceImpl.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.vtest.wsbinding.nowsdl.multisoapbindings.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.CService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.DService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(DService.class)
+public class DServiceImpl implements DService {
+
+ @Reference
+ public BService b1;
+
+ @Reference
+ public CService c1;
+
+ public String getName() {
+ return "DService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getC1String(String aString) {
+ return c1.getString(aString);
+ }
+
+ public String getC1String2(String aString, String bString) {
+ return c1.getString2(aString, bString);
+ }
+
+ public Integer getC1Integer(Integer i) {
+ return c1.getInteger(i);
+ }
+
+ public float getC1Float(float f) {
+ return c1.getFloat(f);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/resources/nowsdlmultisoapbindings.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/resources/nowsdlmultisoapbindings.composite
new file mode 100644
index 0000000000..8cd599354a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/main/resources/nowsdlmultisoapbindings.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest.wsbinding.nowsdl"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="nowsdl">
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService"/>
+ <binding.ws name="BServiceSOAP11" requires="SOAP.1_1" uri="http://localhost:8085/BService/soap11"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BService/soap12"/>
+ </service>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.CServiceImpl"/>
+ <service name="CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.CService"/>
+ <binding.ws name="CServiceSOAP12" requires="SOAP.1_2" uri="http://localhost:8085/CService/soap12"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/CService/soap11"/>
+ </service>
+ </component>
+
+ <component name="AComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService"/>
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="AComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService"/>
+ <binding.ws requires="SOAP"/>
+ </reference>
+ </component>
+
+ <component name="AComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService"/>
+ <binding.ws requires="SOAP.1_1"/>
+ </reference>
+ </component>
+
+ <component name="AComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService"/>
+ <binding.ws requires="SOAP.1_2"/>
+ </reference>
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.DServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService"/>
+ <binding.ws requires="SOAP.1_1"/>
+ </reference>
+ <reference name="c1" target="CComponent/CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.CService"/>
+ <binding.ws requires="SOAP.1_2"/>
+ </reference>
+ </component>
+
+ <component name="DComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.DServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService"/>
+ <binding.ws requires="SOAP.1_2"/>
+ </reference>
+ <reference name="c1" target="CComponent/CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.CService"/>
+ <binding.ws requires="SOAP.1_1"/>
+ </reference>
+ </component>
+
+ <service name="BServicePromoted" promote="BComponentPromoted">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService"/>
+ <binding.ws name="BServicePromotedSOAP11" requires="SOAP.1_1" uri="http://localhost:8085/BServicePromoted/soap11"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BServicePromoted/soap12"/>
+ </service>
+
+ <service name="CServicePromoted" promote="CComponentPromoted">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.CService"/>
+ <binding.ws name="CServicePromotedSOAP12" requires="SOAP.1_2" uri="http://localhost:8085/CServicePromoted/soap12"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/CServicePromoted/soap11"/>
+ </service>
+
+ <component name="BComponentPromoted">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.BServiceImpl"/>
+ </component>
+
+ <component name="CComponentPromoted">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.CServiceImpl"/>
+ </component>
+
+ <reference name="DComponent3B1" promote="DComponent3/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.BService"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BServicePromoted/soap12"/>
+ </reference>
+
+ <reference name="DComponent3C1" promote="DComponent3/c1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.CService"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/CServicePromoted/soap11"/>
+ </reference>
+
+ <component name="DComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.impl.DServiceImpl"/>
+ <reference name="b1"/>
+ <reference name="c1"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/GeneratedWSDLTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/GeneratedWSDLTestCase.java
new file mode 100644
index 0000000000..ae058cf6c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/GeneratedWSDLTestCase.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.http.HTTPAddress;
+import javax.wsdl.extensions.http.HTTPBinding;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.wsdl.extensions.soap12.SOAP12Binding;
+
+import junit.framework.Assert;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element without WSDL document
+ * described in section 2.3.2 of SCA Web Services Binding V1.00
+ */
+public class GeneratedWSDLTestCase {
+
+ protected static String compositeName = "nowsdlmultisoapbindings.composite";
+ protected static Definition cWSDL = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ cWSDL = ServiceFinder.getWSDLDefinition("CComponent", "CService");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ private Map getPorts(Definition wsdl, String service) {
+ String targetNamespace = wsdl.getTargetNamespace();
+ HashMap sMap = (HashMap) wsdl.getServices();
+ for (Iterator i = sMap.keySet().iterator(); i.hasNext();) {
+ Object k1 = i.next();
+ Service s = (Service) sMap.get(k1);
+ String qName = "{" + targetNamespace + "}" + service;
+ if (s.getQName().toString().equals(qName)) {
+ return s.getPorts();
+ }
+ // Don't why implmentation changed to add Service at the end of qname
+ if (s.getQName().toString().equals(qName + "Service")) {
+ return s.getPorts();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Lines 262-264:<br>
+ * The WSDL service has one or more ports for each web service binding on
+ * the SCA service that has a SOAP requirement, or that refers to an
+ * existing WSDL binding, depending on the requirements of the web service
+ * binding. Each of those ports has a single binding.<p>
+ * Each service has following bindings:<br>
+ * <li>SoapBinding - PortType and SOAP11</li>
+ * <li>SOAP12Binding - SOAP12</li>
+ * <li>HTTPBinding - Http</li>
+ * <br>and following ports:<br>
+ * <li>SoapAddress</li>
+ * <li>SOAP12Address</li>
+ * <li>HTTPAddress</li>
+ */
+ @Test
+ @Ignore
+ // Only generate SOAP port and binding
+ public void testMultiSoapBindings4() throws Exception {
+
+ Map pMap = getPorts(cWSDL, "CService");
+ int numSoapPort = 0;
+ int numSoap12Port = 0;
+ int numHttpPort = 0;
+ for (Iterator iter = pMap.keySet().iterator(); iter.hasNext();) {
+ Object k2 = iter.next();
+ Port p = (Port) pMap.get(k2);
+ List eeList = p.getExtensibilityElements();
+ for (int i = 0; i < eeList.size(); i++) {
+ Object address = eeList.get(i);
+ if (address instanceof SOAPAddress) {
+ numSoapPort++;
+ } else if (address instanceof SOAP12Address) {
+ numSoap12Port++;
+ } else if (address instanceof HTTPAddress) {
+ numHttpPort++;
+ };
+ }
+ }
+
+ Map cMap = cWSDL.getBindings();
+ int numSoapBinding = 0;
+ int numSoap12Binding = 0;
+ int numHttpBinding = 0;
+ for (Iterator iter = cMap.keySet().iterator(); iter.hasNext();) {
+ Object k1 = iter.next();
+ Binding b = (Binding) cMap.get(k1);
+ List eeList = b.getExtensibilityElements();
+ for (int i = 0; i < eeList.size(); i++) {
+ Object binding = eeList.get(i);
+ if (binding instanceof SOAPBinding) {
+ numSoapBinding++;
+ } else if (binding instanceof SOAP12Binding) {
+ numSoap12Binding++;
+ } else if (binding instanceof HTTPBinding) {
+ numHttpBinding++;
+ }
+ }
+ }
+
+ System.out.println("testMultiSoapBindings4");
+ System.out.println(" # of SOAPPort: " + numSoapPort);
+ System.out.println(" # of SOAP12Port: " + numSoap12Port);
+ System.out.println(" # of HTTPPort: " + numHttpPort);
+ System.out.println(" # of SOAPBinding: " + numSoapBinding);
+ System.out.println(" # of SOAP12Binding: " + numSoap12Binding);
+ System.out.println(" # of HTTPBinding: " + numHttpBinding);
+
+ Assert.assertEquals(numSoapPort, 1);
+ Assert.assertTrue(numSoap12Port > 0);
+ Assert.assertTrue(numSoapBinding > 0);
+ Assert.assertEquals(numSoap12Binding, 1);
+ // Skipped to test HTTP
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/NoWsdlMultiSoapBindingsTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/NoWsdlMultiSoapBindingsTestCase.java
new file mode 100644
index 0000000000..5dbb696bf5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/multisoapbindings/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/multisoapbindings/NoWsdlMultiSoapBindingsTestCase.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.vtest.wsbinding.nowsdl.multisoapbindings;
+
+import junit.framework.Assert;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.multisoapbindings.DService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element without WSDL document
+ * described in section section 2.2.2 and 2.3.2 of SCA Web Services
+ * Binding V1.00
+ */
+public class NoWsdlMultiSoapBindingsTestCase {
+
+ protected static String compositeName = "nowsdlmultisoapbindings.composite";
+ protected static AService a1;
+ protected static AService a2;
+ protected static AService a3;
+ protected static AService a4;
+ protected static DService d1;
+ protected static DService d2;
+ protected static DService d3;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a1 = ServiceFinder.getService(AService.class, "AComponent1");
+ a2 = ServiceFinder.getService(AService.class, "AComponent2");
+ a3 = ServiceFinder.getService(AService.class, "AComponent3");
+ a4 = ServiceFinder.getService(AService.class, "AComponent4");
+ d1 = ServiceFinder.getService(DService.class, "DComponent1");
+ d2 = ServiceFinder.getService(DService.class, "DComponent2");
+ d3 = ServiceFinder.getService(DService.class, "DComponent3");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 201-225:<br>
+ * The next example shows the use of the binding element without a WSDL
+ * document, with multiple SOAP bindings with non-default values. The SOAP
+ * 1.2 binding name defaults to the service name, the SOAP 1.1 binding is
+ * given an explicit name. The reference has a web service binding which
+ * uses SOAP 1.2, but otherwise uses all the defaults for SOAP binding.
+ * The reference binding name defaults to the reference name.<p>
+ * Line 253:<br>
+ * <li>soap</li>
+ * ...<br>
+ * version, including multiple versions.<br>
+ * <p>
+ * AComponent1 - no requires<br>
+ * AComponent2 - requires = soap<br>
+ * AComponent3 - requires = soap.1_1<br>
+ * AComponent4 - requires = soap.1_2<br>
+ */
+ @Test
+ public void testMultiSoapBindings1() throws Exception {
+
+ String aName = a1.getName();
+ String b1Str1 = a1.getB1String("string1");
+ String b1Str2 = a1.getB1String2("string2", "string3");
+ int b1Int = a1.getB1Int(1000);
+
+ System.out.println("AComponent1: " + aName + ", " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(1000, b1Int);
+
+ aName = a2.getName();
+ b1Str1 = a2.getB1String("string1");
+ b1Str2 = a2.getB1String2("string2", "string3");
+ b1Int = a2.getB1Int(2000);
+
+ System.out.println("AComponent2: " + aName + ", " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(2000, b1Int);
+
+ aName = a3.getName();
+ b1Str1 = a3.getB1String("string1");
+ b1Str2 = a3.getB1String2("string2", "string3");
+ b1Int = a3.getB1Int(3000);
+
+ System.out.println("AComponent3: " + aName + ", " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(3000, b1Int);
+
+ aName = a4.getName();
+ b1Str1 = a4.getB1String("string1");
+ b1Str2 = a4.getB1String2("string2", "string3");
+ b1Int = a4.getB1Int(4000);
+
+ System.out.println("AComponent4: " + aName + ", " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+
+ }
+
+ /**
+ * Lines 201-225, 262-264:<br>
+ * The WSDL service has one or more ports for each web service binding on
+ * the SCA service that has a SOAP requirement, or that refers to an
+ * existing WSDL binding, depending on the requirements of the web service
+ * binding. Each of those ports has a single binding.<br>
+ * <p>
+ * Test multiple SOAP bindings with two references which use different versions.<br>
+ */
+ @Test
+ public void testMultiSoapBindings2() throws Exception {
+
+ String dName = d1.getName();
+ String b1Str1 = d1.getB1String("string1");
+ String b1Str2 = d1.getB1String2("string2", "string3");
+ String c1Str1 = d1.getC1String("string5");
+ String c1Str2 = d1.getC1String2("string6", "string7");
+ int b1Int = d1.getB1Int(4000);
+ float c1Float = d1.getC1Float((float) 8.8);
+ Integer c1Integer = d1.getC1Integer(new Integer(9001));
+
+ System.out.println(dName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int + ", " + c1Str1 + ", " + c1Str2 + ", " + c1Float + ", " + c1Integer);
+ Assert.assertEquals("DService", dName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ Assert.assertEquals("string5", c1Str1);
+ Assert.assertEquals("string6string7", c1Str2);
+ Assert.assertEquals((float) 8.8, c1Float);
+ Assert.assertEquals(new Integer(9001), c1Integer);
+
+ dName = d2.getName();
+ b1Str1 = d2.getB1String("string1");
+ b1Str2 = d2.getB1String2("string2", "string3");
+ c1Str1 = d2.getC1String("string5");
+ c1Str2 = d2.getC1String2("string6", "string7");
+ b1Int = d2.getB1Int(4000);
+ c1Float = d2.getC1Float((float) 8.8);
+ c1Integer = d2.getC1Integer(new Integer(9002));
+
+ System.out.println(dName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int + ", " + c1Str1 + ", " + c1Str2 + ", " + c1Float + ", " + c1Integer);
+ Assert.assertEquals("DService", dName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ Assert.assertEquals("string5", c1Str1);
+ Assert.assertEquals("string6string7", c1Str2);
+ Assert.assertEquals((float) 8.8, c1Float);
+ Assert.assertEquals(new Integer(9002), c1Integer);
+ }
+
+ /**
+ * Lines 201-225, 262-264:<br>
+ * Test multiple SOAP bindings with promoted services and references.<br>
+ */
+ @Test
+ public void testMultiSoapBindings3() throws Exception {
+
+ String dName = d3.getName();
+ String b1Str1 = d3.getB1String("string1");
+ String b1Str2 = d3.getB1String2("string2", "string3");
+ String c1Str1 = d3.getC1String("string5");
+ String c1Str2 = d3.getC1String2("string6", "string7");
+ int b1Int = d3.getB1Int(4000);
+ float c1Float = d3.getC1Float((float) 8.8);
+ Integer c1Integer = d3.getC1Integer(new Integer(9003));
+
+ System.out.println(dName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int + ", " + c1Str1 + ", " + c1Str2 + ", " + c1Float + ", " + c1Integer);
+ Assert.assertEquals("DService", dName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ Assert.assertEquals("string5", c1Str1);
+ Assert.assertEquals("string6string7", c1Str2);
+ Assert.assertEquals((float) 8.8, c1Float);
+ Assert.assertEquals(new Integer(9003), c1Integer);
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/pom.xml
new file mode 100644
index 0000000000..7167bdcc4a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>vtest-wsbinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-nowsdl</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - No WSDL</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>vtest-utilities</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>defaultbinding</module>
+ <module>soapversion</module>
+ <module>multisoapbindings</module>
+ <module>promoted</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/pom.xml
new file mode 100644
index 0000000000..ab19ed9034
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/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>vtest-wsbinding-nowsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-nowsdl-promoted</artifactId>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - No WSDL Promoted Service and Reference</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/AService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/AService.java
new file mode 100644
index 0000000000..6ab6fbb8f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/AService.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.vtest.wsbinding.nowsdl.promoted;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+public interface AService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BService.java
new file mode 100644
index 0000000000..f3c42008aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BService.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.vtest.wsbinding.nowsdl.promoted;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP.java
new file mode 100644
index 0000000000..1215d9d41f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP.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.vtest.wsbinding.nowsdl.promoted;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BServiceSOAP {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP11.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP11.java
new file mode 100644
index 0000000000..774b68bf6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP11.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.vtest.wsbinding.nowsdl.promoted;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BServiceSOAP11 {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP12.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP12.java
new file mode 100644
index 0000000000..952df7ccfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/BServiceSOAP12.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.vtest.wsbinding.nowsdl.promoted;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BServiceSOAP12 {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/CService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/CService.java
new file mode 100644
index 0000000000..9111b5c3a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/CService.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.vtest.wsbinding.nowsdl.promoted;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface CService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public Integer getInteger(Integer i);
+
+ public float getFloat(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/DService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/DService.java
new file mode 100644
index 0000000000..5aa508d8f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/DService.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.vtest.wsbinding.nowsdl.promoted;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for DService.
+ */
+@Remotable
+public interface DService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getC1String(String aString);
+
+ public String getC1String2(String aString, String bString);
+
+ public Integer getC1Integer(Integer i);
+
+ public float getC1Float(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/AServiceImpl.java
new file mode 100644
index 0000000000..055283bfad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/AServiceImpl.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.vtest.wsbinding.nowsdl.promoted.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ public BService b1;
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceImpl.java
new file mode 100644
index 0000000000..8f776672de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceImpl.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.vtest.wsbinding.nowsdl.promoted.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAP11Impl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAP11Impl.java
new file mode 100644
index 0000000000..7a5d91d762
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAP11Impl.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.vtest.wsbinding.nowsdl.promoted.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP11;
+import org.osoa.sca.annotations.Service;
+
+@Service(BServiceSOAP11.class)
+public class BServiceSOAP11Impl implements BServiceSOAP11 {
+
+ public String getName() {
+ return "BServiceSOAP11";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAP12Impl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAP12Impl.java
new file mode 100644
index 0000000000..121de12d3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAP12Impl.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.vtest.wsbinding.nowsdl.promoted.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP12;
+import org.osoa.sca.annotations.Service;
+
+@Service(BServiceSOAP12.class)
+public class BServiceSOAP12Impl implements BServiceSOAP12 {
+
+ public String getName() {
+ return "BServiceSOAP12";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAPImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAPImpl.java
new file mode 100644
index 0000000000..f05c8852f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/BServiceSOAPImpl.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.vtest.wsbinding.nowsdl.promoted.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP;
+import org.osoa.sca.annotations.Service;
+
+@Service(BServiceSOAP.class)
+public class BServiceSOAPImpl implements BServiceSOAP {
+
+ public String getName() {
+ return "BServiceSOAP";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/CServiceImpl.java
new file mode 100644
index 0000000000..746b0a357f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/CServiceImpl.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.vtest.wsbinding.nowsdl.promoted.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.CService;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl implements CService {
+
+ public String getName() {
+ return "CService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public Integer getInteger(Integer i) {
+ return i;
+ }
+
+ public float getFloat(float f) {
+ return f;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/DServiceImpl.java
new file mode 100644
index 0000000000..5be411b286
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/impl/DServiceImpl.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.vtest.wsbinding.nowsdl.promoted.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.CService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.DService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(DService.class)
+public class DServiceImpl implements DService {
+
+ @Reference
+ public BService b1;
+
+ @Reference
+ public CService c1;
+
+ public String getName() {
+ return "DService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getC1String(String aString) {
+ return c1.getString(aString);
+ }
+
+ public String getC1String2(String aString, String bString) {
+ return c1.getString2(aString, bString);
+ }
+
+ public Integer getC1Integer(Integer i) {
+ return c1.getInteger(i);
+ }
+
+ public float getC1Float(float f) {
+ return c1.getFloat(f);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/resources/nowsdlpromoted.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/resources/nowsdlpromoted.composite
new file mode 100644
index 0000000000..f79df5bf8f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/main/resources/nowsdlpromoted.composite
@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://vtest.wsbinding.nowsdl.promoted"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="nowsdl.promoted">
+
+ <service name="BService" promote="BComponent">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BService"/>
+ <binding.ws uri="http://localhost:8085/BService"/>
+ </service>
+
+ <service name="BServiceSOAP" promote="BComponentSOAP">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BServiceSOAP"/>
+ </service>
+
+ <service name="BServiceSOAP11" promote="BComponentSOAP11">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP11"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BServiceSOAP11"/>
+ </service>
+
+ <service name="BServiceSOAP12" promote="BComponentSOAP12">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP12"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BServiceSOAP12"/>
+ </service>
+
+ <service name="CService" promote="CComponent">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.CService"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/CService"/>
+ </service>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.BServiceImpl"/>
+ </component>
+
+ <component name="BComponentSOAP">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.BServiceSOAPImpl"/>
+ </component>
+
+ <component name="BComponentSOAP11">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.BServiceSOAP11Impl"/>
+ </component>
+
+ <component name="BComponentSOAP12">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.BServiceSOAP12Impl"/>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.CServiceImpl"/>
+ </component>
+
+ <reference name="AComponent1B1" promote="AComponent1/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BService"/>
+ <binding.ws uri="http://localhost:8085/BService"/>
+ </reference>
+
+ <reference name="AComponent2B1" promote="AComponent2/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BService"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BService"/>
+ </reference>
+
+ <reference name="AComponent3B1" promote="AComponent3/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BService"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BService"/>
+ </reference>
+
+ <reference name="AComponent4B1" promote="AComponent4/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BService"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BService"/>
+ </reference>
+
+ <reference name="AComponent5B1" promote="AComponent5/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP"/>
+ <binding.ws uri="http://localhost:8085/BServiceSOAP"/>
+ </reference>
+
+ <reference name="AComponent6B1" promote="AComponent6/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BServiceSOAP"/>
+ </reference>
+
+ <reference name="AComponent7B1" promote="AComponent7/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BServiceSOAP"/>
+ </reference>
+
+ <reference name="AComponent8B1" promote="AComponent8/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BServiceSOAP"/>
+ </reference>
+
+ <reference name="AComponent9B1" promote="AComponent9/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP11"/>
+ <binding.ws uri="http://localhost:8085/BServiceSOAP11"/>
+ </reference>
+
+ <reference name="AComponent10B1" promote="AComponent10/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP11"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BServiceSOAP11"/>
+ </reference>
+
+ <reference name="AComponent11B1" promote="AComponent11/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP11"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BServiceSOAP11"/>
+ </reference>
+
+ <reference name="AComponent12B1" promote="AComponent12/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP11"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BServiceSOAP11"/>
+ </reference>
+
+ <reference name="AComponent13B1" promote="AComponent13/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP12"/>
+ <binding.ws uri="http://localhost:8085/BServiceSOAP12"/>
+ </reference>
+
+ <reference name="AComponent14B1" promote="AComponent14/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP12"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BServiceSOAP12"/>
+ </reference>
+
+ <reference name="AComponent15B1" promote="AComponent15/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP12"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BServiceSOAP12"/>
+ </reference>
+
+ <reference name="AComponent16B1" promote="AComponent16/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP12"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BServiceSOAP12"/>
+ </reference>
+
+ <reference name="DComponentB1" promote="DComponent/b1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.BServiceSOAP11"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BServiceSOAP11"/>
+ </reference>
+
+ <reference name="DComponentC1" promote="DComponent/c1">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.CService"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/CService"/>
+ </reference>
+
+ <component name="AComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent5">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent6">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent7">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent8">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent9">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent10">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent11">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent12">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent13">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent14">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent15">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="AComponent16">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.AServiceImpl"/>
+ <reference name="b1"/>
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.impl.DServiceImpl"/>
+ <reference name="b1"/>
+ <reference name="c1"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/NoWsdlPromoted1TestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/NoWsdlPromoted1TestCase.java
new file mode 100644
index 0000000000..ae7dafa46e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/NoWsdlPromoted1TestCase.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.vtest.wsbinding.nowsdl.promoted;
+
+import junit.framework.Assert;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.AService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element without WSDL document
+ * described in section section 2.3.1 and 2.3.3.1 of SCA Web Services Binding
+ * V1.00
+ */
+public class NoWsdlPromoted1TestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "nowsdlpromoted.composite";
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 251-253, 287-291:<br>
+ * <li>soap</li>
+ * This indicates that a SOAP binding is required. The SOAP binding may be
+ * of any SOAP version, including multiple versions.<br>
+ * <br>
+ * 2.3.3.1 SOAP versions<br>
+ * Where a web service binding requires a specific SOAP version, then a
+ * single WSDL port and SOAP binding of the appropriate version is
+ * generated. Where no specific SOAP version is required, then one or more
+ * WSDL ports with associated SOAP bindings may be generated, depending on
+ * the level(s) supported in the target runtime.<br>
+ * <p>
+ * Tests promoted services and references<br>
+ */
+ @Test
+ public void testSoapVersion1() throws Exception {
+
+ for (int i = 0; i < 8; i++) {
+ AService a = ServiceFinder.getService(AService.class, "AComponent" + (i+1));
+ String aName = a.getName();
+ String b1Str1 = a.getB1String("string1");
+ String b1Str2 = a.getB1String2("string2", "string3");
+ int b1Int = a.getB1Int(i * 1000 + 1000);
+ System.out.println(i + " - " + aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(i * 1000 + 1000, b1Int);
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/NoWsdlPromoted2TestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/NoWsdlPromoted2TestCase.java
new file mode 100644
index 0000000000..a4744b9007
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/promoted/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/promoted/NoWsdlPromoted2TestCase.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.vtest.wsbinding.nowsdl.promoted;
+
+import junit.framework.Assert;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.promoted.DService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element without WSDL document
+ * described in section section 2.3.1 and 2.3.3.1 of SCA Web Services Binding
+ * V1.00
+ */
+public class NoWsdlPromoted2TestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "nowsdlpromoted.composite";
+ protected static DService d;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ d = ServiceFinder.getService(DService.class, "DComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 254-257, 287-291:<br>
+ * <li>soap.1_1</li><br>
+ * A SOAP 1.1 binding only is required.<br>
+ * <li>soap.1_2</li><br>
+ * A SOAP 1.2 binding only is required.<br>
+ * <br>
+ * 2.3.3.1 SOAP versions<br>
+ * Where a web service binding requires a specific SOAP version, then a
+ * single WSDL port and SOAP binding of the appropriate version is
+ * generated. Where no specific SOAP version is required, then one or more
+ * WSDL ports with associated SOAP bindings may be generated, depending on
+ * the level(s) supported in the target runtime.<br>
+ * <p>
+ * Tests promoted services and references<br>
+ */
+ @Test
+ public void testSoapVersion2() throws Exception {
+
+ for (int i = 8; i < 16; i++) {
+ AService a = ServiceFinder.getService(AService.class, "AComponent" + (i+1));
+ String aName = a.getName();
+ String b1Str1 = a.getB1String("string1");
+ String b1Str2 = a.getB1String2("string2", "string3");
+ int b1Int = a.getB1Int(i * 1000 + 1000);
+ System.out.println(i + " - " + aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(i * 1000 + 1000, b1Int);
+ }
+ }
+
+ /**
+ * Lines 254-257, 287-291:<br>
+ * Test two references using binding.ws with 2 different SOAP versions
+ * and without WSDL document.<br>
+ */
+ @Test
+ public void testSoapVersion3() throws Exception {
+ String dName = d.getName();
+ String b1Str1 = d.getB1String("string1");
+ String b1Str2 = d.getB1String2("string2", "string3");
+ String c1Str1 = d.getC1String("string5");
+ String c1Str2 = d.getC1String2("string6", "string7");
+
+ int b1Int = d.getB1Int(4000);
+ float c1Float = d.getC1Float((float) 8.8);
+
+ Integer c1Integer = d.getC1Integer(new Integer(9000));
+
+ System.out.println(dName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int + ", " + c1Str1 + ", " + c1Str2 + ", " + c1Float + ", " + c1Integer);
+ Assert.assertEquals("DService", dName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ Assert.assertEquals("string5", c1Str1);
+ Assert.assertEquals("string6string7", c1Str2);
+ Assert.assertEquals((float) 8.8, c1Float);
+ Assert.assertEquals(new Integer(9000), c1Integer);
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/pom.xml
new file mode 100644
index 0000000000..6345eec911
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/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>vtest-wsbinding-nowsdl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-nowsdl-soapversion</artifactId>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - No WSDL SOAP Version</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/AService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/AService.java
new file mode 100644
index 0000000000..d5204634a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/AService.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.vtest.wsbinding.nowsdl.soapversion;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+public interface AService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BService.java
new file mode 100644
index 0000000000..034aad7781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BService.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.vtest.wsbinding.nowsdl.soapversion;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP.java
new file mode 100644
index 0000000000..1c345428b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP.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.vtest.wsbinding.nowsdl.soapversion;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BServiceSOAP {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP11.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP11.java
new file mode 100644
index 0000000000..74dcccd898
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP11.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.vtest.wsbinding.nowsdl.soapversion;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BServiceSOAP11 {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP12.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP12.java
new file mode 100644
index 0000000000..a86922ef4f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/BServiceSOAP12.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.vtest.wsbinding.nowsdl.soapversion;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BServiceSOAP12 {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/CService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/CService.java
new file mode 100644
index 0000000000..a809795657
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/CService.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.vtest.wsbinding.nowsdl.soapversion;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface CService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public Integer getInteger(Integer i);
+
+ public float getFloat(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/DService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/DService.java
new file mode 100644
index 0000000000..2c1642ff14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/DService.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.vtest.wsbinding.nowsdl.soapversion;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for DService.
+ */
+@Remotable
+public interface DService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getC1String(String aString);
+
+ public String getC1String2(String aString, String bString);
+
+ public Integer getC1Integer(Integer i);
+
+ public float getC1Float(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/AServiceImpl.java
new file mode 100644
index 0000000000..657be52e7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/AServiceImpl.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.vtest.wsbinding.nowsdl.soapversion.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference
+ public BService b1;
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceImpl.java
new file mode 100644
index 0000000000..fb079fa8bc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceImpl.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.vtest.wsbinding.nowsdl.soapversion.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAP11Impl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAP11Impl.java
new file mode 100644
index 0000000000..9f0e76ec10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAP11Impl.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.vtest.wsbinding.nowsdl.soapversion.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP11;
+import org.osoa.sca.annotations.Service;
+
+@Service(BServiceSOAP11.class)
+public class BServiceSOAP11Impl implements BServiceSOAP11 {
+
+ public String getName() {
+ return "BServiceSOAP11";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAP12Impl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAP12Impl.java
new file mode 100644
index 0000000000..91e4ffbd7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAP12Impl.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.vtest.wsbinding.nowsdl.soapversion.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP12;
+import org.osoa.sca.annotations.Service;
+
+@Service(BServiceSOAP12.class)
+public class BServiceSOAP12Impl implements BServiceSOAP12 {
+
+ public String getName() {
+ return "BServiceSOAP12";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAPImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAPImpl.java
new file mode 100644
index 0000000000..b8cd38bb09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/BServiceSOAPImpl.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.vtest.wsbinding.nowsdl.soapversion.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP;
+import org.osoa.sca.annotations.Service;
+
+@Service(BServiceSOAP.class)
+public class BServiceSOAPImpl implements BServiceSOAP {
+
+ public String getName() {
+ return "BServiceSOAP";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/CServiceImpl.java
new file mode 100644
index 0000000000..250694dc36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/CServiceImpl.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.vtest.wsbinding.nowsdl.soapversion.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.CService;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl implements CService {
+
+ public String getName() {
+ return "CService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public Integer getInteger(Integer i) {
+ return i;
+ }
+
+ public float getFloat(float f) {
+ return f;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/DServiceImpl.java
new file mode 100644
index 0000000000..9f6c29c643
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/impl/DServiceImpl.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.vtest.wsbinding.nowsdl.soapversion.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.CService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.DService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(DService.class)
+public class DServiceImpl implements DService {
+
+ @Reference
+ public BService b1;
+
+ @Reference
+ public CService c1;
+
+ public String getName() {
+ return "DService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getC1String(String aString) {
+ return c1.getString(aString);
+ }
+
+ public String getC1String2(String aString, String bString) {
+ return c1.getString2(aString, bString);
+ }
+
+ public Integer getC1Integer(Integer i) {
+ return c1.getInteger(i);
+ }
+
+ public float getC1Float(float f) {
+ return c1.getFloat(f);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/resources/nowsdlsoapversion.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/resources/nowsdlsoapversion.composite
new file mode 100644
index 0000000000..61a658ab55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/main/resources/nowsdlsoapversion.composite
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://vtest.wsbinding.nowsdl.soapversion"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="nowsdl.soapversion">
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BService"/>
+ <binding.ws uri="http://localhost:8085/BComponent"/>
+ </service>
+ </component>
+
+ <component name="BComponentSOAP">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.BServiceSOAPImpl"/>
+ <service name="BServiceSOAP">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BComponentSOAP"/>
+ </service>
+ </component>
+
+ <component name="BComponentSOAP11">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.BServiceSOAP11Impl"/>
+ <service name="BServiceSOAP11">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP11"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BComponentSOAP11"/>
+ </service>
+ </component>
+
+ <component name="BComponentSOAP12">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.BServiceSOAP12Impl"/>
+ <service name="BServiceSOAP12">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP12"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BComponentSOAP12"/>
+ </service>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.CServiceImpl"/>
+ <service name="CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.CService"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/CComponent"/>
+ </service>
+ </component>
+
+ <component name="AComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BService"/>
+ <binding.ws uri="http://localhost:8085/BComponent"/>
+ </reference>
+ </component>
+
+ <component name="AComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BService"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BComponent"/>
+ </reference>
+ </component>
+
+ <component name="AComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BService"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BComponent"/>
+ </reference>
+ </component>
+
+ <component name="AComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BService"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BComponent"/>
+ </reference>
+ </component>
+
+ <component name="AComponent5">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP/BServiceSOAP">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP"/>
+ <binding.ws uri="http://localhost:8085/BComponentSOAP"/>
+ </reference>
+ </component>
+
+ <component name="AComponent6">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP/BServiceSOAP">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BComponentSOAP"/>
+ </reference>
+ </component>
+
+ <component name="AComponent7">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP/BServiceSOAP">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BComponentSOAP"/>
+ </reference>
+ </component>
+
+ <component name="AComponent8">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP/BServiceSOAP">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BComponentSOAP"/>
+ </reference>
+ </component>
+
+ <component name="AComponent9">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP11/BServiceSOAP11">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP11"/>
+ <binding.ws uri="http://localhost:8085/BComponentSOAP11"/>
+ </reference>
+ </component>
+
+ <component name="AComponent10">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP11/BServiceSOAP11">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP11"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BComponentSOAP11"/>
+ </reference>
+ </component>
+
+ <component name="AComponent11">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP11/BServiceSOAP11">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP11"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BComponentSOAP11"/>
+ </reference>
+ </component>
+
+ <component name="AComponent12">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP11/BServiceSOAP11">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP11"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BComponentSOAP11"/>
+ </reference>
+ </component>
+
+ <component name="AComponent13">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP12/BServiceSOAP12">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP12"/>
+ <binding.ws uri="http://localhost:8085/BComponentSOAP12"/>
+ </reference>
+ </component>
+
+ <component name="AComponent14">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP12/BServiceSOAP12">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP12"/>
+ <binding.ws requires="SOAP" uri="http://localhost:8085/BComponentSOAP12"/>
+ </reference>
+ </component>
+
+ <component name="AComponent15">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP12/BServiceSOAP12">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP12"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BComponentSOAP12"/>
+ </reference>
+ </component>
+
+ <component name="AComponent16">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP12/BServiceSOAP12">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP12"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/BComponentSOAP12"/>
+ </reference>
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.impl.DServiceImpl"/>
+ <reference name="b1" target="BComponentSOAP11/BServiceSOAP11">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BServiceSOAP11"/>
+ <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/BComponentSOAP11"/>
+ </reference>
+ <reference name="c1" target="CComponent/CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.CService"/>
+ <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/CComponent"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/GeneratedWSDLTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/GeneratedWSDLTestCase.java
new file mode 100644
index 0000000000..d0e852fc7c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/GeneratedWSDLTestCase.java
@@ -0,0 +1,438 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.http.HTTPAddress;
+import javax.wsdl.extensions.http.HTTPBinding;
+import javax.wsdl.extensions.http.HTTPOperation;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.wsdl.extensions.soap12.SOAP12Binding;
+import javax.wsdl.extensions.soap12.SOAP12Body;
+import javax.wsdl.extensions.soap12.SOAP12Header;
+import javax.wsdl.extensions.soap12.SOAP12HeaderFault;
+import javax.wsdl.extensions.soap12.SOAP12Operation;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.CService;
+
+
+/**
+ * Tests the simplest form of the binding element without WSDL document
+ * described in section section 2.3.2, 2.3.3, 2.3.3.1, and 2.3.4 of SCA
+ * Web Services Binding V1.00
+ */
+public class GeneratedWSDLTestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "nowsdlsoapversion.composite";
+ protected static Definition bWSDL = null;
+ protected static Definition cWSDL = null;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ bWSDL = ServiceFinder.getWSDLDefinition("BComponent", "BService");
+ cWSDL = ServiceFinder.getWSDLDefinition("CComponent", "CService");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 260-262:<br>
+ * A separate WSDL document is generated for each SCA service. Each has
+ * its own unique target namespace. This is to ensure that bindings on
+ * different services of the same component do not clash.<br>
+ */
+ @Test
+ @Ignore
+ // Don't know why target namespaces are same
+ public void testSoapVersion4() throws Exception {
+ String cTargetNamespace = cWSDL.getTargetNamespace();
+ String bTargetNamespace = bWSDL.getTargetNamespace();
+ Assert.assertFalse(bTargetNamespace.equals(cTargetNamespace));
+ }
+
+ /**
+ * Lines 271-273:<br>
+ * The target namespace of the WSDL document, and of the service, ports and
+ * generated binding elements is:<br>
+ * Base System URI for HTTP / Component Name / Service Name<br>
+ */
+ @Test
+ @Ignore
+ // The target namespace does not follow the convention
+ public void testSoapVersion5() throws Exception {
+ String bTargetNamespace = bWSDL.getTargetNamespace();
+ String cTargetNamespace = cWSDL.getTargetNamespace();
+ Assert.assertTrue(bTargetNamespace.endsWith("BComponent/BService"));
+ Assert.assertTrue(cTargetNamespace.endsWith("CComponent/CService"));
+ }
+
+ private Map getPorts(Definition wsdl, String service) {
+ String targetNamespace = wsdl.getTargetNamespace();
+ HashMap sMap = (HashMap) wsdl.getServices();
+ for (Iterator i = sMap.keySet().iterator(); i.hasNext();) {
+ Object k1 = i.next();
+ Service s = (Service) sMap.get(k1);
+ String qName = "{" + targetNamespace + "}" + service;
+ if (s.getQName().toString().equals(qName)) {
+ return s.getPorts();
+ }
+ // Don't why implmentation changed to add Service at the end of qname
+ if (s.getQName().toString().equals(qName + "Service")) {
+ return s.getPorts();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Lines 262-264, 290-291:<br>
+ * The WSDL service has one or more ports for each web service binding on
+ * the SCA service that has a SOAP requirement, or that refers to an
+ * existing WSDL binding, depending on the requirements of the web service
+ * binding. Each of those ports has a single binding.<br>
+ * <p>
+ * 2.3.3.1 SOAP versions<br>
+ * Where no specific SOAP version is required, then one or more WSDL ports
+ * with associated SOAP bindings may be generated, depending on the level(s)
+ * supported in the target runtime.<br>
+ * <p>
+ * BComponent/BService is not specified a SOAP version.
+ * It should have following bindings:<br>
+ * <li>SoapBinding - PortType and SOAP11</li>
+ * <li>SOAP12Binding - SOAP12</li>
+ * <li>HTTPBinding - Http</li>
+ * <br>and following ports:<br>
+ * <li>SoapAddress</li>
+ * <li>SOAP12Address</li>
+ * <li>HTTPAddress</li>
+
+ */
+ @Test
+ public void testSoapVersion6() throws Exception {
+
+ Map pMap = getPorts(bWSDL, "BService");
+ int numSoapPort = 0;
+ int numSoap12Port = 0;
+ int numHttpPort = 0;
+ for (Iterator iter = pMap.keySet().iterator(); iter.hasNext();) {
+ Object k2 = iter.next();
+ Port p = (Port) pMap.get(k2);
+ List eeList = p.getExtensibilityElements();
+ for (int i = 0; i < eeList.size(); i++) {
+ Object address = eeList.get(i);
+ if (address instanceof SOAPAddress) {
+ numSoapPort++;
+ } else if (address instanceof SOAP12Address) {
+ numSoap12Port++;
+ } else if (address instanceof HTTPAddress) {
+ numHttpPort++;
+ } else {
+ System.out.println("address:" + address.getClass());
+ }
+ }
+ }
+
+ Map bMap = bWSDL.getBindings();
+ int numSoapBinding = 0;
+ int numSoap12Binding = 0;
+ int numHttpBinding = 0;
+ for (Iterator iter = bMap.keySet().iterator(); iter.hasNext();) {
+ Object k1 = iter.next();
+ Binding b = (Binding) bMap.get(k1);
+ List eeList = b.getExtensibilityElements();
+ for (int i = 0; i < eeList.size(); i++) {
+ Object binding = eeList.get(i);
+ if (binding instanceof SOAPBinding) {
+ numSoapBinding++;
+ } else if (binding instanceof SOAP12Binding) {
+ numSoap12Binding++;
+ } else if (binding instanceof HTTPBinding) {
+ numHttpBinding++;
+ }
+ }
+ }
+
+ System.out.println("testSoapVersion6");
+ System.out.println(" # of SOAPPort: " + numSoapPort);
+ System.out.println(" # of SOAP12Port: " + numSoap12Port);
+ System.out.println(" # of HTTPPort: " + numHttpPort);
+ System.out.println(" # of SOAPBinding: " + numSoapBinding);
+ System.out.println(" # of SOAP12Binding: " + numSoap12Binding);
+ System.out.println(" # of HTTPBinding: " + numHttpBinding);
+
+ Assert.assertEquals(numSoapPort, 1);
+ Assert.assertEquals(numSoap12Port, 0);
+ Assert.assertTrue(numSoapBinding > 0);
+ Assert.assertEquals(numSoap12Binding, 0);
+ // Skipped to test HTTP
+
+ }
+
+ /**
+ * Lines 275-284:<br>
+ * 2.3.3 WSDL Bindings<br>
+ * The binding elements in the generated WSDL document are either defined
+ * within the document, derived from the requirements of the binding, or
+ * are imported from existing WSDL documents.<br>
+ * Generated bindings have the following fixed assumptions:<br>
+ * <li>use="literal" for input and output messages</li>
+ * <li>style="document" for the binding</li>
+ * <li>All faults map to soap:faults</li>
+ * <li>No header or headerFault elements are generated</li>
+ * <li>The transport is "http://schemas.xmlsoap.org/soap/http", unless the
+ * system provides intents for alternative transports<br>
+ * <p>
+ */
+ @Test
+ public void testSoapVersion7() throws Exception {
+ Map bMap = bWSDL.getBindings();
+ for (Iterator iter = bMap.keySet().iterator(); iter.hasNext();) {
+ Object k1 = iter.next();
+ Binding b = (Binding) bMap.get(k1);
+ List eeList = b.getExtensibilityElements();
+ for (int i = 0; i < eeList.size(); i++) {
+ Object binding = eeList.get(i);
+ if (binding instanceof SOAPBinding) {
+ SOAPBinding sb = (SOAPBinding) binding;
+ Assert.assertEquals(sb.getStyle(), "document");
+ Assert.assertEquals(sb.getTransportURI(), "http://schemas.xmlsoap.org/soap/http");
+ } else if (binding instanceof SOAP12Binding) {
+ SOAP12Binding sb = (SOAP12Binding) binding;
+ Assert.assertEquals(sb.getStyle(), "document");
+ Assert.assertEquals(sb.getTransportURI(), "http://schemas.xmlsoap.org/soap/http");
+ } else if (binding instanceof HTTPBinding) {
+ }
+ }
+ List operations = b.getBindingOperations();
+ for (int i = 0; i < eeList.size(); i++) {
+ BindingOperation bop = (BindingOperation) operations.get(i);
+
+ List oeeList = bop.getExtensibilityElements();
+ for (int j = 0; j < eeList.size(); j++) {
+ Object op = oeeList.get(j);
+ if (op instanceof SOAPOperation) {
+ SOAPOperation sop = (SOAPOperation) op;
+ if (sop.getStyle() != null)
+ Assert.assertEquals(sop.getStyle(), "document");
+ } else if (op instanceof SOAP12Operation) {
+ SOAP12Operation sop = (SOAP12Operation) op;
+ Assert.assertEquals(sop.getStyle(), "document");
+ } else if (op instanceof HTTPOperation) {
+ // HTTPOperation hop = (HTTPOperation) op;
+ }
+ }
+
+ BindingInput bInput = (BindingInput) bop.getBindingInput();
+ List bInputList = bInput.getExtensibilityElements();
+ for (int j = 0; j < eeList.size(); j++) {
+ Object body = bInputList.get(j);
+ if (body instanceof SOAPBody) {
+ SOAPBody sBody = (SOAPBody) body;
+ Assert.assertEquals(sBody.getUse(), "literal");
+ } else if (body instanceof SOAP12Body) {
+ SOAP12Body sBody = (SOAP12Body) body;
+ Assert.assertEquals(sBody.getUse(), "literal");
+ } else {
+ Assert.assertFalse(body instanceof SOAPHeader);
+ Assert.assertFalse(body instanceof SOAP12Header);
+ Assert.assertFalse(body instanceof SOAPHeaderFault);
+ Assert.assertFalse(body instanceof SOAP12HeaderFault);
+ }
+ }
+
+ BindingOutput bOutput = (BindingOutput) bop.getBindingOutput();
+ List bOutputList = bOutput.getExtensibilityElements();
+ for (int j = 0; j < eeList.size(); j++) {
+ Object body = bOutputList.get(j);
+ if (body instanceof SOAPBody) {
+ SOAPBody sBody = (SOAPBody) body;
+ Assert.assertEquals(sBody.getUse(), "literal");
+ } else if (body instanceof SOAP12Body) {
+ SOAP12Body sBody = (SOAP12Body) body;
+ Assert.assertEquals(sBody.getUse(), "literal");
+ } else {
+ Assert.assertFalse(body instanceof SOAPHeader);
+ Assert.assertFalse(body instanceof SOAP12Header);
+ Assert.assertFalse(body instanceof SOAPHeaderFault);
+ Assert.assertFalse(body instanceof SOAP12HeaderFault);
+ }
+ }
+
+ Map bFaults = bop.getBindingFaults();
+ if (bFaults.size() > 0)
+ System.out.println("WARNING: Skipped to test binding faults");
+
+ }
+ }
+ }
+
+ /**
+ * Lines 288-289:<br>
+ * 2.3.3.1 SOAP versions<br>
+ * Where a web service binding requires a specific SOAP version, then a
+ * single WSDL port and SOAP binding of the appropriate version is
+ * generated.
+ */
+ @Test
+ public void testSoapVersion8() throws Exception {
+
+ Map pMap = getPorts(cWSDL, "CService");
+ int numSoapPort = 0;
+ int numSoap12Port = 0;
+ int numHttpPort = 0;
+ for (Iterator iter = pMap.keySet().iterator(); iter.hasNext();) {
+ Object k2 = iter.next();
+ Port p = (Port) pMap.get(k2);
+ List eeList = p.getExtensibilityElements();
+ for (int i = 0; i < eeList.size(); i++) {
+ Object address = eeList.get(i);
+ if (address instanceof SOAPAddress) {
+ numSoapPort++;
+ } else if (address instanceof SOAP12Address) {
+ numSoap12Port++;
+ } else if (address instanceof HTTPAddress) {
+ numHttpPort++;
+ };
+ }
+ }
+
+ Map cMap = cWSDL.getBindings();
+ int numSoapBinding = 0;
+ int numSoap12Binding = 0;
+ int numHttpBinding = 0;
+ for (Iterator iter = cMap.keySet().iterator(); iter.hasNext();) {
+ Object k1 = iter.next();
+ Binding b = (Binding) cMap.get(k1);
+ List eeList = b.getExtensibilityElements();
+ for (int i = 0; i < eeList.size(); i++) {
+ Object binding = eeList.get(i);
+ if (binding instanceof SOAPBinding) {
+ numSoapBinding++;
+ } else if (binding instanceof SOAP12Binding) {
+ numSoap12Binding++;
+ } else if (binding instanceof HTTPBinding) {
+ numHttpBinding++;
+ }
+ }
+ }
+
+ System.out.println("testSoapVersion8");
+ System.out.println(" # of SOAPPort: " + numSoapPort);
+ System.out.println(" # of SOAP12Port: " + numSoap12Port);
+ System.out.println(" # of HTTPPort: " + numHttpPort);
+ System.out.println(" # of SOAPBinding: " + numSoapBinding);
+ System.out.println(" # of SOAP12Binding: " + numSoap12Binding);
+ System.out.println(" # of HTTPBinding: " + numHttpBinding);
+
+ Assert.assertTrue(numSoap12Port > 0);
+ Assert.assertTrue(numSoap12Binding > 0);
+ Assert.assertEquals(numSoapPort, 0);
+ Assert.assertEquals(numSoapBinding, 0);
+ // Skipped to test HTTP
+ }
+
+ private boolean testOperation(Operation op, Method m[]) {
+ for (int i = 0; i < m.length; i++) {
+ if(m[i].getName().equals(op.getName())) {
+ Assert.assertNotNull(op.getInput());
+ Assert.assertNotNull(op.getOutput());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Lines 293-296:<br>
+ * 2.3.4 WSDL PortType<br>
+ * An SCA service has a single interface. This interface is always imported
+ * into the generated WSDL document. This may be done directly for
+ * WSDL-defined interfaces, or indirectly via a WSDL generated from the
+ * interface type for the service.<br>
+ */
+ @Test
+ public void testSoapVersion9() throws Exception {
+ Method bMethod[] = BService.class.getMethods();
+ Map bPTMap = bWSDL.getPortTypes();
+ Assert.assertEquals(bPTMap.size(), 1);
+ for (Iterator iter = bPTMap.keySet().iterator(); iter.hasNext();) {
+ PortType pt = (PortType) bPTMap.get(iter.next());
+ List opList = pt.getOperations();
+ Assert.assertEquals(bMethod.length, opList.size());
+ for (int i = 0; i < opList.size(); i++) {
+ Operation op = (Operation) opList.get(i);
+ Assert.assertTrue(testOperation(op, bMethod));
+ }
+ }
+
+ Method cMethod[] = CService.class.getMethods();
+ Map cPTMap = cWSDL.getPortTypes();
+ Assert.assertEquals(cPTMap.size(), 1);
+ for (Iterator iter = cPTMap.keySet().iterator(); iter.hasNext();) {
+ PortType pt = (PortType) cPTMap.get(iter.next());
+ List opList = pt.getOperations();
+ Assert.assertEquals(cMethod.length, opList.size());
+ for (int i = 0; i < opList.size(); i++) {
+ Operation op = (Operation) opList.get(i);
+ Assert.assertTrue(testOperation(op, cMethod));
+ }
+ }
+ }
+
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/NoWsdlNoSoapVersionTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/NoWsdlNoSoapVersionTestCase.java
new file mode 100644
index 0000000000..896b5a3d89
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/NoWsdlNoSoapVersionTestCase.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.vtest.wsbinding.nowsdl.soapversion;
+
+import junit.framework.Assert;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.AService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element without WSDL document
+ * described in section section 2.3.1 and 2.3.3.1 of SCA Web Services Binding
+ * V1.00
+ */
+public class NoWsdlNoSoapVersionTestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "nowsdlsoapversion.composite";
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 251-253, 287-291:<br>
+ * <li>soap</li>
+ * This indicates that a SOAP binding is required. The SOAP binding may be
+ * of any SOAP version, including multiple versions.<br>
+ * <br>
+ * 2.3.3.1 SOAP versions<br>
+ * Where a web service binding requires a specific SOAP version, then a
+ * single WSDL port and SOAP binding of the appropriate version is
+ * generated. Where no specific SOAP version is required, then one or more
+ * WSDL ports with associated SOAP bindings may be generated, depending on
+ * the level(s) supported in the target runtime.<br>
+ * <p>
+ */
+ @Test
+ public void testSoapVersion1() throws Exception {
+
+ for (int i = 0; i < 8; i++) {
+ AService a = ServiceFinder.getService(AService.class, "AComponent" + (i+1));
+ String aName = a.getName();
+ String b1Str1 = a.getB1String("string1");
+ String b1Str2 = a.getB1String2("string2", "string3");
+ int b1Int = a.getB1Int(i * 1000 + 1000);
+ System.out.println(i + " - " + aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(i * 1000 + 1000, b1Int);
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/NoWsdlSoapVersionTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/NoWsdlSoapVersionTestCase.java
new file mode 100644
index 0000000000..c65f7e8e52
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/nowsdl/soapversion/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/nowsdl/soapversion/NoWsdlSoapVersionTestCase.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.vtest.wsbinding.nowsdl.soapversion;
+
+import junit.framework.Assert;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.nowsdl.soapversion.DService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element without WSDL document
+ * described in section section 2.3.1, 2.3.2 and 2.3.3.1 of SCA Web Services
+ * Binding V1.00
+ */
+public class NoWsdlSoapVersionTestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "nowsdlsoapversion.composite";
+ protected static DService d;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ d = ServiceFinder.getService(DService.class, "DComponent");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 254-257:<br>
+ * <li>soap.1_1</li><br>
+ * A SOAP 1.1 binding only is required.<br>
+ * <li>soap.1_2</li><br>
+ * A SOAP 1.2 binding only is required.<br>
+ * <br>
+ * 2.3.3.1 SOAP versions<br>
+ * Where a web service binding requires a specific SOAP version, then a
+ * single WSDL port and SOAP binding of the appropriate version is
+ * generated. Where no specific SOAP version is required, then one or more
+ * WSDL ports with associated SOAP bindings may be generated, depending on
+ * the level(s) supported in the target runtime.<br>
+ * <p>
+ */
+ @Test
+ public void testSoapVersion2() throws Exception {
+
+ for (int i = 8; i < 16; i++) {
+ AService a = ServiceFinder.getService(AService.class, "AComponent" + (i+1));
+ String aName = a.getName();
+ String b1Str1 = a.getB1String("string1");
+ String b1Str2 = a.getB1String2("string2", "string3");
+ int b1Int = a.getB1Int(i * 1000 + 1000);
+ System.out.println(i + " - " + aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(i * 1000 + 1000, b1Int);
+ }
+ }
+
+ /**
+ * Lines 254-257, 287-291, 260-262:<br>
+ * A separate WSDL document is generated for each SCA service. Each has
+ * its own unique target namespace. This is to ensure that bindings on
+ * different services of the same component do not clash.<br>
+ * <p>
+ * Test two references using binding.ws with 2 different SOAP versions
+ * and without WSDL document.<br>
+ */
+ @Test
+ public void testSoapVersion3() throws Exception {
+ String dName = d.getName();
+ String b1Str1 = d.getB1String("string1");
+ String b1Str2 = d.getB1String2("string2", "string3");
+ String c1Str1 = d.getC1String("string5");
+ String c1Str2 = d.getC1String2("string6", "string7");
+
+ int b1Int = d.getB1Int(4000);
+ float c1Float = d.getC1Float((float) 8.8);
+
+ Integer c1Integer = d.getC1Integer(new Integer(9000));
+
+ System.out.println(dName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int + ", " + c1Str1 + ", " + c1Str2 + ", " + c1Float + ", " + c1Integer);
+ Assert.assertEquals("DService", dName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ Assert.assertEquals("string5", c1Str1);
+ Assert.assertEquals("string6string7", c1Str2);
+ Assert.assertEquals((float) 8.8, c1Float);
+ Assert.assertEquals(new Integer(9000), c1Integer);
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/pom.xml
new file mode 100644
index 0000000000..e984f8b4bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/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-vtest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>vtest-utilities</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>service</module>
+ <module>nowsdl</module>
+ <module>wsdlelement</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/pom.xml
new file mode 100644
index 0000000000..3f0a2a4125
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/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>vtest-wsbinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-service</artifactId>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/AClientService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/AClientService.java
new file mode 100644
index 0000000000..397f6b4c5a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/AClientService.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.vtest.wsbinding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AClientService.
+ */
+@Remotable
+public interface AClientService {
+ public String getGreetingsForward(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/AService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/AService.java
new file mode 100644
index 0000000000..b97e0cfebb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/AService.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.vtest.wsbinding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+public interface AService {
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/impl/AClientServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/impl/AClientServiceImpl.java
new file mode 100644
index 0000000000..8d9e6de816
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/impl/AClientServiceImpl.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.vtest.wsbinding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.AClientService;
+import org.apache.tuscany.sca.vtest.wsbinding.AService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AClientService.class)
+public class AClientServiceImpl implements AClientService {
+
+ @Reference
+ protected AService aService;
+
+ public String getGreetingsForward(String name) {
+ return aService.getGreetings(name);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/impl/AServiceImpl.java
new file mode 100644
index 0000000000..450da9cbcf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/impl/AServiceImpl.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.vtest.wsbinding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.AService;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/aservice.wsdl b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/aservice.wsdl
new file mode 100644
index 0000000000..e7953eb2b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/aservice.wsdl
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://wsbinding.vtest.sca.tuscany.apache.org"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:ns0="http://wsbinding.vtest.sca.tuscany.apache.org"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns1="http://org.apache.axis2/xsd"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://wsbinding.vtest.sca.tuscany.apache.org" xmlns:ns="http://wsbinding.vtest.sca.tuscany.apache.org">
+ <xs:element name="getGreetings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part name="parameters" element="ns0:getGreetings"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part name="parameters" element="ns0:getGreetingsResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="AServicePortType">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="ns0:getGreetingsRequest" wsaw:Action="urn:getGreetings"/>
+ <wsdl:output message="ns0:getGreetingsResponse" wsaw:Action="urn:getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AServiceSOAP12Binding" type="ns0:AServicePortType">
+ <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <soap12:operation soapAction="urn:getGreetings" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="AServicePortTypeBinding" type="ns0:AServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <soap:operation soapAction=""/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="AServiceHttpBinding" type="ns0:AServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="getGreetings">
+ <http:operation location="AService/getGreetings"/>
+ <wsdl:input>
+ <mime:content part="getGreetings" type="text/xml"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="getGreetings" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="AServiceSOAP11Binding" type="ns0:AServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <soap:operation soapAction="urn:getGreetings" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AServicePortTypeService">
+ <wsdl:port name="AServicePortTypePort" binding="ns0:AServicePortTypeBinding">
+ <soap:address location="http://localhost:8085/AService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <wsdl:service name="AService">
+ <wsdl:port name="AServiceHttpport" binding="ns0:AServiceHttpBinding">
+ <http:address location="http://localhost:8085/AService/httpport"/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP12port_http" binding="ns0:AServiceSOAP12Binding">
+ <soap12:address location="http://localhost:8085/AService/soap12port"/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP11port_http" binding="ns0:AServiceSOAP11Binding">
+ <soap:address location="http://localhost:8085/AService/soap11port"/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP12port_http_null" binding="ns0:AServiceSOAP12Binding">
+ <soap12:address location=""/>
+ </wsdl:port>
+ <wsdl:port name="AServiceSOAP12port_http_wsdl" binding="ns0:AServiceSOAP12Binding">
+ <soap12:address location="inWsdl"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/endpoint-uri-resolution.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/endpoint-uri-resolution.composite
new file mode 100644
index 0000000000..0d92174442
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/endpoint-uri-resolution.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ name="endpoint-uri-resolution">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AServiceImpl"/>
+ <service name="AService">
+ <binding.ws name="bnd1" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.port(AService/AServiceSOAP12port_http)"
+ uri="http://localhost:8085/AService/soap12portxxx"/>
+ <binding.ws name="bnd2" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.binding(AServiceSOAP11Binding)"
+ uri="http://localhost:8085/AService/endpointrefxxx">
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>http://localhost:8085/AService/endpointref</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ <binding.ws name="bnd3" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.port(AService/AServiceSOAP12port_http_null)"
+ uri="http://localhost:8085/AService/uriInBinding"/>
+ <!-- binding.ws name="bnd4" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.port(AService/AServiceSOAP12port_http_null)"/-->
+ <binding.ws name="bnd5" uri="http://localhost:8085/AService/noWsdlElement"/>
+ <binding.ws name="bnd6" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.port(AService/AServiceSOAP12port_http_wsdl)"
+ uri="http://localhost:8085/AService/endpointref6"/>
+ <binding.ws name="bnd7" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.binding(AServiceSOAP11Binding)"
+ uri="http://localhost:8085/AService/endpointref7">
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>inAddress</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ <binding.ws name="bnd8" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.binding(AServiceSOAP12Binding)"
+ uri="http://localhost:8085/AService/endpointref8">
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address></wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ </service>
+ </component>
+ <component name="AClientComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/soap12port"/>
+ </reference>
+ </component>
+ <component name="AClientComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/endpointref"/>
+ </reference>
+ </component>
+ <component name="AClientComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/uriInBinding"/>
+ </reference>
+ </component>
+ <component name="AClientComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AComponent"/>
+ </reference>
+ </component>
+ <component name="AClientComponent5">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/noWsdlElement"/>
+ </reference>
+ </component>
+ <component name="AClientComponent6">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/endpointref6/inWsdl"/>
+ </reference>
+ </component>
+ <component name="AClientComponent7">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/endpointref7/inAddress"/>
+ </reference>
+ </component>
+ <component name="AClientComponent8">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/endpointref8"/>
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/endpointreference.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/endpointreference.composite
new file mode 100644
index 0000000000..3ba152b7b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/endpointreference.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest"
+ name="endpointreference">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AServiceImpl"/>
+ <service name="AService">
+ <binding.ws wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.binding(AServiceSOAP11Binding)">
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>http://localhost:8085/AService/endpointref</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ </service>
+ </component>
+ <component name="AClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/endpointref"/>
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlbinding.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlbinding.composite
new file mode 100644
index 0000000000..85c604070a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlbinding.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://vtest"
+ name="wsdlbinding">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AServiceImpl"/>
+ <service name="AService">
+ <binding.ws name="bnd11" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.binding(AServiceSOAP11Binding)"
+ uri="http://localhost:8085/AService/bnd11"/>
+ <binding.ws name="bnd12" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.binding(AServiceSOAP12Binding)"
+ uri="http://localhost:8085/AService/bnd12"/>
+ </service>
+ </component>
+ <component name="AClientBnd11Component">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/bnd11"/>
+ </reference>
+ </component>
+ <component name="AClientBnd12Component">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/bnd12"/>
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlendpoint.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlendpoint.composite
new file mode 100644
index 0000000000..0c11c79efe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlendpoint.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://vtest"
+ name="wsdlendpoint">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AServiceImpl"/>
+ <service name="AService">
+ <binding.ws wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.endpoint(AService/AServiceEndPoint)"
+ uri="http://localhost:8085/AService/endpoint"/>
+ </service>
+ </component>
+ <component name="AClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/endpoint"/>
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlport.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlport.composite
new file mode 100644
index 0000000000..859b93bec4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlport.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://vtest"
+ name="wsdlport">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AServiceImpl"/>
+ <service name="AService">
+ <binding.ws name="p11" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.port(AService/AServiceSOAP11port_http)"/>
+ <binding.ws name="p12" wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.port(AService/AServiceSOAP12port_http)"/>
+ </service>
+ </component>
+ <component name="AClientP11Component">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/soap11port"/>
+ </reference>
+ </component>
+ <component name="AClientP12Component">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/soap12port"/>
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlservice.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlservice.composite
new file mode 100644
index 0000000000..fa96e650de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/main/resources/wsdlservice.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://vtest"
+ name="wsdlservice">
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AServiceImpl"/>
+ <service name="AService">
+ <binding.ws wsdlElement="http://wsbinding.vtest.sca.tuscany.apache.org#wsdl.service(AService)"
+ uri="http://localhost:8085/AComponent"/>
+ </service>
+ </component>
+ <component name="AClientS11Component">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/soap11port"/>
+ </reference>
+ </component>
+ <component name="AClientS12Component">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.impl.AClientServiceImpl"/>
+ <reference name="aService">
+ <binding.ws uri="http://localhost:8085/AService/soap12port"/>
+ </reference>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/EndpointReferenceTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/EndpointReferenceTestCase.java
new file mode 100644
index 0000000000..d858daaf78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/EndpointReferenceTestCase.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.vtest.wsbinding;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests EndpointReference element specified in service binding.ws as per Web
+ * Services Binding Specification v1.00 - Sec 2.1 - Lines 61 to 65.
+ */
+public class EndpointReferenceTestCase {
+
+ protected static String compositeName = "endpointreference.composite";
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 61-65
+ * <p>
+ * /binding.ws/wsa:EndpointReference – optional WS-Addressing [6]
+ * EndpointReference that specifies the endpoint for the service or
+ * reference. When this element is present along with the wsdlElement
+ * attribute on the parent element, the wsdlElement attribute value MUST be
+ * of the ‘Binding’ form as specified above, i.e. <WSDL-namespace-
+ * URI>#wsdl.binding(<binding-name>).
+ */
+ @Test
+ public void testWsdlBinding() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/EndpointUriResolutionTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/EndpointUriResolutionTestCase.java
new file mode 100644
index 0000000000..49f9db248f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/EndpointUriResolutionTestCase.java
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.vtest.wsbinding;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests "Endpoint URI resolution" for service binding.ws as per Web Services
+ * Binding Specification v1.00 - Sec 2.1.1 - Lines 70 to 85.
+ */
+public class EndpointUriResolutionTestCase {
+
+ protected static String compositeName = "endpoint-uri-resolution.composite";
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 71-78
+ * <p>
+ * The rules for resolving the URI at which an SCA service is hosted, or SCA
+ * reference targets, when used with binding.ws (in precedence order) are:
+ * 1. The URIs in the endpoint(s) of the referenced WSDL or The URI
+ * specified by the wsa:Address element of the wsa:EndpointReference, 2. The
+ * explicitly stated URI in the "uri" attribute of the binding.ws element,
+ * which may be relative, 3. The implicit URI as defined by the Assembly
+ * specification
+ * <p>
+ * This method tests that URI in the endpoint takes precedence.
+ */
+ @Test
+ public void testUriInEndpoint() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent1");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ /**
+ * Lines 71-78
+ * <p>
+ * The rules for resolving the URI at which an SCA service is hosted, or SCA
+ * reference targets, when used with binding.ws (in precedence order) are:
+ * 1. The URIs in the endpoint(s) of the referenced WSDL or The URI
+ * specified by the wsa:Address element of the wsa:EndpointReference, 2. The
+ * explicitly stated URI in the "uri" attribute of the binding.ws element,
+ * which may be relative, 3. The implicit URI as defined by the Assembly
+ * specification
+ * <p>
+ * This method tests that URI in the EndpointReference takes precedence.
+ */
+ @Test
+ public void testUriInEndpointReference() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent2");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ /**
+ * Lines 71-78
+ * <p>
+ * The rules for resolving the URI at which an SCA service is hosted, or SCA
+ * reference targets, when used with binding.ws (in precedence order) are:
+ * 1. The URIs in the endpoint(s) of the referenced WSDL or The URI
+ * specified by the wsa:Address element of the wsa:EndpointReference, 2. The
+ * explicitly stated URI in the "uri" attribute of the binding.ws element,
+ * which may be relative, 3. The implicit URI as defined by the Assembly
+ * specification
+ * <p>
+ * This method tests that explicitly stated URI in the "uri" attribute of
+ * binding.ws takes precedence.
+ */
+ @Test
+ public void testUriInBindingWs() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent3");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ /**
+ * Lines 71-78
+ * <p>
+ * The rules for resolving the URI at which an SCA service is hosted, or SCA
+ * reference targets, when used with binding.ws (in precedence order) are:
+ * 1. The URIs in the endpoint(s) of the referenced WSDL or The URI
+ * specified by the wsa:Address element of the wsa:EndpointReference, 2. The
+ * explicitly stated URI in the "uri" attribute of the binding.ws element,
+ * which may be relative, 3. The implicit URI as defined by the Assembly
+ * specification
+ * <p>
+ * This method tests that implicit URI is used.
+ */
+ @Ignore("TUSCANY-2523 - Port 8080 conflicts with Continuum")
+ @Test
+ public void testImplicitUri() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent4");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ /**
+ * Lines 71-78
+ * <p>
+ * The rules for resolving the URI at which an SCA service is hosted, or SCA
+ * reference targets, when used with binding.ws (in precedence order) are:
+ * 1. The URIs in the endpoint(s) of the referenced WSDL or The URI
+ * specified by the wsa:Address element of the wsa:EndpointReference, 2. The
+ * explicitly stated URI in the "uri" attribute of the binding.ws element,
+ * which may be relative, 3. The implicit URI as defined by the Assembly
+ * specification
+ * <p>
+ * This method tests that explicitly stated URI in the "uri" attribute of
+ * the binding.ws is used in the absence of a wsdlElement.
+ */
+ @Test
+ public void testNoWsdlElement() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent5");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ /**
+ * Lines 79-83
+ * <p>
+ * The URI in the WSDL endpoint or in the wsa:Address of an EPR may be a
+ * relative URI, in which case it is relative to the URI defined in (2) or
+ * (3). The wsa:Address element can be the empty relative URI, in which case
+ * it uses the URI defined in (2) or (3) directly. This allows the EPR
+ * writer to specify reference parameters, metadata and other EPR contents
+ * while allowing the URI to be chosen by the deployer.
+ * <p>
+ * This method tests that the relative URI specified in WSDL endpoint is
+ * used along with the explicit URI specified in the "uri" attribute of
+ * binding.ws element.
+ */
+ @Test
+ public void testRelativeUriInWsdl() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent6");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ /**
+ * Lines 79-83
+ * <p>
+ * The URI in the WSDL endpoint or in the wsa:Address of an EPR may be a
+ * relative URI, in which case it is relative to the URI defined in (2) or
+ * (3). The wsa:Address element can be the empty relative URI, in which case
+ * it uses the URI defined in (2) or (3) directly. This allows the EPR
+ * writer to specify reference parameters, metadata and other EPR contents
+ * while allowing the URI to be chosen by the deployer.
+ * <p>
+ * This method tests that the relative URI specified in wsa:Address is used
+ * along with the explicit URI specified in the "uri" attribute of
+ * binding.ws element.
+ */
+ @Test
+ public void testRelativeUriInAddress() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent7");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ /**
+ * Lines 79-83
+ * <p>
+ * The URI in the WSDL endpoint or in the wsa:Address of an EPR may be a
+ * relative URI, in which case it is relative to the URI defined in (2) or
+ * (3). The wsa:Address element can be the empty relative URI, in which case
+ * it uses the URI defined in (2) or (3) directly. This allows the EPR
+ * writer to specify reference parameters, metadata and other EPR contents
+ * while allowing the URI to be chosen by the deployer.
+ * <p>
+ * This method tests that when wsa:Address is empty, the explicit URI
+ * specified in the "uri" attribute of binding.ws element is used.
+ */
+ @Test
+ public void testEmptyAddressElement() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent8");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlBindingTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlBindingTestCase.java
new file mode 100644
index 0000000000..292de8b654
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlBindingTestCase.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.vtest.wsbinding;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests wsdlElement specified on service binding.ws as per Web Services Binding Specification v1.00 - Sec 2.1
+ * - Lines 35 to 54.
+ */
+public class WsdlBindingTestCase {
+
+ protected static String compositeName = "wsdlbinding.composite";
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 50-54
+ * <p>
+ * Binding:
+ * <WSDL-namespace-URI>#wsdl.binding(<binding-name>)
+ * In this case, the identified WSDL binding must have an equivalent PortType with the SCA
+ * service or reference. In this case the endpoint address URI for the SCA service or
+ * reference must be provided via the URI attribute on the binding.
+ */
+ @Test
+ public void testWsdlBinding() throws Exception {
+ AClientService aClientBnd11 = ServiceFinder.getService(AClientService.class, "AClientBnd11Component");
+ Assert.assertEquals("Hello Pandu", aClientBnd11.getGreetingsForward("Pandu"));
+ AClientService aClientBnd12 = ServiceFinder.getService(AClientService.class, "AClientBnd12Component");
+ Assert.assertEquals("Hello Pandu", aClientBnd12.getGreetingsForward("Pandu"));
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlEndpointTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlEndpointTestCase.java
new file mode 100644
index 0000000000..842da87bd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlEndpointTestCase.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.vtest.wsbinding;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests wsdlElement specified on service binding.ws as per Web Services Binding
+ * Specification v1.00 - Sec 2.1 - Lines 35 to 54.
+ */
+public class WsdlEndpointTestCase {
+
+ protected static String compositeName = "wsdlendpoint.composite";
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 46-49
+ * <p>
+ * Endpoint (WSDL 2.0): <WSDL-namespace-URI>#wsdl.endpoint(<service-name>/<endpoint-name>)
+ * In this case, the identified endpoint in the WSDL 2.0 Service must have
+ * an equivalent PortType with the SCA service or reference.
+ */
+ @Test
+ @Ignore("WSDL2.0 Support")
+ public void testWsdlEndpoint() throws Exception {
+ AClientService aClient = ServiceFinder.getService(AClientService.class, "AClientComponent");
+ Assert.assertEquals("Hello Pandu", aClient.getGreetingsForward("Pandu"));
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlPortTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlPortTestCase.java
new file mode 100644
index 0000000000..0545cef776
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlPortTestCase.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.vtest.wsbinding;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests wsdlElement specified on service binding.ws as per Web Services Binding
+ * Specification v1.00 - Sec 2.1 - Lines 35 to 54.
+ */
+public class WsdlPortTestCase {
+
+ protected static String compositeName = "wsdlport.composite";
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 42-45
+ * <p>
+ * Port (WSDL 1.1): <WSDL-namespace-URI>#wsdl.port(<service-name>/<port-name>)
+ * In this case, the identified port in the WSDL 1.1 Service must have an
+ * equivalent PortType with the SCA service or reference.
+ */
+ @Test
+ public void testWsdlPort() throws Exception {
+ AClientService aClientP11 = ServiceFinder.getService(AClientService.class, "AClientP11Component");
+ Assert.assertEquals("Hello Pandu", aClientP11.getGreetingsForward("Pandu"));
+ AClientService aClientP12 = ServiceFinder.getService(AClientService.class, "AClientP12Component");
+ Assert.assertEquals("Hello Pandu", aClientP12.getGreetingsForward("Pandu"));
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlServiceTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlServiceTestCase.java
new file mode 100644
index 0000000000..aa2b2fac7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/WsdlServiceTestCase.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.vtest.wsbinding;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests wsdlElement specified on service binding.ws as per Web Services Binding
+ * Specification v1.00 - Sec 2.1 - Lines 35 to 54.
+ */
+public class WsdlServiceTestCase {
+
+ protected static String compositeName = "wsdlservice.composite";
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 38-41
+ * <p>
+ * Service: <WSDL-namespace-URI>#wsdl.service(<service-name>) In this case,
+ * all the endpoints in the WSDL Service that have equivalent PortTypes with
+ * the SCA service or reference must be available to the SCA service or
+ * reference.
+ */
+ @Test
+ @Ignore("TUSCANY-2298")
+ public void testWsdlService() throws Exception {
+ AClientService aClientS11 = ServiceFinder.getService(AClientService.class, "AClientS11Component");
+ Assert.assertEquals("Hello Pandu", aClientS11.getGreetingsForward("Pandu"));
+ AClientService aClientS12 = ServiceFinder.getService(AClientService.class, "AClientS12Component");
+ Assert.assertEquals("Hello Pandu", aClientS12.getGreetingsForward("Pandu"));
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/pom.xml
new file mode 100644
index 0000000000..205fbcc785
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/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>vtest-wsbinding-wsdlelement</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-wsdlelement-binding</artifactId>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - WSDL wsdlElement wsdl.binding</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/AService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/AService.java
new file mode 100644
index 0000000000..49d12876e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/AService.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.vtest.wsbinding.wsdlelement.binding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+public interface AService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getB2String(String aString);
+
+ public int getB2Int(int i);
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/BService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/BService.java
new file mode 100644
index 0000000000..b303f09dbc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/BService.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.vtest.wsbinding.wsdlelement.binding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/BService2.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/BService2.java
new file mode 100644
index 0000000000..7089663cf1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/BService2.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.vtest.wsbinding.wsdlelement.binding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService2 {
+
+ public String getString(String aString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/CService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/CService.java
new file mode 100644
index 0000000000..56f7415208
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/CService.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.vtest.wsbinding.wsdlelement.binding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface CService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public Integer getInteger(Integer i);
+
+ public float getFloat(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/DService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/DService.java
new file mode 100644
index 0000000000..90a78d3f0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/DService.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.vtest.wsbinding.wsdlelement.binding;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for DService.
+ */
+@Remotable
+public interface DService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getC1String(String aString);
+
+ public String getC1String2(String aString, String bString);
+
+ public Integer getC1Integer(Integer i);
+
+ public float getC1Float(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/AServiceImpl.java
new file mode 100644
index 0000000000..ce5adf2cc5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/AServiceImpl.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.vtest.wsbinding.wsdlelement.binding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService2;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference(required=false)
+ public BService b1;
+
+ @Reference(required=false)
+ public BService2 b2;
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getB2String(String aString) {
+ return b2.getString(aString);
+ }
+
+ public int getB2Int(int i) {
+ return b2.getInt(i);
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/BService2Impl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/BService2Impl.java
new file mode 100644
index 0000000000..4040108542
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/BService2Impl.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.vtest.wsbinding.wsdlelement.binding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService2;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService2.class)
+public class BService2Impl implements BService2 {
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/BServiceImpl.java
new file mode 100644
index 0000000000..66c9cb4136
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/BServiceImpl.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.vtest.wsbinding.wsdlelement.binding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/CServiceImpl.java
new file mode 100644
index 0000000000..ecdfbd59e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/CServiceImpl.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.vtest.wsbinding.wsdlelement.binding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.CService;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl implements CService {
+
+ public String getName() {
+ return "CService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public Integer getInteger(Integer i) {
+ return i;
+ }
+
+ public float getFloat(float f) {
+ return f;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/DServiceImpl.java
new file mode 100644
index 0000000000..06470f29f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/impl/DServiceImpl.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.vtest.wsbinding.wsdlelement.binding.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.CService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.DService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements DService.
+ */
+@Service(DService.class)
+public class DServiceImpl implements DService {
+
+ @Reference
+ public BService b1;
+
+ @Reference
+ public CService c1;
+
+ public String getName() {
+ return "DService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getC1String(String aString) {
+ return c1.getString(aString);
+ }
+
+ public String getC1String2(String aString, String bString) {
+ return c1.getString2(aString, bString);
+ }
+
+ public Integer getC1Integer(Integer i) {
+ return c1.getInteger(i);
+ }
+
+ public float getC1Float(float f) {
+ return c1.getFloat(f);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/bservice.wsdl b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/bservice.wsdl
new file mode 100644
index 0000000000..8ce0fbaeb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/bservice.wsdl
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://vtest.wsbinding.wsdlelement.binding.bservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="wsdlelement" targetNamespace="http://vtest.wsbinding.wsdlelement.binding.bservice" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://vtest.wsbinding.wsdlelement.binding.bservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getString">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getStringResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2">
+ <xsd:complexType>
+ <xsd:sequence> <xsd:element name="in1" type="xsd:string"></xsd:element>
+ <xsd:element name="in2" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getInt">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:int"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getIntResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:int"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getStringRequest">
+ <wsdl:part element="tns:getString" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part element="tns:getStringResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getString2Request">
+ <wsdl:part name="parameters" element="tns:getString2"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Response">
+ <wsdl:part name="parameters" element="tns:getString2Response"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntRequest">
+ <wsdl:part name="parameters" element="tns:getInt"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntResponse">
+ <wsdl:part name="parameters" element="tns:getIntResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringRequest">
+ <wsdl:part name="parameters" element="tns:getString"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part name="parameters" element="tns:getStringResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntRequest">
+ <wsdl:part name="parameters" element="tns:getInt"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntResponse">
+ <wsdl:part name="parameters" element="tns:getIntResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="BService1PortType">
+ <wsdl:operation name="getString">
+ <wsdl:input message="tns:getStringRequest"/>
+ <wsdl:output message="tns:getStringResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <wsdl:input message="tns:getString2Request"></wsdl:input>
+ <wsdl:output message="tns:getString2Response"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <wsdl:input message="tns:getIntRequest"></wsdl:input>
+ <wsdl:output message="tns:getIntResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="BService2PortType">
+ <wsdl:operation name="getString">
+ <wsdl:input message="tns:getStringRequest"></wsdl:input>
+ <wsdl:output message="tns:getStringResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <wsdl:input message="tns:getIntRequest"></wsdl:input>
+ <wsdl:output message="tns:getIntResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="BService1SOAPBinding"
+ type="tns:BService1PortType"> <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getString"> <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.bservice/getString" /> <wsdl:input> <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output> <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.bservice/getString2" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.bservice/getInt" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="BService2SOAPBinding"
+ type="tns:BService2PortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getString">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.bservice/getString" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.bservice/getInt" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="BService3SOAP12Binding"
+ type="tns:BService1PortType">
+ <soap12:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getString">
+ <soap12:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.bservice/getString" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <soap12:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.bservice/getString2" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <soap12:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.bservice/getInt" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="BService">
+ <wsdl:port binding="tns:BService1SOAPBinding" name="BService1SOAP">
+ <soap:address location=""/>
+ </wsdl:port>
+ <wsdl:port name="BService2SOAP"
+ binding="tns:BService2SOAPBinding">
+ <soap:address location="" />
+ </wsdl:port>
+ <wsdl:port name="BService3SOAP12"
+ binding="tns:BService3SOAP12Binding">
+ <soap12:address location=""></soap12:address>
+ </wsdl:port>
+ </wsdl:service>
+ <wsdl:service name="BService2">
+ <wsdl:port name="BService2Port" binding="tns:BService2SOAPBinding">
+ <soap:address location="" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/cservice.wsdl b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/cservice.wsdl
new file mode 100644
index 0000000000..ff151faa7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/cservice.wsdl
@@ -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.
+-->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://vtest.wsbinding.wsdlelement.binding.cservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CService" targetNamespace="http://vtest.wsbinding.wsdlelement.binding.cservice">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://vtest.wsbinding.wsdlelement.binding.cservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getFloat">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getFloatResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getInteger">
+ <xsd:complexType>
+ <xsd:sequence> <xsd:element name="in" type="xsd:integer"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getIntegerResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:integer"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in1" type="xsd:string"></xsd:element>
+ <xsd:element name="in2" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getStringResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getFloatRequest">
+ <wsdl:part element="tns:getFloat" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getFloatResponse">
+ <wsdl:part element="tns:getFloatResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getIntegerRequest">
+ <wsdl:part name="parameters" element="tns:getInteger"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntegerResponse">
+ <wsdl:part name="parameters" element="tns:getIntegerResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Request">
+ <wsdl:part name="parameters" element="tns:getString2"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Response">
+ <wsdl:part name="parameters" element="tns:getString2Response"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringRequest">
+ <wsdl:part name="parameters" element="tns:getString"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part name="parameters" element="tns:getStringResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Request">
+ <wsdl:part name="parameters" element="tns:getString2"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Response">
+ <wsdl:part name="parameters" element="tns:getString2Response"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CServicePortType">
+ <wsdl:operation name="getFloat">
+ <wsdl:input message="tns:getFloatRequest"/>
+ <wsdl:output message="tns:getFloatResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getInteger">
+ <wsdl:input message="tns:getIntegerRequest"></wsdl:input>
+ <wsdl:output message="tns:getIntegerResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString">
+ <wsdl:input message="tns:getStringRequest"></wsdl:input>
+ <wsdl:output message="tns:getStringResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <wsdl:input message="tns:getString2Request"></wsdl:input>
+ <wsdl:output message="tns:getString2Response"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CServiceSOAPBinding"
+ type="tns:CServicePortType"> <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getFloat"> <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.cservice/getFloat" /> <wsdl:input> <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output> <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInteger">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.cservice/getInteger" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.cservice/getString" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.binding.cservice/getString2" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CService">
+ <wsdl:port binding="tns:CServiceSOAPBinding" name="CServiceSOAP">
+ <soap:address location=""/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/wsdlelement.binding.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/wsdlelement.binding.composite
new file mode 100644
index 0000000000..6b97b5e602
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/main/resources/wsdlelement.binding.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://vtest.wsbinding.wsdlelement.binding"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="wsdlelement.binding">
+
+ <component name="BComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.bservice#wsdl.binding(BService1SOAPBinding)"
+ uri="http://localhost:8085/BComponent1"/>
+ </service>
+ </component>
+
+ <component name="BComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.bservice#wsdl.binding(BService2SOAPBinding)"
+ uri="http://localhost:8085/BComponent2"/>
+ </service>
+ </component>
+
+ <component name="BComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.BService2Impl"/>
+ <service name="BService2">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService2"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.bservice#wsdl.binding(BService2SOAPBinding)"
+ uri="http://localhost:8085/BComponent3"/>
+ </service>
+ </component>
+
+ <component name="BComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.bservice#wsdl.binding(BService3SOAP12Binding)"
+ uri="http://localhost:8085/BComponent4"/>
+ </service>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.CServiceImpl"/>
+ <service name="CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.CService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.cservice#wsdl.binding(CServiceSOAPBinding)"
+ uri="http://localhost:8085/CComponent"/>
+ </service>
+ </component>
+
+ <component name="AComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent1/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.bservice#wsdl.binding(BService1SOAPBinding)" uri="http://localhost:8085/BComponent1"/>
+ </reference>
+ </component>
+
+ <component name="AComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent2/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.bservice#wsdl.binding(BService2SOAPBinding)" uri="http://localhost:8085/BComponent2"/>
+ </reference>
+ </component>
+
+ <component name="AComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.AServiceImpl"/>
+ <reference name="b2" target="BComponent3/BService2">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService2"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.bservice#wsdl.binding(BService2SOAPBinding)" uri="http://localhost:8085/BComponent3"/>
+ </reference>
+ </component>
+
+ <component name="AComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent4/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.bservice#wsdl.binding(BService3SOAP12Binding)" uri="http://localhost:8085/BComponent4"/>
+ </reference>
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.impl.DServiceImpl"/>
+ <reference name="b1" target="BComponent1/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.bservice#wsdl.binding(BService1SOAPBinding)" uri="http://localhost:8085/BComponent1"/>
+ </reference>
+ <reference name="c1" target="CComponent/CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.CService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.binding.cservice#wsdl.binding(CServiceSOAPBinding)" uri="http://localhost:8085/CComponent"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/WsdlElementBindingTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/WsdlElementBindingTestCase.java
new file mode 100644
index 0000000000..f30cf38654
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/binding/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/binding/WsdlElementBindingTestCase.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.vtest.wsbinding.wsdlelement.binding;
+
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.binding.DService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element wsdl.binding with WSDL
+ * document described in section section 2.1 of SCA Web Services Binding
+ * V1.00<br>
+ */
+public class WsdlElementBindingTestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "wsdlelement.binding.composite";
+ protected static AService a1;
+ protected static AService a2;
+ protected static AService a3;
+ protected static AService a4;
+ protected static DService d;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a1 = ServiceFinder.getService(AService.class, "AComponent1");
+ a2 = ServiceFinder.getService(AService.class, "AComponent2");
+ a3 = ServiceFinder.getService(AService.class, "AComponent3");
+ a4 = ServiceFinder.getService(AService.class, "AComponent4");
+ d = ServiceFinder.getService(DService.class, "DComponent1");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 50-54:<br>
+ * Binding:<br>
+ * <WSDL-namespace-URI>#wsdl.binding(<binding-name>)<br>
+ * In this case, the identified WSDL binding must have an equivalent
+ * PortType with the SCA service or reference. In this case the endpoint
+ * address URI for the SCA service or reference must be provided via the
+ * URI attribute on the binding.<br>
+ * <br>
+ * Tests wsdl.binding(BService1SOAPBinding)<br>
+ */
+ @Test
+ public void testWsdlElementBinding1() throws Exception {
+ String aName = a1.getName();
+ String b1Str1 = a1.getB1String("string1");
+ String b1Str2 = a1.getB1String2("string2", "string3");
+ int b1Int = a1.getB1Int(1000);
+
+ System.out.println(aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(1000, b1Int);
+ }
+
+ /**
+ * Lines 50-54:<br>
+ * Binding:<br>
+ * <br>
+ * Tests wsdl.binding(BService2SOAPBinding) with BService where the binding
+ * does not define getString2, so exceptions are expected.<br>
+ */
+ @Test
+ public void testWsdlElementBinding2() throws Exception {
+ String aName = a2.getName();
+ System.out.println(aName + ": ");
+ try {
+ a2.getB1String("string1");
+ fail("Should not be able to call getString");
+ } catch (Exception e) {
+ System.out.println(" Exception is expected: " + e.toString());
+ }
+ try {
+ a2.getB1String2("string2", "string3");
+ fail("Should not be able to call getString2");
+ } catch (Exception e) {
+ System.out.println(" Exception is expected: " + e.toString());
+ }
+ try {
+ a2.getB1Int(2000);
+ fail("Should not be able to call getInt");
+ } catch (Exception e) {
+ System.out.println(" Exception is expected: " + e.toString());
+ }
+ }
+
+ /**
+ * Lines 50-54:<br>
+ * Binding:<br>
+ * <br>
+ * Tests wsdl.binding(BService2SOAPBinding) with BService2<br>
+ */
+ @Test
+ public void testWsdlElementBinding3() throws Exception {
+ String aName = a3.getName();
+ String b2Str1 = a3.getB2String("string1");
+ int b2Int = a3.getB2Int(3000);
+
+ System.out.println(aName + ": " + b2Str1 + ", " + b2Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b2Str1);
+ Assert.assertEquals(3000, b2Int);
+ }
+
+ /**
+ * Lines 50-54:<br>
+ * Binding:<br>
+ * <br>
+ * Tests two references using wsdl.binding.<br>
+ */
+ @Test
+ public void testWsdlElementBinding4() throws Exception {
+ String dName = d.getName();
+ String b1Str1 = d.getB1String("string1");
+ String b1Str2 = d.getB1String2("string2", "string3");
+ String c1Str1 = d.getC1String("string5");
+ String c1Str2 = d.getC1String2("string6", "string7");
+
+ int b1Int = d.getB1Int(4000);
+ float c1Float = d.getC1Float((float) 8.8);
+
+ Integer c1Integer = d.getC1Integer(new Integer(9000));
+
+ System.out.println(dName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int + ", " + c1Str1 + ", " + c1Str2 + ", " + c1Float + ", " + c1Integer);
+ Assert.assertEquals("DService", dName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ Assert.assertEquals("string5", c1Str1);
+ Assert.assertEquals("string6string7", c1Str2);
+ Assert.assertEquals((float) 8.8, c1Float);
+ Assert.assertEquals(new Integer(9000), c1Integer);
+ }
+
+ /**
+ * Lines 50-54:<br>
+ * Binding:<br>
+ * <br>
+ * Tests wsdl.binding(BService3SOAP12Binding) which uses SOAP 1.2<br>
+ */
+ @Test
+ public void testWsdlElementBinding5() throws Exception {
+ String aName = a4.getName();
+ String b1Str1 = a4.getB1String("string1");
+ String b1Str2 = a4.getB1String2("string2", "string3");
+ int b1Int = a4.getB1Int(5000);
+
+ System.out.println(aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(5000, b1Int);
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/pom.xml
new file mode 100644
index 0000000000..e1707234dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/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>vtest-wsbinding</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-wsdlelement</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - wsdlElement</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>vtest-utilities</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>service</module>
+ <module>port</module>
+ <module>binding</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/pom.xml
new file mode 100644
index 0000000000..777e7cc210
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/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>vtest-wsbinding-wsdlelement</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-wsdlelement-port</artifactId>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - WSDL wsdlElement wsdl.port</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/AService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/AService.java
new file mode 100644
index 0000000000..a0ed87249f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/AService.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.vtest.wsbinding.wsdlelement.port;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+public interface AService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getB2String(String aString);
+
+ public int getB2Int(int i);
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/BService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/BService.java
new file mode 100644
index 0000000000..1bdabeaea7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/BService.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.vtest.wsbinding.wsdlelement.port;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/BService2.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/BService2.java
new file mode 100644
index 0000000000..3952d8c792
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/BService2.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.vtest.wsbinding.wsdlelement.port;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService2 {
+
+ public String getString(String aString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/CService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/CService.java
new file mode 100644
index 0000000000..244907fa19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/CService.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.vtest.wsbinding.wsdlelement.port;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface CService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public Integer getInteger(Integer i);
+
+ public float getFloat(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/DService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/DService.java
new file mode 100644
index 0000000000..519374c1bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/DService.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.vtest.wsbinding.wsdlelement.port;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for DService.
+ */
+@Remotable
+public interface DService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getC1String(String aString);
+
+ public String getC1String2(String aString, String bString);
+
+ public Integer getC1Integer(Integer i);
+
+ public float getC1Float(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/AServiceImpl.java
new file mode 100644
index 0000000000..558ddcbb49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/AServiceImpl.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.vtest.wsbinding.wsdlelement.port.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService2;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference(required=false)
+ public BService b1;
+
+ @Reference(required=false)
+ public BService2 b2;
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getB2String(String aString) {
+ return b2.getString(aString);
+ }
+
+ public int getB2Int(int i) {
+ return b2.getInt(i);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/BService2Impl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/BService2Impl.java
new file mode 100644
index 0000000000..b1dd73edc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/BService2Impl.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.vtest.wsbinding.wsdlelement.port.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService2;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService2.class)
+public class BService2Impl implements BService2 {
+
+ public String getName() {
+ return "BService2";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/BServiceImpl.java
new file mode 100644
index 0000000000..b132fca45b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/BServiceImpl.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.vtest.wsbinding.wsdlelement.port.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/CServiceImpl.java
new file mode 100644
index 0000000000..ca3ec62b83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/CServiceImpl.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.vtest.wsbinding.wsdlelement.port.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.CService;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl implements CService {
+
+ public String getName() {
+ return "CService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public Integer getInteger(Integer i) {
+ return i;
+ }
+
+ public float getFloat(float f) {
+ return f;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/DServiceImpl.java
new file mode 100644
index 0000000000..767deae23f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/impl/DServiceImpl.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.vtest.wsbinding.wsdlelement.port.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.CService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.DService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements DService.
+ */
+@Service(DService.class)
+public class DServiceImpl implements DService {
+
+ @Reference
+ public BService b1;
+
+ @Reference
+ public CService c1;
+
+ public String getName() {
+ return "DService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getC1String(String aString) {
+ return c1.getString(aString);
+ }
+
+ public String getC1String2(String aString, String bString) {
+ return c1.getString2(aString, bString);
+ }
+
+ public Integer getC1Integer(Integer i) {
+ return c1.getInteger(i);
+ }
+
+ public float getC1Float(float f) {
+ return c1.getFloat(f);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/bservice.wsdl b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/bservice.wsdl
new file mode 100644
index 0000000000..d5c8d72dc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/bservice.wsdl
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://vtest.wsbinding.wsdlelement.port.bservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="wsdlelement" targetNamespace="http://vtest.wsbinding.wsdlelement.port.bservice" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://vtest.wsbinding.wsdlelement.port.bservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getString">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getStringResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2">
+ <xsd:complexType>
+ <xsd:sequence> <xsd:element name="in1" type="xsd:string"></xsd:element>
+ <xsd:element name="in2" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getInt">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:int"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getIntResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getStringRequest">
+ <wsdl:part element="tns:getString" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part element="tns:getStringResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getString2Request">
+ <wsdl:part name="parameters" element="tns:getString2"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Response">
+ <wsdl:part name="parameters" element="tns:getString2Response"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntRequest">
+ <wsdl:part name="parameters" element="tns:getInt"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntResponse">
+ <wsdl:part name="parameters" element="tns:getIntResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringRequest">
+ <wsdl:part name="parameters" element="tns:getString"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part name="parameters" element="tns:getStringResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntRequest">
+ <wsdl:part name="parameters" element="tns:getInt"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntResponse">
+ <wsdl:part name="parameters" element="tns:getIntResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="BService1PortType">
+ <wsdl:operation name="getString">
+ <wsdl:input message="tns:getStringRequest"/>
+ <wsdl:output message="tns:getStringResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <wsdl:input message="tns:getString2Request"></wsdl:input>
+ <wsdl:output message="tns:getString2Response"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <wsdl:input message="tns:getIntRequest"></wsdl:input>
+ <wsdl:output message="tns:getIntResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="BService2PortType">
+ <wsdl:operation name="getString">
+ <wsdl:input message="tns:getStringRequest"></wsdl:input>
+ <wsdl:output message="tns:getStringResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <wsdl:input message="tns:getIntRequest"></wsdl:input>
+ <wsdl:output message="tns:getIntResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="BService1SOAPBinding"
+ type="tns:BService1PortType"> <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getString"> <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.bservice/getString" /> <wsdl:input> <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output> <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.bservice/getString2" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.bservice/getInt" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="BService2SOAPBinding"
+ type="tns:BService2PortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getString">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.bservice/getString" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.bservice/getInt" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="BService3SOAP12Binding"
+ type="tns:BService1PortType">
+
+ <soap12:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getString">
+
+ <soap12:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.bservice/getString" />
+ <wsdl:input>
+
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+
+ <soap12:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.bservice/getString2" />
+ <wsdl:input>
+
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+
+ <soap12:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.bservice/getInt" />
+ <wsdl:input>
+
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="BService">
+ <wsdl:port binding="tns:BService1SOAPBinding" name="BService1SOAP">
+ <soap:address location=""/>
+ </wsdl:port>
+ <wsdl:port name="BService2SOAP"
+ binding="tns:BService2SOAPBinding">
+ <soap:address location="" />
+ </wsdl:port>
+ <wsdl:port name="BService3SOAP12"
+ binding="tns:BService3SOAP12Binding">
+ <soap12:address location=""></soap12:address>
+ </wsdl:port>
+ </wsdl:service>
+ <wsdl:service name="BService2">
+ <wsdl:port name="BService2Port" binding="tns:BService2SOAPBinding">
+ <soap:address location="" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/cservice.wsdl b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/cservice.wsdl
new file mode 100644
index 0000000000..8a715a2081
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/cservice.wsdl
@@ -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.
+-->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://vtest.wsbinding.wsdlelement.port.cservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CService" targetNamespace="http://vtest.wsbinding.wsdlelement.port.cservice">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://vtest.wsbinding.wsdlelement.port.cservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getFloat">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getFloatResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getInteger">
+ <xsd:complexType>
+ <xsd:sequence> <xsd:element name="in" type="xsd:integer"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getIntegerResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:integer"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in1" type="xsd:string"></xsd:element>
+ <xsd:element name="in2" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getStringResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getFloatRequest">
+ <wsdl:part element="tns:getFloat" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getFloatResponse">
+ <wsdl:part element="tns:getFloatResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getIntegerRequest">
+ <wsdl:part name="parameters" element="tns:getInteger"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntegerResponse">
+ <wsdl:part name="parameters" element="tns:getIntegerResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Request">
+ <wsdl:part name="parameters" element="tns:getString2"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Response">
+ <wsdl:part name="parameters" element="tns:getString2Response"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringRequest">
+ <wsdl:part name="parameters" element="tns:getString"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part name="parameters" element="tns:getStringResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Request">
+ <wsdl:part name="parameters" element="tns:getString2"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Response">
+ <wsdl:part name="parameters" element="tns:getString2Response"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CServicePortType">
+ <wsdl:operation name="getFloat">
+ <wsdl:input message="tns:getFloatRequest"/>
+ <wsdl:output message="tns:getFloatResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getInteger">
+ <wsdl:input message="tns:getIntegerRequest"></wsdl:input>
+ <wsdl:output message="tns:getIntegerResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString">
+ <wsdl:input message="tns:getStringRequest"></wsdl:input>
+ <wsdl:output message="tns:getStringResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <wsdl:input message="tns:getString2Request"></wsdl:input>
+ <wsdl:output message="tns:getString2Response"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CServiceSOAPBinding"
+ type="tns:CServicePortType"> <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getFloat"> <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.cservice/getFloat" /> <wsdl:input> <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output> <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInteger">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.cservice/getInteger" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.cservice/getString" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.port.cservice/getString2" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CService">
+ <wsdl:port binding="tns:CServiceSOAPBinding" name="CServiceSOAP">
+ <soap:address location=""/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/wsdlelement.port.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/wsdlelement.port.composite
new file mode 100644
index 0000000000..5b9b77683e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/main/resources/wsdlelement.port.composite
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://vtest.wsbinding.wsdlelement.port"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="wsdlelement.port">
+
+
+ <component name="BComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.bservice#wsdl.port(BService/BService1SOAP)"
+ uri="http://localhost:8085/BComponent1"/>
+ </service>
+ </component>
+
+ <component name="BComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.bservice#wsdl.port(BService/BService2SOAP)"
+ uri="http://localhost:8085/BComponent2"/>
+ </service>
+ </component>
+
+ <component name="BComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.BService2Impl"/>
+ <service name="BService2">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService2"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.bservice#wsdl.port(BService2/BService2Port)"
+ uri="http://localhost:8085/BComponent3"/>
+ </service>
+ </component>
+
+ <component name="BComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.bservice#wsdl.port(BService/BService3SOAP12)"
+ uri="http://localhost:8085/BComponent4"/>
+ </service>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.CServiceImpl"/>
+ <service name="CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.CService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.cservice#wsdl.port(CService/CServiceSOAP)"
+ uri="http://localhost:8085/CComponent"/>
+ </service>
+ </component>
+
+ <component name="AComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent1/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.bservice#wsdl.port(BService/BService1SOAP)" uri="http://localhost:8085/BComponent1"/>
+ </reference>
+ </component>
+
+ <component name="AComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent2/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.bservice#wsdl.port(BService/BService2SOAP)" uri="http://localhost:8085/BComponent2"/>
+ </reference>
+ </component>
+
+ <component name="AComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.AServiceImpl"/>
+ <reference name="b2" target="BComponent3/BService2">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService2"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.bservice#wsdl.port(BService2/BService2Port)" uri="http://localhost:8085/BComponent3"/>
+ </reference>
+ </component>
+
+ <component name="AComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent4/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.bservice#wsdl.port(BService/BService3SOAP12)" uri="http://localhost:8085/BComponent4"/>
+ </reference>
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.impl.DServiceImpl"/>
+ <reference name="b1" target="BComponent1/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.bservice#wsdl.port(BService/BService1SOAP)" uri="http://localhost:8085/BComponent1"/>
+ </reference>
+ <reference name="c1" target="CComponent/CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.CService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.port.cservice#wsdl.port(CService/CServiceSOAP)" uri="http://localhost:8085/CComponent"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/WsdlElementPortTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/WsdlElementPortTestCase.java
new file mode 100644
index 0000000000..0db579002b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/port/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/port/WsdlElementPortTestCase.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.vtest.wsbinding.wsdlelement.port;
+
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.port.DService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element wsdl.port with WSDL
+ * document described in section section 2.1 of SCA Web Services Binding
+ * V1.00<br>
+ */
+public class WsdlElementPortTestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "wsdlelement.port.composite";
+ protected static AService a1;
+ protected static AService a2;
+ protected static AService a3;
+ protected static AService a4;
+ protected static DService d;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a1 = ServiceFinder.getService(AService.class, "AComponent1");
+ a2 = ServiceFinder.getService(AService.class, "AComponent2");
+ a3 = ServiceFinder.getService(AService.class, "AComponent3");
+ a4 = ServiceFinder.getService(AService.class, "AComponent4");
+ d = ServiceFinder.getService(DService.class, "DComponent1");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 42-45:<br>
+ * Port (WSDL 1.1):<br>
+ * <WSDL-namespace-URI>#wsdl.port(<service-name>/<port-name>)
+ * In this case, the identified port in the WSDL 1.1 Service must have an
+ * equivalent PortType with the SCA service or reference.<br>
+ * <br>
+ * Test wsdl.port(BService/BService1SOAP)<br>
+ */
+ @Test
+ public void testWsdlElementPort1() throws Exception {
+ String aName = a1.getName();
+ String b1Str1 = a1.getB1String("string1");
+ String b1Str2 = a1.getB1String2("string2", "string3");
+ int b1Int = a1.getB1Int(1000);
+
+ System.out.println(aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(1000, b1Int);
+ }
+
+ /**
+ * Lines 42-45:<br>
+ * Port (WSDL 1.1):<br>
+ * <br>
+ * Tests wsdl.port(BService/BService2SOAP) with BService where the port
+ * does not define getString2, so exceptions are expected.<br>
+ */
+ @Test
+ public void testWsdlElementPort2() throws Exception {
+ String aName = a2.getName();
+ System.out.println(aName + ": ");
+ try {
+ a2.getB1String("string1");
+ fail("Should not be able to call getString");
+ } catch (Exception e) {
+ System.out.println(" Exception is expected: " + e.toString());
+ }
+ try {
+ a2.getB1String2("string2", "string3");
+ fail("Should not be able to call getString2");
+ } catch (Exception e) {
+ System.out.println(" Exception is expected: " + e.toString());
+ }
+ try {
+ a2.getB1Int(2000);
+ fail("Should not be able to call getInt");
+ } catch (Exception e) {
+ System.out.println(" Exception is expected: " + e.toString());
+ }
+ }
+
+ /**
+ * Lines 42-45:<br>
+ * Port (WSDL 1.1):<br>
+ * <br>
+ * Tests wsdl.port(BService/BService2SOAP) with BService2<br>
+ */
+ @Test
+ public void testWsdlElementPort3() throws Exception {
+ String aName = a3.getName();
+ String b2Str1 = a3.getB2String("string1");
+ int b2Int = a3.getB2Int(1000);
+
+ System.out.println(aName + ": " + b2Str1 + ", " + b2Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b2Str1);
+ Assert.assertEquals(1000, b2Int);
+ }
+
+ /**
+ * Lines 42-45:<br>
+ * Port (WSDL 1.1):<br>
+ * <br>
+= * Tests two references using wsdl.port.<br>
+ */
+ @Test
+ public void testWsdlElementPort4() throws Exception {
+ String dName = d.getName();
+ String b1Str1 = d.getB1String("string1");
+ String b1Str2 = d.getB1String2("string2", "string3");
+ String c1Str1 = d.getC1String("string5");
+ String c1Str2 = d.getC1String2("string6", "string7");
+
+ int b1Int = d.getB1Int(4000);
+ float c1Float = d.getC1Float((float) 8.8);
+
+ Integer c1Integer = d.getC1Integer(new Integer(9000));
+
+ System.out.println(dName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int + ", " + c1Str1 + ", " + c1Str2 + ", " + c1Float + ", " + c1Integer);
+ Assert.assertEquals("DService", dName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ Assert.assertEquals("string5", c1Str1);
+ Assert.assertEquals("string6string7", c1Str2);
+ Assert.assertEquals((float) 8.8, c1Float);
+ Assert.assertEquals(new Integer(9000), c1Integer);
+ }
+
+ /**
+ * Lines 42-45:<br>
+ * Port (WSDL 1.1):<br>
+ * <br>
+= * Tests wsdl.port(BService/BService3SOAP12) which uses SOAP 1.2<br>
+ */
+ @Test
+ public void testWsdlElementPort5() throws Exception {
+ String aName = a4.getName();
+ String b1Str1 = a4.getB1String("string1");
+ String b1Str2 = a4.getB1String2("string2", "string3");
+ int b1Int = a4.getB1Int(5000);
+
+ System.out.println(aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(5000, b1Int);
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/pom.xml b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/pom.xml
new file mode 100644
index 0000000000..149037cf4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/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>vtest-wsbinding-wsdlelement</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>vtest-wsbinding-wsdlelement-service</artifactId>
+ <name>Apache Tuscany SCA Web Service Binding Verification Tests - WSDL wsdlElement wsdl.service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/AService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/AService.java
new file mode 100644
index 0000000000..69b709ae95
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/AService.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.vtest.wsbinding.wsdlelement.service;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for AService.
+ */
+@Remotable
+public interface AService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getB2String(String aString);
+
+ public int getB2Int(int i);
+
+ public String getB3String(String aString);
+
+ public int getB3Int(int i);
+
+ public String getB4String(String aString);
+
+ public String getB4String2(String aString, String bString);
+
+ public int getB4Int(int i);
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/BService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/BService.java
new file mode 100644
index 0000000000..852f36e0c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/BService.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.vtest.wsbinding.wsdlelement.service;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/BService2.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/BService2.java
new file mode 100644
index 0000000000..bfcacdaa21
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/BService2.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.vtest.wsbinding.wsdlelement.service;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface BService2 {
+
+ public String getString(String aString);
+
+ public int getInt(int i);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/CService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/CService.java
new file mode 100644
index 0000000000..5ceab40d0e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/CService.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.vtest.wsbinding.wsdlelement.service;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Service used by another service
+ */
+@Remotable
+public interface CService {
+
+ public String getString(String aString);
+
+ public String getString2(String aString, String bString);
+
+ public Integer getInteger(Integer i);
+
+ public float getFloat(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/DService.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/DService.java
new file mode 100644
index 0000000000..5182ee3029
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/DService.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.vtest.wsbinding.wsdlelement.service;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for DService.
+ */
+@Remotable
+public interface DService {
+
+ public String getName();
+
+ public String getB1String(String aString);
+
+ public String getB1String2(String aString, String bString);
+
+ public int getB1Int(int i);
+
+ public String getC1String(String aString);
+
+ public String getC1String2(String aString, String bString);
+
+ public Integer getC1Integer(Integer i);
+
+ public float getC1Float(float f);
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/AServiceImpl.java
new file mode 100644
index 0000000000..e89cf21215
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/AServiceImpl.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.vtest.wsbinding.wsdlelement.service.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService2;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements AService.
+ */
+@Service(AService.class)
+public class AServiceImpl implements AService {
+
+ @Reference(required=false)
+ public BService b1;
+
+ @Reference(required=false)
+ public BService2 b2;
+
+ @Reference(required=false)
+ public BService2 b3;
+
+ @Reference(required=false)
+ public BService b4;
+
+ public String getName() {
+ return "AService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getB2String(String aString) {
+ return b2.getString(aString);
+ }
+
+ public int getB2Int(int i) {
+ return b2.getInt(i);
+ }
+
+ public String getB3String(String aString) {
+ return b3.getString(aString);
+ }
+
+ public int getB3Int(int i) {
+ return b3.getInt(i);
+ }
+
+ public String getB4String(String aString) {
+ return b4.getString(aString);
+ }
+
+ public String getB4String2(String aString, String bString) {
+ return b4.getString2(aString, bString);
+ }
+
+ public int getB4Int(int i) {
+ return b4.getInt(i);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/BService2Impl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/BService2Impl.java
new file mode 100644
index 0000000000..b8c23433eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/BService2Impl.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.vtest.wsbinding.wsdlelement.service.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService2;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService2.class)
+public class BService2Impl implements BService2 {
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/BServiceImpl.java
new file mode 100644
index 0000000000..cbbf8222e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/BServiceImpl.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.vtest.wsbinding.wsdlelement.service.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService;
+import org.osoa.sca.annotations.Service;
+
+@Service(BService.class)
+public class BServiceImpl implements BService {
+
+ public String getName() {
+ return "BService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public int getInt(int i) {
+ return i;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/CServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/CServiceImpl.java
new file mode 100644
index 0000000000..29a22f31bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/CServiceImpl.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.vtest.wsbinding.wsdlelement.service.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.CService;
+import org.osoa.sca.annotations.Service;
+
+@Service(CService.class)
+public class CServiceImpl implements CService {
+
+ public String getName() {
+ return "CService";
+ }
+
+ public String getString(String aString) {
+ return aString;
+ }
+
+ public String getString2(String aString, String bString) {
+ return aString + bString;
+ }
+
+ public Integer getInteger(Integer i) {
+ return i;
+ }
+
+ public float getFloat(float f) {
+ return f;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/DServiceImpl.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/DServiceImpl.java
new file mode 100644
index 0000000000..87654e7188
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/impl/DServiceImpl.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.vtest.wsbinding.wsdlelement.service.impl;
+
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.CService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.DService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements DService.
+ */
+@Service(DService.class)
+public class DServiceImpl implements DService {
+
+ @Reference
+ public BService b1;
+
+ @Reference
+ public CService c1;
+
+ public String getName() {
+ return "DService";
+ }
+
+ public String getB1String(String aString) {
+ return b1.getString(aString);
+ }
+
+ public String getB1String2(String aString, String bString) {
+ return b1.getString2(aString, bString);
+ }
+
+ public int getB1Int(int i) {
+ return b1.getInt(i);
+ }
+
+ public String getC1String(String aString) {
+ return c1.getString(aString);
+ }
+
+ public String getC1String2(String aString, String bString) {
+ return c1.getString2(aString, bString);
+ }
+
+ public Integer getC1Integer(Integer i) {
+ return c1.getInteger(i);
+ }
+
+ public float getC1Float(float f) {
+ return c1.getFloat(f);
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/bservice.wsdl b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/bservice.wsdl
new file mode 100644
index 0000000000..521f077c46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/bservice.wsdl
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://vtest.wsbinding.wsdlelement.service.bservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="wsdlelement" targetNamespace="http://vtest.wsbinding.wsdlelement.service.bservice" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://vtest.wsbinding.wsdlelement.service.bservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getString">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getStringResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2">
+ <xsd:complexType>
+ <xsd:sequence> <xsd:element name="in1" type="xsd:string"></xsd:element>
+ <xsd:element name="in2" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getInt">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:int"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getIntResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:int"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getStringRequest">
+ <wsdl:part element="tns:getString" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part element="tns:getStringResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getString2Request">
+ <wsdl:part name="parameters" element="tns:getString2"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Response">
+ <wsdl:part name="parameters" element="tns:getString2Response"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntRequest">
+ <wsdl:part name="parameters" element="tns:getInt"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntResponse">
+ <wsdl:part name="parameters" element="tns:getIntResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringRequest">
+ <wsdl:part name="parameters" element="tns:getString"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part name="parameters" element="tns:getStringResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntRequest">
+ <wsdl:part name="parameters" element="tns:getInt"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntResponse">
+ <wsdl:part name="parameters" element="tns:getIntResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="BService1PortType">
+ <wsdl:operation name="getString">
+ <wsdl:input message="tns:getStringRequest"/>
+ <wsdl:output message="tns:getStringResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <wsdl:input message="tns:getString2Request"></wsdl:input>
+ <wsdl:output message="tns:getString2Response"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <wsdl:input message="tns:getIntRequest"></wsdl:input>
+ <wsdl:output message="tns:getIntResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="BService2PortType">
+ <wsdl:operation name="getString">
+ <wsdl:input message="tns:getStringRequest"></wsdl:input>
+ <wsdl:output message="tns:getStringResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <wsdl:input message="tns:getIntRequest"></wsdl:input>
+ <wsdl:output message="tns:getIntResponse"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="BService1SOAPBinding"
+ type="tns:BService1PortType"> <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getString"> <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.bservice/getString" /> <wsdl:input> <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output> <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.bservice/getString2" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.bservice/getInt" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="BService2SOAPBinding"
+ type="tns:BService2PortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getString">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.bservice/getString" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.bservice/getInt" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="BService3SOAP12Binding"
+ type="tns:BService1PortType">
+ <soap12:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getString">
+ <soap12:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.bservice/getString" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <soap12:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.bservice/getString2" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInt">
+ <soap12:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.bservice/getInt" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="BService">
+ <wsdl:port binding="tns:BService1SOAPBinding" name="BService1SOAP">
+ <soap:address location=""/>
+ </wsdl:port>
+ </wsdl:service>
+ <wsdl:service name="BService2">
+ <wsdl:port name="BService2Port" binding="tns:BService2SOAPBinding">
+ <soap:address location="" />
+ </wsdl:port>
+ </wsdl:service>
+ <wsdl:service name="BService3">
+ <wsdl:port name="BService3SOAP12" binding="tns:BService3SOAP12Binding">
+ <soap12:address location=""></soap12:address>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/cservice.wsdl b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/cservice.wsdl
new file mode 100644
index 0000000000..bdf294b473
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/cservice.wsdl
@@ -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.
+-->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://vtest.wsbinding.wsdlelement.service.cservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CService" targetNamespace="http://vtest.wsbinding.wsdlelement.service.cservice">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://vtest.wsbinding.wsdlelement.service.cservice" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getFloat">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getFloatResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getInteger">
+ <xsd:complexType>
+ <xsd:sequence> <xsd:element name="in" type="xsd:integer"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getIntegerResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:integer"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in1" type="xsd:string"></xsd:element>
+ <xsd:element name="in2" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString2Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getString">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getStringResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getFloatRequest">
+ <wsdl:part element="tns:getFloat" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getFloatResponse">
+ <wsdl:part element="tns:getFloatResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="getIntegerRequest">
+ <wsdl:part name="parameters" element="tns:getInteger"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getIntegerResponse">
+ <wsdl:part name="parameters" element="tns:getIntegerResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Request">
+ <wsdl:part name="parameters" element="tns:getString2"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Response">
+ <wsdl:part name="parameters" element="tns:getString2Response"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringRequest">
+ <wsdl:part name="parameters" element="tns:getString"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part name="parameters" element="tns:getStringResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Request">
+ <wsdl:part name="parameters" element="tns:getString2"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString2Response">
+ <wsdl:part name="parameters" element="tns:getString2Response"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="CServicePortType">
+ <wsdl:operation name="getFloat">
+ <wsdl:input message="tns:getFloatRequest"/>
+ <wsdl:output message="tns:getFloatResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getInteger">
+ <wsdl:input message="tns:getIntegerRequest"></wsdl:input>
+ <wsdl:output message="tns:getIntegerResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString">
+ <wsdl:input message="tns:getStringRequest"></wsdl:input>
+ <wsdl:output message="tns:getStringResponse"></wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <wsdl:input message="tns:getString2Request"></wsdl:input>
+ <wsdl:output message="tns:getString2Response"></wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CServiceSOAPBinding"
+ type="tns:CServicePortType"> <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getFloat"> <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.cservice/getFloat" /> <wsdl:input> <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output> <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getInteger">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.cservice/getInteger" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.cservice/getString" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getString2">
+ <soap:operation
+ soapAction="http://vtest.wsbinding.wsdlelement.service.cservice/getString2" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CService">
+ <wsdl:port binding="tns:CServiceSOAPBinding" name="CServiceSOAP">
+ <soap:address location=""/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/wsdlelement.service.composite b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/wsdlelement.service.composite
new file mode 100644
index 0000000000..9801ecd037
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/main/resources/wsdlelement.service.composite
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://vtest.wsbinding.wsdlelement.service"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="wsdlelement.service">
+
+ <component name="BComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService)" uri="http://localhost:8085/BComponent1"/>
+ </service>
+ </component>
+
+ <component name="BComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService2)" uri="http://localhost:8085/BComponent2"/>
+ </service>
+ </component>
+
+ <component name="BComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.BService2Impl"/>
+ <service name="BService2">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService2"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService2)" uri="http://localhost:8085/BComponent3"/>
+ </service>
+ </component>
+
+ <component name="BComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.port(BService/BService1SOAP)" uri="http://localhost:8085/BComponent4"/>
+ </service>
+ </component>
+
+ <component name="BComponent5">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.BService2Impl"/>
+ <service name="BService2">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService2"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.binding(BService2SOAPBinding)" uri="http://localhost:8085/BComponent5"/>
+ </service>
+ </component>
+
+ <component name="BComponent6">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.BServiceImpl"/>
+ <service name="BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService3)" uri="http://localhost:8085/BComponent6"/>
+ </service>
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.CServiceImpl"/>
+ <service name="CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.CService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.cservice#wsdl.service(CService)" uri="http://localhost:8085/CComponent"/>
+ </service>
+ </component>
+
+ <component name="AComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent1/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService)" uri="http://localhost:8085/BComponent1"/>
+ </reference>
+ </component>
+
+ <component name="AComponent2">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent2/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService2)" uri="http://localhost:8085/BComponent2"/>
+ </reference>
+ </component>
+
+ <component name="AComponent3">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.AServiceImpl"/>
+ <reference name="b2" target="BComponent3/BService2">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService2"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService2)" uri="http://localhost:8085/BComponent3"/>
+ </reference>
+ </component>
+
+ <component name="AComponent4">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent4/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.port(BService/BService1SOAP)" uri="http://localhost:8085/BComponent4"/>
+ </reference>
+ <reference name="b2" target="BComponent3/BService2">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService2"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService2)" uri="http://localhost:8085/BComponent3"/>
+ </reference>
+ <reference name="b3" target="BComponent5/BService2">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService2"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.binding(BService2SOAPBinding)" uri="http://localhost:8085/BComponent5"/>
+ </reference>
+ <reference name="b4" target="BComponent6/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService3)" uri="http://localhost:8085/BComponent6"/>
+ </reference>
+ </component>
+
+ <component name="AComponent5">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.AServiceImpl"/>
+ <reference name="b1" target="BComponent6/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService3)" uri="http://localhost:8085/BComponent6"/>
+ </reference>
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.impl.DServiceImpl"/>
+ <reference name="b1" target="BComponent1/BService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.BService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.bservice#wsdl.service(BService)" uri="http://localhost:8085/BComponent1"/>
+ </reference>
+ <reference name="c1" target="CComponent/CService">
+ <interface.java interface="org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.CService"/>
+ <binding.ws wsdlElement="http://vtest.wsbinding.wsdlelement.service.cservice#wsdl.service(CService)" uri="http://localhost:8085/CComponent"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/WsdlElementServiceTestCase.java b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/WsdlElementServiceTestCase.java
new file mode 100644
index 0000000000..22d2a80244
--- /dev/null
+++ b/sca-java-1.x/branches/sca-android/vtest/wsbinding/wsdlelement/service/src/test/java/org/apache/tuscany/sca/vtest/wsbinding/wsdlelement/service/WsdlElementServiceTestCase.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.sca.vtest.wsbinding.wsdlelement.service;
+
+import static org.junit.Assert.fail;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.AService;
+import org.apache.tuscany.sca.vtest.wsbinding.wsdlelement.service.DService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the simplest form of the binding element wsdl.service with WSDL
+ * document described in section section 2.1 of SCA Web Services Binding
+ * V1.00<br>
+ */
+public class WsdlElementServiceTestCase {
+
+ protected static ServiceFinder serviceFinder;
+ protected static String compositeName = "wsdlelement.service.composite";
+ protected static AService a1;
+ protected static AService a2;
+ protected static AService a3;
+ protected static AService a4;
+ protected static AService a5;
+ protected static DService d;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ System.out.println("Setting up");
+ ServiceFinder.init(compositeName);
+ a1 = ServiceFinder.getService(AService.class, "AComponent1");
+ a2 = ServiceFinder.getService(AService.class, "AComponent2");
+ a3 = ServiceFinder.getService(AService.class, "AComponent3");
+ a4 = ServiceFinder.getService(AService.class, "AComponent4");
+ a5 = ServiceFinder.getService(AService.class, "AComponent5");
+ d = ServiceFinder.getService(DService.class, "DComponent1");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Lines 38-41:<br>
+ * Service:<br>
+ * <WSDL-namespace-URI>#wsdl.service(<service-name>)<br>
+ * In this case, all the endpoints in the WSDL Service that have equivalent
+ * PortTypes with the SCA service or reference must be available to the SCA
+ * service or reference.<br>
+ * <br>
+ * Tests wsdl.service(BService)<br>
+ */
+ @Test
+ public void testWsdlElementService1() throws Exception {
+ String aName = a1.getName();
+ String b1Str1 = a1.getB1String("string1");
+ String b1Str2 = a1.getB1String2("string2", "string3");
+ int b1Int = a1.getB1Int(1000);
+
+ System.out.println(aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(1000, b1Int);
+ }
+
+ /**
+ * Lines 38-41:<br>
+ * Service:<br>
+ * <br>
+ * Tests wsdl.service(BService2) with with BService where the service
+ * does not define getString2, so exceptions are expected.<br>
+ */
+ @Test
+ public void testWsdlElementService2() throws Exception {
+ String aName = a2.getName();
+ System.out.println(aName + ": ");
+ try {
+ a2.getB1String("string1");
+ fail("Should not be able to call getString");
+ } catch (Exception e) {
+ System.out.println(" Exception is expected: " + e.toString());
+ }
+ try {
+ a2.getB1String2("string2", "string3");
+ fail("Should not be able to call getString2");
+ } catch (Exception e) {
+ System.out.println(" Exception is expected: " + e.toString());
+ }
+ try {
+ a2.getB1Int(2000);
+ fail("Should not be able to call getInt");
+ } catch (Exception e) {
+ System.out.println(" Exception is expected: " + e.toString());
+ }
+ }
+
+ /**
+ * Lines 38-41:<br>
+ * Service:<br>
+ * <br>
+ * Tests wsdl.service(BService2) with BService2<br>
+ */
+ @Test
+ public void testWsdlElementService3() throws Exception {
+ String aName = a3.getName();
+ String b2Str1 = a3.getB2String("string1");
+ int b2Int = a3.getB2Int(1000);
+
+ System.out.println(aName + ": " + b2Str1 + ", " + b2Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b2Str1);
+ Assert.assertEquals(1000, b2Int);
+ }
+
+ /**
+ * Lines 38-41:<br>
+ * Service:<br>
+ * <br>
+ * Tests two references using wsdl.service.<br>
+ */
+ @Test
+ public void testWsdlElementService4() throws Exception {
+ String dName = d.getName();
+ String b1Str1 = d.getB1String("string1");
+ String b1Str2 = d.getB1String2("string2", "string3");
+ String c1Str1 = d.getC1String("string5");
+ String c1Str2 = d.getC1String2("string6", "string7");
+
+ int b1Int = d.getB1Int(4000);
+ float c1Float = d.getC1Float((float) 8.8);
+
+ Integer c1Integer = d.getC1Integer(new Integer(9000));
+
+ System.out.println(dName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int + ", " + c1Str1 + ", " + c1Str2 + ", " + c1Float + ", " + c1Integer);
+ Assert.assertEquals("DService", dName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(4000, b1Int);
+ Assert.assertEquals("string5", c1Str1);
+ Assert.assertEquals("string6string7", c1Str2);
+ Assert.assertEquals((float) 8.8, c1Float);
+ Assert.assertEquals(new Integer(9000), c1Integer);
+ }
+
+ /**
+ * Lines 38-41:<br>
+ * Service:<br>
+ * <br>
+ * Tests mixed bindings of using wsdl.port, wsdl.service, wsdl.binding,
+ * and soap 1.2
+ * <br>
+ */
+ @Test
+ public void testWsdlElementService5() throws Exception {
+ String aName = a4.getName();
+ String b1Str1 = a4.getB1String("port");
+ String b1Str2 = a4.getB1String2("string1", "string2");
+ int b1Int = a4.getB1Int(1000);
+ System.out.println(aName);
+ System.out.println(" b1: " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("port", b1Str1);
+ Assert.assertEquals("string1string2", b1Str2);
+ Assert.assertEquals(1000, b1Int);
+
+ String b2Str1 = a4.getB2String("service");
+ int b2Int = a4.getB2Int(2000);
+ System.out.println(" b2: " + b2Str1 + ", " + b2Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("service", b2Str1);
+ Assert.assertEquals(2000, b2Int);
+
+ String b3Str1 = a4.getB3String("binding");
+ int b3Int = a4.getB3Int(3000);
+ System.out.println(" b3: " + b3Str1 + ", " + b3Int);
+ Assert.assertEquals("binding", b3Str1);
+ Assert.assertEquals(3000, b3Int);
+
+ String b4Str1 = a4.getB4String("soap12");
+ String b4Str2 = a4.getB4String2("string3", "string4");
+ int b4Int = a4.getB4Int(4000);
+ System.out.println(" b4: " + b4Str1 + ", " + b4Str2 + ", " + b4Int);
+ Assert.assertEquals("soap12", b4Str1);
+ Assert.assertEquals("string3string4", b4Str2);
+ Assert.assertEquals(4000, b4Int);
+
+ }
+
+ /**
+ * Lines 38-41:<br>
+ * Service:<br>
+ * <br>
+ * Tests wsdl.service(BService3) which uses SOAP 1.2<br>
+ */
+ @Test
+ public void testWsdlElementService6() throws Exception {
+ String aName = a5.getName();
+ String b1Str1 = a5.getB1String("string1");
+ String b1Str2 = a5.getB1String2("string2", "string3");
+ int b1Int = a5.getB1Int(6000);
+
+ System.out.println(aName + ": " + b1Str1 + ", " + b1Str2 + ", " + b1Int);
+ Assert.assertEquals("AService", aName);
+ Assert.assertEquals("string1", b1Str1);
+ Assert.assertEquals("string2string3", b1Str2);
+ Assert.assertEquals(6000, b1Int);
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ System.out.println("Cleaning up");
+ ServiceFinder.cleanup();
+ }
+}